oto/lib/oto/commands/build/build_ios_archive.dart
toki ac1c42448e refactor: split build_ios and git commands, add cli styling, improve pipeline system
- Split BuildIOS command into build_ios_archive and build_ios_build
- Split Git command into git_branch, git_remote, git_revision, git_stash
- Add cli_style.dart and printer.dart for consistent CLI output
- Add macos_signing.dart for macOS/iOS code signing
- Refactor pipeline system (pipeline, pipeline_condition, pipeline_contain, etc.)
- Update tag_system, defined_data, pipeline_data
- Update application and command files for new structure
- Add tests for new command catalog and core functionality
- Update README with new features
2026-05-20 20:50:59 +09:00

66 lines
2.1 KiB
Dart

import 'dart:async';
import 'package:dart_framework/platform/process.dart';
import 'package:oto/oto/application.dart';
import 'package:oto/oto/commands/command.dart';
import 'package:oto/oto/data/command_data.dart';
class ArchiveiOS extends Command {
Function? get error => null;
@override
Future execute(DataCommand command) async {
var data = DataArchiveiOS.fromJson(getParam(command));
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 $project -scheme ${data.scheme} -destination $destination -archivePath $archivePath archive');
var process = await ProcessExecutor.start(shell,
workspace: workspace,
printStderr: false,
logHandler: Application.logWithType);
return await completeProcess(process, command);
}
}
class ExportiOS extends Command {
Function? get error => null;
@override
Future execute(DataCommand command) async {
var data = DataExportiOS.fromJson(getParam(command));
var archivePath = Command.getPathNormal(data.archivePath);
var exportPath = Command.getPathNormal(data.exportPath);
var exportOptionPlistPath =
Command.getPathNormal(data.exportOptionPlistPath);
var shell = StringBuffer();
shell.write(
'xcodebuild -exportArchive -archivePath $archivePath -exportPath $exportPath -exportOptionsPlist $exportOptionPlistPath');
var process = await ProcessExecutor.start(shell,
workspace: workspace,
printStderr: false,
logHandler: Application.logWithType);
return await completeProcess(process, command);
}
}