build method

  1. @override
Future build(
  1. String root
)
override

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 BuildApp(
    platform: BuildPlatform.ios,
    root: root,
    buildName: environment.buildName,
    buildNumber: environment.buildNumber,
  ).build();
}