Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/src/cross/cross_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ List<String> _sysrootParts(CrossTarget t) => [
/// rpi4 vs rpi5 on the same raspios image) share a single extraction.
String sysrootKey(CrossTarget t) => contentHash([
..._sysrootParts(t),
// Only augments that will actually be staged count toward the key: a
// `requires_define`-gated augment whose gate isn't satisfied (e.g. an
// off-by-default crash handler) is not built, so it must not perturb the
// sysroot identity or invalidate the shared store entry.
for (final a in t.augment)
'aug:${a.pkg}:${a.minVersion}:${a.url}:${a.build.name}:${a.staticLink}',
if (CrossTarget.defineSatisfied(a.requiresDefine, t.defines))
'aug:${a.pkg}:${a.minVersion}:${a.url}:${a.build.name}:${a.staticLink}',
]);

/// Hash of the **shared sysroot base**: [sysrootKey] without the augment set,
Expand Down
29 changes: 29 additions & 0 deletions test/src/cross/cross_keys_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,35 @@ void main() {
expect(sysrootBaseKey(rpi5), matches(RegExp(r'^[0-9a-f]{12}$')));
});

test('a requires_define-gated augment counts only when its gate is on', () {
const sentry = {
'pkg': 'sentry-native',
'min': '0.15.3',
'url': 'https://x/sentry.zip',
'build': 'cmake',
'requires_define': 'BUILD_CRASH_HANDLER',
};
// Gate unsatisfied (no define) → not staged → key unchanged.
final gatedOff = _t(const {
'provider': 'arm-gnu',
'toolchain_version': '12.3.rel1',
'image_url': 'https://example/raspios.img.xz',
'cpu_flags': ['-mcpu=cortex-a76'],
'augment': [sentry],
});
expect(sysrootKey(gatedOff), sysrootKey(rpi5));
// Gate satisfied → staged → key changes.
final gatedOn = _t(const {
'provider': 'arm-gnu',
'toolchain_version': '12.3.rel1',
'image_url': 'https://example/raspios.img.xz',
'cpu_flags': ['-mcpu=cortex-a76'],
'defines': {'BUILD_CRASH_HANDLER': 'ON'},
'augment': [sentry],
});
expect(sysrootKey(gatedOn), isNot(sysrootKey(rpi5)));
});

test('modules change the buildKey but not the sysroot keys', () {
final withModule = _t(const {
'provider': 'arm-gnu',
Expand Down
Loading