run method

  1. @override
void run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
void run() {
  CucumberHelper.removeNdjsonGherkin();
  MelosHelper.format();
  final argTarget = argResults.getOptionTarget();
  final argFlavor = argResults.getOptionFlavor(defaultTo: Constants.prod);
  final argGitsYaml = argResults.getOptionGitsYaml();
  final argExportMethod = argResults.getOptionExportMethod();
  final argExportOptionsPlist = argResults.getOptionExportOptionsPlist();
  final argBuildNumber = argResults.getOptionBuildNumber();
  final argBuildName = argResults.getOptionBuildName();
  final argObfuscate = argResults.getFlagObfuscate();
  final argSplitDebugInfo = argResults.getOptionSplitDebugInfo();
  final argQa = argResults.getFlagQa();

  YamlHelper.validateGitsYaml(argGitsYaml);

  'gits_cli l10n --gits-yaml "$argGitsYaml"'.run;

  final flavor = FlavorHelper.byFlavor(argFlavor, argGitsYaml);

  FirebaseHelper.run(argFlavor, argGitsYaml);

  List<String> dartDefines = [];
  flavor.forEach((key, value) {
    dartDefines.add('${Constants.dartDefine} "$key=$value"');
  });
  final mode = argResults.getMode();
  if (argQa) {
    FlutterHelper.run(
      'build ipa -t "lib/main_driver.dart" ${dartDefines.join(' ')} --profile $argExportMethod $argExportOptionsPlist $argBuildNumber $argBuildName $argObfuscate $argSplitDebugInfo',
      showLog: true,
    );
  } else {
    FlutterHelper.run(
      'build ipa -t $argTarget ${dartDefines.join(' ')} $mode $argExportMethod $argExportOptionsPlist $argBuildNumber $argBuildName $argObfuscate $argSplitDebugInfo',
      showLog: true,
    );
  }

  StatusHelper.success('build ipa');
}