build method
Implementation
@override
Future build(String root) async {
final supportLdClassic = JSON(argResults?['supportLdClassic']).boolValue;
logger.log('supportLdClassic: $supportLdClassic');
/// 是否要去掉ld_classic
if (!supportLdClassic) {
final projectPath = join(
environment.workspace, 'ios', 'Runner.xcodeproj', 'project.pbxproj');
var contents = await File(projectPath).readAsString();
contents = contents.replaceAll('''
OTHER_LDFLAGS = (
"\$(inherited)",
"-ld_classic",
);
''', '''
OTHER_LDFLAGS = (
"\$(inherited)",
);
''');
if (contents.contains('ld_classic')) {
logger.log('去掉ld_classic失败!', status: LogStatus.error);
exit(2);
}
await File(projectPath).writeAsString(contents);
logger.log('已经去掉ld_classic', status: LogStatus.success);
}
if (dartDefineArgs
.any((element) => element == '--dart-define=isStoreVersion=true')) {
await RemoveIosSettingBundle(root: root).remove();
logger.log('移出Setting.bundle 成功!');
}
await SetVersionBuildNumber(environment: environment).runInIos();
await Shell(workingDirectory: environment.iosDir)
.run('pod install --verbose');
await Shell(workingDirectory: environment.iosDir).run(
'xcrun xcodebuild -configuration Release -workspace Runner.xcworkspace -scheme Runner -sdk iphoneos -destination generic/platform=iOS -archivePath ../build/ios/archive/Runner archive');
await Shell(workingDirectory: environment.iosDir).run(
'xcrun xcodebuild -exportArchive -archivePath ../build/ios/archive/Runner.xcarchive -exportPath ../build/ios/ipa -exportOptionsPlist exportOptions.plist');
// await BuildApp(
// platform: BuildPlatform.ios,
// root: root,
// buildName: environment.buildName,
// buildNumber: environment.buildNumber,
// ).build();
}