toCommands static method
Implementation
static List<ReleasePackerCommand>? toCommands(
{String? sourcePath,
String? dartCompileExe,
String? dartCompileKernel,
String? windowsGUI,
List? jsonList}) {
var commands = <ReleasePackerCommand>[];
if (dartCompileExe != null) {
commands.add(ReleasePackerDartCompileExe(dartCompileExe));
}
if (dartCompileKernel != null) {
commands.add(ReleasePackerDartCompileKernel(dartCompileKernel));
}
if (windowsGUI != null) {
String? inputFile;
String? outputFile;
if (dartCompileExe != null) {
if (dartCompileExe != windowsGUI) {
inputFile = dartCompileExe;
outputFile = windowsGUI;
} else {
inputFile = dartCompileExe;
outputFile = sourcePath ?? windowsGUI;
}
} else if (sourcePath != null) {
if (sourcePath != windowsGUI) {
inputFile = windowsGUI;
outputFile = sourcePath;
} else {
inputFile = sourcePath;
outputFile = windowsGUI;
}
} else {
inputFile = outputFile = windowsGUI;
}
commands.add(
ReleasePackerWindowsSubsystemCommand(true, inputFile, outputFile));
}
if (jsonList != null) {
for (var e in jsonList) {
var cmd = ReleasePackerCommand.from(e);
if (cmd != null) {
commands.add(cmd);
}
}
}
return commands.isNotEmpty ? commands : null;
}