build method

Future<Directory> build()

Builds the installer using Inno Setup and returns the directory containing the output files.

Skips the build process if config.installer is false. Throws a ProcessException if the Inno Setup process fails.

Implementation

Future<Directory> build() async {
  if (!config.installer) {
    CliLogger.info("Skipping installer...");
    return Directory("");
  }

  final execFile = _getInnoSetupExec();
  var params = [scriptFile.path];
  if (config.signTool != null && config.signTool!.command.isNotEmpty) {
    params.add('/S${config.signTool!.name}=${config.signTool!.command}');
  }

  final process = await Process.start(
    execFile.path,
    params,
    runInShell: true,
    workingDirectory: Directory.current.path,
    mode: ProcessStartMode.inheritStdio,
  );
  final exitCode = await process.exitCode;
  if (exitCode != 0) exit(exitCode);
  return Directory.current;
}