Skip to content

Commit

Permalink
Fix flutter build ipa --export-method not accepting enterprise fl…
Browse files Browse the repository at this point in the history
…ag (flutter#153047)

When implementing the fix for flutter#149369, I missed accounting for the `enterprise` flag for `flutter build ipa` �

Fixes flutter#153000
  • Loading branch information
LouiseHsu committed Aug 8, 2024
1 parent b6cd31e commit 51606f9
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/flutter_tools/lib/src/commands/build_ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,6 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
return 'release-testing';
case 'development':
return 'debugging';
default:
throwToolExit('Encountered invalid export-method input.');
}
}
return method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,80 @@ void main() {
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(version: Version(15, 4, null)),
});

testUsingContext('ipa build accepts "enterprise" export method when on Xcode versions <= 15.3', () async {
final BuildCommand command = BuildCommand(
artifacts: artifacts,
androidSdk: FakeAndroidSdk(),
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
logger: logger,
fileSystem: fileSystem,
processUtils: processUtils,
osUtils: FakeOperatingSystemUtils(),
);
fakeProcessManager.addCommands(<FakeCommand>[
xattrCommand,
setUpFakeXcodeBuildHandler(),
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
]);
createMinimalMockProjectFiles();
await createTestCommandRunner(command).run(
const <String>['build', 'ipa','--export-method', 'enterprise', '--no-pub']
);
expect(logger.statusText, contains('Building enterprise IPA'));
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
Logger: () => logger,
ProcessManager: () => fakeProcessManager,
Platform: () => macosPlatform,
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(version: Version(15, 3, null)),
});

testUsingContext('ipa build accepts "enterprise" export method when on Xcode versions > 15.3', () async {
final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist');
final BuildCommand command = BuildCommand(
artifacts: artifacts,
androidSdk: FakeAndroidSdk(),
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
logger: logger,
fileSystem: fileSystem,
processUtils: processUtils,
osUtils: FakeOperatingSystemUtils(),
);
fakeProcessManager.addCommands(<FakeCommand>[
xattrCommand,
setUpFakeXcodeBuildHandler(),
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist, cachePlist: cachedExportOptionsPlist),
]);
createMinimalMockProjectFiles();
await createTestCommandRunner(command).run(
const <String>['build', 'ipa','--export-method', 'enterprise', '--no-pub']
);

const String expectedIpaPlistContents = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>enterprise</string>
<key>uploadBitcode</key>
<false/>
</dict>
</plist>
''';

final String actualIpaPlistContents = fileSystem.file(cachedExportOptionsPlist).readAsStringSync();

expect(actualIpaPlistContents, expectedIpaPlistContents);
expect(logger.statusText, contains('Building enterprise IPA'));
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
Logger: () => logger,
ProcessManager: () => fakeProcessManager,
Platform: () => macosPlatform,
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(version: Version(15, 4, null)),
});

testUsingContext('ipa build accepts legacy methods when on Xcode versions <= 15.3', () async {
final BuildCommand command = BuildCommand(
artifacts: artifacts,
Expand Down

0 comments on commit 51606f9

Please sign in to comment.