Skip to content

[skip-changelog] Handle repeated builds of a sketch when --build-path target is in the sketch directory #2084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2023

Conversation

MatteoPologruto
Copy link
Contributor

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Code imperfection fix

What is the current behavior?

It is not possible to build a sketch multiple times when the --build-path is the same and is inside the sketch directory. The following error is thrown:

Error during build: unable to read contents of the source item: open <mydir>/build-mega/compile_commands.json:
no such file or directory

It happens because the CLI treats the build directory as part of the sketch itself, therefore it fails when the content of the directory gets deleted/overwritten.

What is the new behavior?

If the --build-path target already exists and is inside the sketch directory, it is ignored when the sketch instance is created, allowing the user to compile multiple times.

Does this PR introduce a breaking change, and is titled accordingly?

No

@MatteoPologruto MatteoPologruto added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Feb 22, 2023
@MatteoPologruto MatteoPologruto self-assigned this Feb 22, 2023
@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.04 ⚠️

Comparison is base (e7ba99f) 36.46% compared to head (61560f4) 36.42%.

❗ Current head 61560f4 differs from pull request most recent head d29c379. Consider uploading reports for the commit d29c379 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2084      +/-   ##
==========================================
- Coverage   36.46%   36.42%   -0.04%     
==========================================
  Files         229      229              
  Lines       19558    19578      +20     
==========================================
  Hits         7131     7131              
- Misses      11588    11608      +20     
  Partials      839      839              
Flag Coverage Δ
unit 36.42% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commands/compile/compile.go 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MatteoPologruto MatteoPologruto force-pushed the repeated-build-path branch 2 times, most recently from e13561b to ed96ee2 Compare March 1, 2023 10:37
@MatteoPologruto MatteoPologruto merged commit 78bfa74 into arduino:master Mar 1, 2023
@MatteoPologruto MatteoPologruto deleted the repeated-build-path branch March 1, 2023 14:31
@kalj
Copy link

kalj commented Mar 1, 2023

Thanks for fixing #1646 ! 👍 ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specifying --build-path inside the sketch directory is not handled correctly
3 participants