Skip to content

Commit 4c0d72e

Browse files
[skip-changelog] bye bye legacy (#2317)
* Move Preprocess and Build in arduino/builder * Move the detector inside arduino/builder * remove legacy targets from TaskFile * inline some variable declaration * remove no longer used builder getters * make only necessary function public in the new builder * fix CR: avoid mutating internal state * fix CR: only print normaloutput when is not verbose
1 parent 6d57ce6 commit 4c0d72e

File tree

18 files changed

+312
-586
lines changed

18 files changed

+312
-586
lines changed

.github/workflows/test-go-task.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ jobs:
154154
- name: Run tests
155155
run: task go:test
156156

157-
- name: Run unit tests on the legacy package
158-
# Run legacy tests on one platform only
159-
if: runner.os == 'Linux'
160-
run: task test-legacy
161-
162157
- name: Upload coverage data to workflow artifact
163158
if: runner.os == 'Linux'
164159
uses: actions/upload-artifact@v3
@@ -167,7 +162,6 @@ jobs:
167162
name: ${{ env.COVERAGE_ARTIFACT }}
168163
path: |
169164
./coverage_unit.txt
170-
./coverage_legacy.txt
171165
172166
coverage-upload:
173167
runs-on: ubuntu-latest

Taskfile.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -284,21 +284,11 @@ tasks:
284284
- task: go:build
285285

286286
test:
287-
desc: Run the full testsuite, `legacy` will be skipped
287+
desc: Run the full testsuite
288288
cmds:
289289
- task: go:test
290290
- task: go:integration-test
291291

292-
test-legacy:
293-
desc: Run tests for the `legacy` package
294-
cmds:
295-
- |
296-
go test \
297-
{{ default "-v -failfast" .GOFLAGS }} \
298-
-coverprofile=coverage_legacy.txt \
299-
./legacy/... \
300-
{{.TEST_LDFLAGS}}
301-
302292
test-unit-race:
303293
desc: Run unit tests only with race condition detection
304294
cmds:
@@ -311,18 +301,12 @@ tasks:
311301
{{.TEST_LDFLAGS}}
312302
313303
check:
314-
desc: Check fmt and lint, `legacy` will be skipped
304+
desc: Check fmt and lint
315305
cmds:
316306
- task: go:vet
317307
- task: go:lint
318308
- task: protoc:check
319309

320-
check-legacy:
321-
desc: Check fmt and lint for the `legacy` package
322-
cmds:
323-
- test -z $(go fmt ./legacy/...)
324-
- go vet ./legacy/...
325-
326310
rpc-client:
327311
desc: Run the rpc client test routine (server must be already started)
328312
cmds:
@@ -376,10 +360,10 @@ tasks:
376360
vars:
377361
PROJECT_NAME: "arduino-cli"
378362
DIST_DIR: "dist"
379-
# all modules of this project except for "legacy/..." module and integration test
363+
# all modules of this project except for integration test
380364
DEFAULT_GO_PACKAGES:
381365
sh: |
382-
echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v internal/integrationtest | grep -v legacy | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
366+
echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v internal/integrationtest | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
383367
DEFAULT_INTEGRATIONTEST_GO_PACKAGES:
384368
sh: |
385369
echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep internal/integrationtest | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')

arduino/builder/build_options_manager.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,16 @@ func (m *BuildOptionsManager) wipeBuildPath() error {
154154
return wipe()
155155
}
156156

157+
// Since we might apply a side effect we clone it
158+
currentOptions := m.currentOptions.Clone()
157159
// If SketchLocation path is different but filename is the same, consider it equal
158-
if filepath.Base(m.currentOptions.Get("sketchLocation")) == filepath.Base(prevOpts.Get("sketchLocation")) {
159-
m.currentOptions.Remove("sketchLocation")
160+
if filepath.Base(currentOptions.Get("sketchLocation")) == filepath.Base(prevOpts.Get("sketchLocation")) {
161+
currentOptions.Remove("sketchLocation")
160162
prevOpts.Remove("sketchLocation")
161163
}
162164

163165
// If options are not changed check if core has
164-
if m.currentOptions.Equals(prevOpts) {
166+
if currentOptions.Equals(prevOpts) {
165167
// check if any of the files contained in the core folders has changed
166168
// since the json was generated - like platform.txt or similar
167169
// if so, trigger a "safety" wipe

0 commit comments

Comments
 (0)