Merge pull request #2941 from Sridhar-MS/version-suffix
Pass the correct version suffix in the build scripts
This commit is contained in:
commit
e53acd9bba
2 changed files with 36 additions and 6 deletions
|
@ -612,8 +612,10 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||||
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
||||||
|
var srcDir = Path.Combine(c.BuildContext.BuildDirectory, "src");
|
||||||
outputDir = Path.Combine(outputDir, "sdk", buildVersion.NuGetVersion);
|
outputDir = Path.Combine(outputDir, "sdk", buildVersion.NuGetVersion);
|
||||||
|
|
||||||
|
FS.CleanBinObj(c, srcDir);
|
||||||
Rmdir(outputDir);
|
Rmdir(outputDir);
|
||||||
Mkdirp(outputDir);
|
Mkdirp(outputDir);
|
||||||
|
|
||||||
|
@ -621,12 +623,10 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
dotnet.Publish(
|
dotnet.Publish(
|
||||||
"--native-subdirectory",
|
"--native-subdirectory",
|
||||||
"--output",
|
"--output", outputDir,
|
||||||
outputDir,
|
"--configuration", configuration,
|
||||||
"--configuration",
|
"--version-suffix", buildVersion.CommitCountString,
|
||||||
configuration,
|
Path.Combine(srcDir, project))
|
||||||
Path.Combine(c.BuildContext.BuildDirectory, "src", project))
|
|
||||||
.Environment("DOTNET_BUILD_VERSION", buildVersion.VersionSuffix)
|
|
||||||
.Execute()
|
.Execute()
|
||||||
.EnsureSuccessful();
|
.EnsureSuccessful();
|
||||||
}
|
}
|
||||||
|
|
30
test/dotnet.Tests/VersionTest.cs
Normal file
30
test/dotnet.Tests/VersionTest.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
|
using Microsoft.DotNet.Cli;
|
||||||
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
|
using Xunit;
|
||||||
|
using FluentAssertions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tests
|
||||||
|
{
|
||||||
|
public class GivenDotnetSdk : TestBase
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void VersionCommandDisplaysCorrectVersion()
|
||||||
|
{
|
||||||
|
CommandResult result = new DotnetCommand()
|
||||||
|
.ExecuteWithCapturedOutput("--version");
|
||||||
|
|
||||||
|
result.Should().Pass();
|
||||||
|
Regex.IsMatch(result.StdOut.Trim(), @"[0-9]{1}\.[0-9]{1}\.[0-9]{1}-[a-zA-Z0-9]+-[0-9]{6}$").Should()
|
||||||
|
.BeTrue($"Unexpected dotnet sdk version - {result.StdOut}");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue