Replies: 1 comment 1 reply
-
|
Profiles live inside each sketch’s sketch.yaml because we follow the Arduino CLI sketch-project spec; That keeps a sketch self-contained and lets the same profile work even if the project is copied outside VS Code or shared with someone running pure arduino-cli. The build products contain absolute include paths and hashes produced by Arduino CLI; reusing them across sketches or after changing the toolchain is unsafe. Instead I rely on the CLI’s own global caches (cores/libraries under the CLI data directory) for reuse, so you’re not recompiling everything from scratch even though each sketch has its own build tree. The reproducibility story is the YAML: the profile records the FQBN plus the platform/library versions you pin in the Profiles Manager. Re-running arduino-cli compile --profile with that file rebuilds the binary from source. Keeping old binaries around without the corresponding toolchain doesn’t help once the underlying Arduino platform is upgraded, which is why I prefer to regenerate from the captured config rather than treat build/ as an archive. If you want a profile available in another sketch today, copy the relevant section of sketch.yaml (or the whole file) into the other project; the format is identical to what the CLI expects. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Correct me if I've missed something, but it seems that profiles,
./.vscodeconfigs, and build products (core,libraries, etc.) are currently stored per sketch.Specifically, the profiles are entirely within the
sketch.yaml, and the entire environment is compiled into the./builddirectory:./buildcontains the build products for a complete compilation of the entirecore, andlibrariesused by the profile. They are not shared, but are recreated for each sketch.I would have thought that profiles would/could be global or, at least, optionally shared among "sketches" and would have expected that, if build products are to be kept, they'd also be shared among projects that use identical build configurations.
Also, keeping the build products like this seems like it's giving you "reproducible builds" but, given the fact that the Arduino upgrade process destroys the previous release's entire source code tree, your "reproducible build" becomes an orphan and cannot be rebuilt without tediously re-installing the exact version with which it was built. To make them actually "reproducible", you'd have to snapshot the source tree as well, or override Arduino's default behaviour when upgrading.
I understand the issues vis-à-vis reproducible builds, compiler switches, etc. but snapshotting the source tree (with a SHA, or with the
gitSHA if available), then appending the SHA of the complete config to the profile name i.e.build_profile-<profile name>-<SOURCE-TREE-SHA>-<CONFIG-SHA>handles that issue. This assumes that any issues that impede making a shareable SHA from the config e.g. embedded project paths or other unique-but-not-really-different info, in the config are rectified.As for
libraries, just symlink the ones used in the tagged build dir, adding and/or building as needed.This would also go a long way to making "Convert Project" work (or exist, rather) since it'd be a matter of just hooking up already built profiles, libraries etc. rather than having to create the whole environment from scratch.
Beta Was this translation helpful? Give feedback.
All reactions