Skip to content
Open
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
4 changes: 4 additions & 0 deletions packages/flutter_tools/lib/src/shorebird/shorebird_yaml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@ Map<String, dynamic> compileShorebirdYaml(YamlMap yamlMap, {required String? fla
if (shorebirdPublicKeyEnvVar != null) {
compiled['patch_public_key'] = shorebirdPublicKeyEnvVar;
}
final String? moduleVersion = environment['SHOREBIRD_MODULE_VERSION'];
if (moduleVersion != null) {
compiled['module_version'] = moduleVersion;
}
return compiled;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ patch_verification: strict
'patch_public_key': '4-a',
});
});
test('module_version from environment', () {
const String yamlContents = '''
app_id: 1-a
''';
final YamlDocument input = loadYamlDocument(yamlContents);
final YamlMap yamlMap = input.contents as YamlMap;

// Without env var, module_version is absent.
final Map<String, dynamic> withoutEnv =
compileShorebirdYaml(yamlMap, flavor: null, environment: <String, String>{});
expect(withoutEnv.containsKey('module_version'), isFalse);

// With env var, module_version is included.
final Map<String, dynamic> withEnv =
compileShorebirdYaml(yamlMap, flavor: null, environment: <String, String>{
'SHOREBIRD_MODULE_VERSION': 'abc1234',
});
expect(withEnv['module_version'], 'abc1234');
});
test('edit in place', () {
const String yamlContents = '''
app_id: 1-a
Expand Down
Loading