Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Try harder to not recompile sketch without modifications.#2961

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cmaglie wants to merge14 commits intoarduino:master
base:master
Choose a base branch
Loading
fromcmaglie:do-not-recompile-sketch

Conversation

@cmaglie
Copy link
Member

Please check if the PR fulfills these requirements

Seehow to contribute

  • The PR has no duplicates (please search among thePull 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?

Improves the checks made to the sketch to avoid useless recompilation and preprocessing.

What is the current behavior?

The sketch source code, before being compiled, undergoes a two-phase processing:

  1. If the sketch has multiple source files, these files are merged, forming a single .cpp file.
  2. The merged .cpp file is then "preprocessed" to automatically obtain the forward declarations of the functions defined in the sketch.

Previously, these two operations were always performed, touching the finalsketch.cpp. This resulted insketch.cpp being recompiled every time. Moreover, the library discovery cache could not be exploited because of thesketch.cpp timestamp change.

What is the new behavior?

The merged sketch file is saved in a separatesketch.cpp.merged file, and it is compared to the newly generated content. If they match, the already preprocessedsketch.cpp andsketch.cpp.merged are left untouched.
This is enough for the current build system to recognize that the file is already up-to-date and skip both compilation and library discovery, which greatly improves compile times.

Does this PR introduce a breaking change, and istitled accordingly?

Unless I'm missing some convoluted case, it shouldn't.

Other information

Ivoz reacted with thumbs up emoji
@cmagliecmaglie self-assigned thisJul 29, 2025
@cmagliecmaglie added type: enhancementProposed improvement topic: build-processRelated to the sketch build process labelsJul 29, 2025
@cmagliecmaglieforce-pushed thedo-not-recompile-sketch branch 2 times, most recently from18335b6 toaa33373CompareJuly 29, 2025 15:33
@codecov
Copy link

codecovbot commentedJul 29, 2025
edited
Loading

Codecov Report

❌ Patch coverage is78.43866% with58 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.46%. Comparing base (20e315c) to head (b1a6aed).
⚠️ Report is 1 commits behind head on master.

Files with missing linesPatch %Lines
...l/arduino/builder/internal/detector/source_file.go58.33%19 Missing and 6 partials⚠️
internal/arduino/builder/builder.go52.38%6 Missing and 4 partials⚠️
internal/arduino/builder/internal/utils/utils.go56.52%7 Missing and 3 partials⚠️
internal/arduino/builder/sketch.go50.00%4 Missing and 2 partials⚠️
...rnal/arduino/builder/internal/detector/detector.go88.63%3 Missing and 2 partials⚠️
...lder/internal/preprocessor/arduino_preprocessor.go0.00%1 Missing⚠️
...nal/arduino/builder/internal/preprocessor/ctags.go92.85%0 Missing and 1 partial⚠️
Additional details and impacted files
@@            Coverage Diff             @@##           master    #2961      +/-   ##==========================================+ Coverage   68.36%   68.46%   +0.09%==========================================  Files         241      242       +1       Lines       22731    22893     +162     ==========================================+ Hits        15541    15674     +133- Misses       5992     6014      +22- Partials     1198     1205       +7
FlagCoverage Δ
unit68.46% <78.43%> (+0.09%)⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@per1234per1234 added the topic: codeRelated to content of the project itself labelAug 17, 2025
@cmagliecmaglieforce-pushed thedo-not-recompile-sketch branch 2 times, most recently fromaa41179 to1ca362cCompareAugust 25, 2025 14:16
@cmagliecmaglieforce-pushed thedo-not-recompile-sketch branch from1ca362c tof32315fCompareSeptember 2, 2025 17:49
@cmagliecmaglieforce-pushed thedo-not-recompile-sketch branch 3 times, most recently fromf8e6556 to2a278c5CompareOctober 13, 2025 08:22
During the library detection phase, we do not have objects files yet,the only thing that we should check is if the dependency file isup-to-date.In this commit we let GCC create a dep file during the library discoveryphase.We must ensure that the build-path folder exists otherwise the compilerwill not be able to create the dep file.
@cmagliecmaglieforce-pushed thedo-not-recompile-sketch branch from2a278c5 tofa72186CompareOctober 13, 2025 08:25
@cmagliecmaglieforce-pushed thedo-not-recompile-sketch branch fromfa72186 to1cdbf67CompareOctober 13, 2025 09:28
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@cmagliecmaglie

Labels

topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: enhancementProposed improvement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Do not recompile the sketch if there are no changes and libraries have not changed Sketch re-compiled when unnecessary

2 participants

@cmaglie@per1234

[8]ページ先頭

©2009-2025 Movatter.jp