diff --git a/lib/oto/commands/build/build_ios.dart b/lib/oto/commands/build/build_ios.dart index 05acb10..90c9712 100644 --- a/lib/oto/commands/build/build_ios.dart +++ b/lib/oto/commands/build/build_ios.dart @@ -516,13 +516,26 @@ class ArchiveiOS extends Command { @override Future execute(DataCommand command) async { var data = DataArchiveiOS.fromJson(getParam(command)); - var workspacePath = Command.getPathNormal(data.xcworkspaceFilePath); + var xcodeProjectPath = + data.xcworkspaceFilePath ?? data.xcodeProjectFilePath; + if (xcodeProjectPath == null) { + throw Exception( + '"xcodeProjectFilePath" or "xcworkspaceFilePath" must set at least one.'); + } + var projectPath = Command.getPathNormal(xcodeProjectPath); var archivePath = Command.getPathNormal(data.archivePath); var destination = data.destination ?? "'generic/platform=iOS'"; + var project = ''; + if (data.xcworkspaceFilePath != null) { + project = '-workspace $projectPath'; + } else { + project = '-project $projectPath'; + } + var shell = StringBuffer(); shell.write( - 'xcodebuild -workspace $workspacePath -scheme ${data.scheme} -destination $destination -archivePath $archivePath archive'); + 'xcodebuild $project -scheme ${data.scheme} -destination $destination -archivePath $archivePath archive'); var process = await ProcessExecutor.start(shell, workspace: workspace, diff --git a/lib/oto/data/command_data.dart b/lib/oto/data/command_data.dart index c577f64..ccb5ff9 100644 --- a/lib/oto/data/command_data.dart +++ b/lib/oto/data/command_data.dart @@ -310,7 +310,8 @@ class DataNotarize extends DataParam { class DataArchiveiOS extends DataParam { DataArchiveiOS(); - late String xcworkspaceFilePath; + late String? xcworkspaceFilePath; + late String? xcodeProjectFilePath; late String scheme; late String archivePath; late String? destination; diff --git a/lib/oto/data/command_data.g.dart b/lib/oto/data/command_data.g.dart index cd1fbf2..a9de1e6 100644 --- a/lib/oto/data/command_data.g.dart +++ b/lib/oto/data/command_data.g.dart @@ -563,7 +563,8 @@ DataArchiveiOS _$DataArchiveiOSFromJson(Map json) => ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..showPrint = json['showPrint'] as bool? - ..xcworkspaceFilePath = json['xcworkspaceFilePath'] as String + ..xcworkspaceFilePath = json['xcworkspaceFilePath'] as String? + ..xcodeProjectFilePath = json['xcodeProjectFilePath'] as String? ..scheme = json['scheme'] as String ..archivePath = json['archivePath'] as String ..destination = json['destination'] as String?; @@ -576,6 +577,7 @@ Map _$DataArchiveiOSToJson(DataArchiveiOS instance) => 'setExitCode': instance.setExitCode, 'showPrint': instance.showPrint, 'xcworkspaceFilePath': instance.xcworkspaceFilePath, + 'xcodeProjectFilePath': instance.xcodeProjectFilePath, 'scheme': instance.scheme, 'archivePath': instance.archivePath, 'destination': instance.destination,