Skip to content

Commit

Permalink
[skip-changelog] bye bye legacy (#2317)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alessio-perugini authored Sep 15, 2023
1 parent 6d57ce6 commit 4c0d72e
Show file tree
Hide file tree
Showing 18 changed files with 312 additions and 586 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/test-go-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ jobs:
- name: Run tests
run: task go:test

- name: Run unit tests on the legacy package
# Run legacy tests on one platform only
if: runner.os == 'Linux'
run: task test-legacy

- name: Upload coverage data to workflow artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
Expand All @@ -167,7 +162,6 @@ jobs:
name: ${{ env.COVERAGE_ARTIFACT }}
path: |
./coverage_unit.txt
./coverage_legacy.txt
coverage-upload:
runs-on: ubuntu-latest
Expand Down
24 changes: 4 additions & 20 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,11 @@ tasks:
- task: go:build

test:
desc: Run the full testsuite, `legacy` will be skipped
desc: Run the full testsuite
cmds:
- task: go:test
- task: go:integration-test

test-legacy:
desc: Run tests for the `legacy` package
cmds:
- |
go test \
{{ default "-v -failfast" .GOFLAGS }} \
-coverprofile=coverage_legacy.txt \
./legacy/... \
{{.TEST_LDFLAGS}}
test-unit-race:
desc: Run unit tests only with race condition detection
cmds:
Expand All @@ -311,18 +301,12 @@ tasks:
{{.TEST_LDFLAGS}}
check:
desc: Check fmt and lint, `legacy` will be skipped
desc: Check fmt and lint
cmds:
- task: go:vet
- task: go:lint
- task: protoc:check

check-legacy:
desc: Check fmt and lint for the `legacy` package
cmds:
- test -z $(go fmt ./legacy/...)
- go vet ./legacy/...

rpc-client:
desc: Run the rpc client test routine (server must be already started)
cmds:
Expand Down Expand Up @@ -376,10 +360,10 @@ tasks:
vars:
PROJECT_NAME: "arduino-cli"
DIST_DIR: "dist"
# all modules of this project except for "legacy/..." module and integration test
# all modules of this project except for integration test
DEFAULT_GO_PACKAGES:
sh: |
echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v internal/integrationtest | grep -v legacy | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v internal/integrationtest | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
DEFAULT_INTEGRATIONTEST_GO_PACKAGES:
sh: |
echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep internal/integrationtest | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
Expand Down
8 changes: 5 additions & 3 deletions arduino/builder/build_options_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ func (m *BuildOptionsManager) wipeBuildPath() error {
return wipe()
}

// Since we might apply a side effect we clone it
currentOptions := m.currentOptions.Clone()
// If SketchLocation path is different but filename is the same, consider it equal
if filepath.Base(m.currentOptions.Get("sketchLocation")) == filepath.Base(prevOpts.Get("sketchLocation")) {
m.currentOptions.Remove("sketchLocation")
if filepath.Base(currentOptions.Get("sketchLocation")) == filepath.Base(prevOpts.Get("sketchLocation")) {
currentOptions.Remove("sketchLocation")
prevOpts.Remove("sketchLocation")
}

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

0 comments on commit 4c0d72e

Please sign in to comment.