make method

  1. @override
Future<MakeResult> make(
  1. Directory appDirectory,
  2. {required Directory outputDirectory,
  3. Map<String, dynamic>? makeArguments,
  4. void onProcessStdOut(
    1. List<int> data
    )?,
  5. void onProcessStdErr(
    1. List<int> data
    )?}
)

Implementation

@override
Future<MakeResult> make(
  Directory appDirectory, {
  required Directory outputDirectory,
  Map<String, dynamic>? makeArguments,
  void Function(List<int> data)? onProcessStdOut,
  void Function(List<int> data)? onProcessStdErr,
}) async {
  MakeMsixConfig makeConfig = (await loadMakeConfig(
    outputDirectory,
    makeArguments,
  ) as MakeMsixConfig);

  makeConfig.output_path = makeConfig.outputFile.parent.path;
  makeConfig.output_name =
      p.basenameWithoutExtension(makeConfig.outputFile.path);
  makeConfig.build_windows = 'false';

  Map<String, dynamic> makeConfigJson = makeConfig.toJson();
  List<String> arguments = [];
  for (String key in makeConfigJson.keys) {
    dynamic value = makeConfigJson[key];
    String newKey = key.replaceAll('_', '-');
    if (newKey == 'msix-version') newKey = 'version';

    if (value is Map) {
      for (String subKey in value.keys) {
        arguments.addAll(['--$newKey', '$subKey=${value[subKey]}']);
      }
    } else {
      arguments.addAll(['--$newKey', value]);
    }
  }
  await Msix(arguments).create();
  return MakeResult(makeConfig);
}