Pass the correct version suffix in the build scripts
This commit is contained in:
parent
8c902a1954
commit
566a76e5d3
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 buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
||||
var srcDir = Path.Combine(c.BuildContext.BuildDirectory, "src");
|
||||
outputDir = Path.Combine(outputDir, "sdk", buildVersion.NuGetVersion);
|
||||
|
||||
FS.CleanBinObj(c, srcDir);
|
||||
Rmdir(outputDir);
|
||||
Mkdirp(outputDir);
|
||||
|
||||
|
@ -621,12 +623,10 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
{
|
||||
dotnet.Publish(
|
||||
"--native-subdirectory",
|
||||
"--output",
|
||||
outputDir,
|
||||
"--configuration",
|
||||
configuration,
|
||||
Path.Combine(c.BuildContext.BuildDirectory, "src", project))
|
||||
.Environment("DOTNET_BUILD_VERSION", buildVersion.VersionSuffix)
|
||||
"--output", outputDir,
|
||||
"--configuration", configuration,
|
||||
"--version-suffix", buildVersion.CommitCountString,
|
||||
Path.Combine(srcDir, project))
|
||||
.Execute()
|
||||
.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