mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
- Added check for dependencies, which can be installed from the builder. - Replaced CosmosTask with CosmosBuildDefinition, which is much simpler. - The builder can be opened without any command line arguments. - If the VS path is not specified as a command line argument, it can be selected in a dialog.
64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
using Cosmos.Build.Builder.Services;
|
|
|
|
namespace Cosmos.Build.Builder.BuildTasks
|
|
{
|
|
internal class CreateSetupTask : ProcessBuildTaskBase
|
|
{
|
|
public override string Name => "Create Setup";
|
|
|
|
private IInnoSetupService _innoSetupService;
|
|
|
|
private string _scriptFilePath;
|
|
|
|
private Dictionary<string, string> _defines;
|
|
|
|
public CreateSetupTask(
|
|
IInnoSetupService innoSetupService,
|
|
string scriptFilePath,
|
|
string configuration,
|
|
string releaseVersion)
|
|
: base(true, false)
|
|
{
|
|
_innoSetupService = innoSetupService;
|
|
|
|
_scriptFilePath = scriptFilePath;
|
|
|
|
_defines = new Dictionary<string, string>();
|
|
|
|
_defines.Add("BuildConfiguration", configuration);
|
|
_defines.Add("ChangeSetVersion", releaseVersion);
|
|
}
|
|
|
|
protected override string GetExePath()
|
|
{
|
|
var innoSetupInstallationPath = _innoSetupService.GetInnoSetupInstallationPath();
|
|
var innoSetupCompilerPath = Path.Combine(innoSetupInstallationPath, "ISCC.exe");
|
|
|
|
if (!File.Exists(innoSetupCompilerPath))
|
|
{
|
|
throw new InvalidOperationException("Inno Setup installation detected, but the compiler doesn't exist!");
|
|
}
|
|
|
|
return innoSetupCompilerPath;
|
|
}
|
|
|
|
protected override string GetArguments()
|
|
{
|
|
var args = $"/Q \"{_scriptFilePath}\"";
|
|
|
|
if (_defines != null)
|
|
{
|
|
foreach (var define in _defines)
|
|
{
|
|
args += $" \"/d{define.Key}={define.Value}\"";
|
|
}
|
|
}
|
|
|
|
return args;
|
|
}
|
|
}
|
|
}
|