Skip to content

Commit 51606f9

Browse files
authored
Fix flutter build ipa --export-method not accepting enterprise flag (#153047)
When implementing the fix for flutter/flutter#149369, I missed accounting for the `enterprise` flag for `flutter build ipa` � Fixes flutter/flutter#153000
1 parent b6cd31e commit 51606f9

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,6 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
599599
return 'release-testing';
600600
case 'development':
601601
return 'debugging';
602-
default:
603-
throwToolExit('Encountered invalid export-method input.');
604602
}
605603
}
606604
return method;

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

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,80 @@ void main() {
554554
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(version: Version(15, 4, null)),
555555
});
556556

557+
testUsingContext('ipa build accepts "enterprise" export method when on Xcode versions <= 15.3', () async {
558+
final BuildCommand command = BuildCommand(
559+
artifacts: artifacts,
560+
androidSdk: FakeAndroidSdk(),
561+
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
562+
logger: logger,
563+
fileSystem: fileSystem,
564+
processUtils: processUtils,
565+
osUtils: FakeOperatingSystemUtils(),
566+
);
567+
fakeProcessManager.addCommands(<FakeCommand>[
568+
xattrCommand,
569+
setUpFakeXcodeBuildHandler(),
570+
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
571+
]);
572+
createMinimalMockProjectFiles();
573+
await createTestCommandRunner(command).run(
574+
const <String>['build', 'ipa','--export-method', 'enterprise', '--no-pub']
575+
);
576+
expect(logger.statusText, contains('Building enterprise IPA'));
577+
}, overrides: <Type, Generator>{
578+
FileSystem: () => fileSystem,
579+
Logger: () => logger,
580+
ProcessManager: () => fakeProcessManager,
581+
Platform: () => macosPlatform,
582+
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(version: Version(15, 3, null)),
583+
});
584+
585+
testUsingContext('ipa build accepts "enterprise" export method when on Xcode versions > 15.3', () async {
586+
final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist');
587+
final BuildCommand command = BuildCommand(
588+
artifacts: artifacts,
589+
androidSdk: FakeAndroidSdk(),
590+
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
591+
logger: logger,
592+
fileSystem: fileSystem,
593+
processUtils: processUtils,
594+
osUtils: FakeOperatingSystemUtils(),
595+
);
596+
fakeProcessManager.addCommands(<FakeCommand>[
597+
xattrCommand,
598+
setUpFakeXcodeBuildHandler(),
599+
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist, cachePlist: cachedExportOptionsPlist),
600+
]);
601+
createMinimalMockProjectFiles();
602+
await createTestCommandRunner(command).run(
603+
const <String>['build', 'ipa','--export-method', 'enterprise', '--no-pub']
604+
);
605+
606+
const String expectedIpaPlistContents = '''
607+
<?xml version="1.0" encoding="UTF-8"?>
608+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
609+
<plist version="1.0">
610+
<dict>
611+
<key>method</key>
612+
<string>enterprise</string>
613+
<key>uploadBitcode</key>
614+
<false/>
615+
</dict>
616+
</plist>
617+
''';
618+
619+
final String actualIpaPlistContents = fileSystem.file(cachedExportOptionsPlist).readAsStringSync();
620+
621+
expect(actualIpaPlistContents, expectedIpaPlistContents);
622+
expect(logger.statusText, contains('Building enterprise IPA'));
623+
}, overrides: <Type, Generator>{
624+
FileSystem: () => fileSystem,
625+
Logger: () => logger,
626+
ProcessManager: () => fakeProcessManager,
627+
Platform: () => macosPlatform,
628+
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(version: Version(15, 4, null)),
629+
});
630+
557631
testUsingContext('ipa build accepts legacy methods when on Xcode versions <= 15.3', () async {
558632
final BuildCommand command = BuildCommand(
559633
artifacts: artifacts,

0 commit comments

Comments
 (0)