mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +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.
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using Cosmos.Build.Builder.Services;
|
|
|
|
namespace Cosmos.Build.Builder.BuildTasks
|
|
{
|
|
internal abstract class MSBuildTargetBuildTaskBase : ProcessBuildTaskBase
|
|
{
|
|
public abstract string ProjectFilePath { get; }
|
|
public abstract IEnumerable<string> Targets { get; }
|
|
|
|
protected abstract IReadOnlyDictionary<string, string> Properties { get; }
|
|
|
|
private IMSBuildService _msBuildService;
|
|
|
|
protected MSBuildTargetBuildTaskBase(IMSBuildService msBuildService)
|
|
: base(true, false)
|
|
{
|
|
_msBuildService = msBuildService;
|
|
}
|
|
|
|
protected override string GetExePath() => _msBuildService.GetMSBuildExePath();
|
|
|
|
protected override string GetArguments()
|
|
{
|
|
if (ProjectFilePath == null)
|
|
{
|
|
throw new InvalidOperationException("ProjectFilePath is null!");
|
|
}
|
|
|
|
var args = $"\"{ProjectFilePath}\" /nologo /maxcpucount /nodeReuse:False /verbosity:minimal /t:\"{String.Join(";", Targets)}\"";
|
|
|
|
if (Properties != null)
|
|
{
|
|
foreach (var property in Properties)
|
|
{
|
|
args += $" /p:\"{property.Key}={property.Value}\"";
|
|
}
|
|
}
|
|
|
|
args += " /p:DeployExtension=False";
|
|
|
|
return args;
|
|
}
|
|
}
|
|
}
|