diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index 7de75544f..72a830da7 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -5,12 +5,13 @@ + - + @@ -20,6 +21,11 @@ + $(RepoRoot)/.dotnet_stage0/Windows/$(Architecture) + $(RepoRoot)/.dotnet_stage0/Darwin + $(RepoRoot)/.dotnet_stage0/Linux + $(Stage0Path) + $(RepoRoot)/artifacts/$(Rid) $(BaseOutputDirectory)/stage2 $(BaseOutputDirectory)/stage2compilation @@ -95,4 +101,12 @@ + + + + + + + + diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs new file mode 100644 index 000000000..d3d8581b7 --- /dev/null +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -0,0 +1,85 @@ +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Microsoft.DotNet.Cli.Build +{ + public abstract class DotNetTool : ToolTask + { + private const string ExeName = "dotnet.exe"; + + public DotNetTool() + { + } + + protected abstract string Command { get; } + + protected abstract string Args { get; } + + public string WorkingDirectory { get; set; } + + protected override string ToolName + { + get { return ExeName; } + } + + protected override MessageImportance StandardOutputLoggingImportance + { + get { return MessageImportance.High; } // or else the output doesn't get logged by default + } + + protected override string GenerateFullPathToTool() + { + string path = ToolPath; + + // if ToolPath was not provided by the MSBuild script + if (string.IsNullOrEmpty(path)) + { + Log.LogError($"Could not find the Path to {ExeName}"); + + return string.Empty; + } + + return path; + } + + protected override string GetWorkingDirectory() + { + return WorkingDirectory ?? base.GetWorkingDirectory(); + } + + protected override string GenerateCommandLineCommands() + { + return $"{Command} {Args}"; + } + + protected override void LogToolCommand(string message) + { + base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); + } + } + + public class DotNetRestore : DotNetTool + { + protected override string Command + { + get { return "restore"; } + } + + protected override string Args + { + get { return $"{GetVerbosity()}"; } + } + + public string Verbosity { get; set; } + + private string GetVerbosity() + { + if (!string.IsNullOrEmpty(Verbosity)) + { + return $"--verbosity {Verbosity}"; + } + + return null; + } + } +} diff --git a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs b/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs index 1328998aa..2be4c2a5c 100644 --- a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs +++ b/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs @@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Cli.Build public string CommitHash { get; set; } [Output] - public int CommitCount { get; set; } + public string CommitCount { get; set; } [Output] public string ReleaseSuffix { get; set; } @@ -68,7 +68,7 @@ namespace Microsoft.DotNet.Cli.Build VersionMinor = buildVersion.Minor; VersionPatch = buildVersion.Patch; CommitHash = commitHash; - CommitCount = commitCount; + CommitCount = buildVersion.CommitCountString; ReleaseSuffix = buildVersion.ReleaseSuffix; VersionSuffix = buildVersion.VersionSuffix; SimpleVersion = buildVersion.SimpleVersion;