Skip to content

Tools - mkbuildoptglobals refactoring & attempt to fix caching #9249

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented May 27, 2025

Optional include for build-dir header to exclude it from core.a when no build opts are created / used. Preventive reads before writes, too
Prefer to use --output-dir in scripts, tests/device must be out-of-tree for caching to work properly (by avoiding changing core nested dirs)

Assume 'aggressive caching' is normal mode of operation, no need for special treatment
(dependencies can be checked by looking at .d files in the build dir)

Even CI uses arduino-cli ~/.cache/arduino/{sketch,core} for building
Allow sketches without globals.h to share core.a, rebuild otherwise (same sketch cache is retained, core.a & .o's reused)

Drop manual logging in favour of 'import logging'. Arduino-CLI might still need tweaks in debug mode, though. Output flushing does not always happen promptly, but using single lines instead of multiple often helps.

Allow multiple entries for the same name, which are then merged.
Allow spaces between @ and the signature words.
Allow to use line right after signature.
Syntax warnings show relevant snippet from globals.h

mcspr added 14 commits May 27, 2025 07:22
Optional include for build-dir header to exclude it from core.a when no
build opts are created / used. Preventive reads before writes, too
Plus, missing change to makecorever.py doing read before write
Prefer to use --output-dir in scripts, tests/device *must* be
out-of-tree for caching to work properly (avoid changing core nested dirs)

Assume 'aggressive caching' is normal mode of operation, no need for special treatment
(can be checked by looking at .d files in the build dir)

Even CI uses arduino-cli ~/.cache/arduino/{sketch,core} for building
Allow sketches without globals.h to share core.a, rebuild otherwise
(same sketch cache is retained, core.a & .o's reused)

Drop manual logging in favour of 'import logging'. Arduino-CLI might still need
tweaks in debug mode, though. Output flushing does not always happen promptly.

Allow multiple entries for the same name, which are then merged.
Allow spaces between @ and the signature words.
Allow to use line right after signature.
Syntax warnings show relevant snippet from globals.h
bump global build options page in the menu hierarchy
share pydoc blob as rst instead, reference on the main page
note that aggressive caching opts are only for IDE 1.x
@mcspr mcspr marked this pull request as ready for review May 28, 2025 20:39
@mcspr
Copy link
Collaborator Author

mcspr commented May 28, 2025

Also, ping @mhightower83

Main difference is .d dependency. Previously it was both CommonHFile.h & build-path/SKETCH globals.h. Now, it is either one or both. Sketches without globals.h should build as usual, no dependency means core.a is cached and no core files are depending on a different sketch build path every other build

globals.h is also included only when build.opt includes it. Direct dependency on the sketch can be created via #include "SKETCH.ino.globals.h", if it is ever necessary
(for our files, it is not. maybe someone actually uses it 🤷)

I kept previous 'aggressive caching' notes for posterity, since I am not sure how arduino-builder / arduino-cli worked (or did not work) before. Could also just remove it, since none of the notes actually apply to the current version of the script

w/ PR - IDE 1.8.19 works fine, so is CLI 1.2.2 (CI runs it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant