Skip to content

Commit 3441743

Browse files
authored
[macos] build: add build-number and buid-name arguments (flutter#53928)
1 parent 35ed1cc commit 3441743

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/flutter_tools/lib/src/commands/build_macos.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class BuildMacosCommand extends BuildSubCommand {
2323
addBuildModeFlags();
2424
addDartObfuscationOption();
2525
usesExtraFrontendOptions();
26+
usesBuildNumberOption();
27+
usesBuildNameOption();
2628
}
2729

2830
@override

packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,34 @@ void main() {
211211
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
212212
});
213213

214+
testUsingContext('macOS build supports build-name and build-number', () async {
215+
final BuildCommand command = BuildCommand();
216+
createMinimalMockProjectFiles();
217+
218+
await createTestCommandRunner(command).run(
219+
const <String>[
220+
'build',
221+
'macos',
222+
'--debug',
223+
'--build-name=1.2.3',
224+
'--build-number=42',
225+
],
226+
);
227+
final String contents = fileSystem
228+
.file('./macos/Flutter/ephemeral/Flutter-Generated.xcconfig')
229+
.readAsStringSync();
230+
231+
expect(contents, contains('FLUTTER_BUILD_NAME=1.2.3'));
232+
expect(contents, contains('FLUTTER_BUILD_NUMBER=42'));
233+
}, overrides: <Type, Generator>{
234+
FileSystem: () => fileSystem,
235+
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
236+
setUpMockXcodeBuildHandler('Debug')
237+
]),
238+
Platform: () => macosPlatform,
239+
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
240+
});
241+
214242
testUsingContext('Refuses to build for macOS when feature is disabled', () {
215243
final CommandRunner<void> runner = createTestCommandRunner(BuildCommand());
216244

0 commit comments

Comments
 (0)