refactored cli tool ipa method name to support --export-options-plist (#138555)
This PR changes the way the IPA method is read in the run command for `build ipa` command. If export options plist argument is provided it takes method name from plist, otherwise it uses the method name from export method argument. *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* fixes [#122179](https://github.com/flutter/flutter/issues/122179)
This commit is contained in:
parent
f8b9748661
commit
4659b0c402
@ -463,13 +463,15 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
|
|||||||
final String relativeOutputPath = app.ipaOutputPath;
|
final String relativeOutputPath = app.ipaOutputPath;
|
||||||
final String absoluteOutputPath = globals.fs.path.absolute(relativeOutputPath);
|
final String absoluteOutputPath = globals.fs.path.absolute(relativeOutputPath);
|
||||||
final String absoluteArchivePath = globals.fs.path.absolute(app.archiveBundleOutputPath);
|
final String absoluteArchivePath = globals.fs.path.absolute(app.archiveBundleOutputPath);
|
||||||
final String exportMethod = stringArg('export-method')!;
|
String? exportOptions = exportOptionsPlist;
|
||||||
|
String? exportMethod = exportOptions != null ?
|
||||||
|
globals.plistParser.getValueFromFile<String?>(exportOptions, 'method') : null;
|
||||||
|
exportMethod ??= stringArg('export-method')!;
|
||||||
final bool isAppStoreUpload = exportMethod == 'app-store';
|
final bool isAppStoreUpload = exportMethod == 'app-store';
|
||||||
File? generatedExportPlist;
|
File? generatedExportPlist;
|
||||||
try {
|
try {
|
||||||
final String exportMethodDisplayName = isAppStoreUpload ? 'App Store' : exportMethod;
|
final String exportMethodDisplayName = isAppStoreUpload ? 'App Store' : exportMethod;
|
||||||
status = globals.logger.startProgress('Building $exportMethodDisplayName IPA...');
|
status = globals.logger.startProgress('Building $exportMethodDisplayName IPA...');
|
||||||
String? exportOptions = exportOptionsPlist;
|
|
||||||
if (exportOptions == null) {
|
if (exportOptions == null) {
|
||||||
generatedExportPlist = _createExportPlist();
|
generatedExportPlist = _createExportPlist();
|
||||||
exportOptions = generatedExportPlist.path;
|
exportOptions = generatedExportPlist.path;
|
||||||
|
@ -379,6 +379,75 @@ void main() {
|
|||||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('ipa build reports method from --export-method when used', () 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', 'ad-hoc', '--no-pub']
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(logger.statusText, contains('build/ios/archive/Runner.xcarchive'));
|
||||||
|
expect(logger.statusText, contains('Building ad-hoc IPA'));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => fileSystem,
|
||||||
|
Logger: () => logger,
|
||||||
|
ProcessManager: () => fakeProcessManager,
|
||||||
|
Platform: () => macosPlatform,
|
||||||
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('ipa build reports method from --export-options-plist when used', () async {
|
||||||
|
final File exportOptions = fileSystem.file('/ExportOptions.plist')
|
||||||
|
..createSync();
|
||||||
|
createMinimalMockProjectFiles();
|
||||||
|
|
||||||
|
plistUtils.fileContents[exportOptions.path] = <String,String>{
|
||||||
|
'CFBundleIdentifier': 'io.flutter.someProject',
|
||||||
|
'method': 'enterprise'
|
||||||
|
};
|
||||||
|
|
||||||
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
|
xattrCommand,
|
||||||
|
setUpFakeXcodeBuildHandler(),
|
||||||
|
exportArchiveCommand(exportOptionsPlist: exportOptions.path),
|
||||||
|
]);
|
||||||
|
final BuildCommand command = BuildCommand(
|
||||||
|
artifacts: artifacts,
|
||||||
|
androidSdk: FakeAndroidSdk(),
|
||||||
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
|
logger: logger,
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
processUtils: processUtils,
|
||||||
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
|
);
|
||||||
|
await createTestCommandRunner(command).run(
|
||||||
|
<String>['build', 'ipa', '--export-options-plist', exportOptions.path, '--no-pub']
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(logger.statusText, contains('build/ios/archive/Runner.xcarchive'));
|
||||||
|
expect(logger.statusText, contains('Building enterprise IPA'));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => fileSystem,
|
||||||
|
Logger: () => logger,
|
||||||
|
ProcessManager: () => fakeProcessManager,
|
||||||
|
Platform: () => macosPlatform,
|
||||||
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||||
|
PlistParser: () => plistUtils,
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('ipa build reports when IPA fails', () async {
|
testUsingContext('ipa build reports when IPA fails', () async {
|
||||||
final BuildCommand command = BuildCommand(
|
final BuildCommand command = BuildCommand(
|
||||||
artifacts: artifacts,
|
artifacts: artifacts,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user