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() async {
  CucumberHelper.removeNdjsonGherkin();
  final argTarget = argResults.getOptionTarget();
  final argFlavor = argResults.getOptionFlavor(defaultTo: Constants.dev);
  final argMorphemeYaml = argResults.getOptionMorphemeYaml();
  final argBuildNumber = argResults.getOptionBuildNumber();
  final argBuildName = argResults.getOptionBuildName();
  final argGenerateL10n = argResults.getFlagGenerateL10n();
  final argBaseHref = argResults.getOptionBaseHref();
  final argPwaStrategy = argResults.getOptionPwaStrategy();
  final argWebRenderer = argResults.getOptionWebRenderer();
  final argWebResourcesCdn = argResults.getFlagWebResourcesCdn();
  final argCsp = argResults.getFlagCsp();
  final argSourcesMap = argResults.getFlagSourceMaps();
  final argDart2JsOptimization = argResults.getOptionDart2JsOptimization();
  final argDumpInfo = argResults.getFlagDumpInfo();
  final argFrequencyBasedMinification =
      argResults.getFlagFrequencyBasedMinification();

  YamlHelper.validateMorphemeYaml(argMorphemeYaml);

  if (argGenerateL10n) {
    await 'morpheme l10n --morpheme-yaml "$argMorphemeYaml"'.run;
  }

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

  FirebaseHelper.run(argFlavor, argMorphemeYaml);

  List<String> dartDefines = [];
  flavor.forEach((key, value) {
    dartDefines.add('${Constants.dartDefine} "$key=$value"');
  });
  final mode = argResults.getMode();

  await FlutterHelper.run(
    'build web -t $argTarget ${dartDefines.join(' ')} $mode $argBuildNumber $argBuildName $argBaseHref $argPwaStrategy $argWebRenderer $argWebResourcesCdn $argCsp $argSourcesMap $argDart2JsOptimization $argDumpInfo $argFrequencyBasedMinification',
    showLog: true,
  );

  StatusHelper.success('build web');
}