fix(cross): exclude gated-off augments from the sysroot key#112
Merged
Conversation
sysrootKey hashed every declared augment, but the build only stages augments whose requires_define gate is satisfied. So a gated-off augment (e.g. an off-by-default crash handler declared in .emb/base.emb.yaml) changed the sysroot_key and build_key for every target -- invalidating the shared store entry and drifting emb.lock -- even though nothing extra was built. Count an augment toward sysrootKey only when its gate is satisfied by the target's effective defines, matching what actually stages into the sysroot. A plain build's key is then unchanged by a dormant augment; enabling the feature (--define ...=ON) yields a distinct key, as it should. Signed-off-by: Joel Winarske <joel.winarske@linux.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sysrootKeyhashed every declaredaugment, but a build only stages augments whoserequires_definegate is satisfied (added in #110). So a gated-off augment — e.g. an off-by-default crash handler declared once in a shared.emb/base.emb.yaml(#111 makes it inheritable) — changed thesysroot_keyandbuild_keyfor every target, invalidating the shared store entry and driftingemb.lock, even though nothing extra was built.Fix
Count an augment toward
sysrootKeyonly when its gate is satisfied by the target's effective defines — matching what actually stages into the sysroot. A plain build's key is unchanged by a dormant augment; enabling the feature (--define …=ON) yields a distinct key, as it should (the sysroot genuinely differs).Test
cross_keys_test.dart: arequires_define-gated augment leavessysrootKeyequal to the no-augment key when its define is absent, and changes it when the define is on.