Generate version file

This commit is contained in:
Daniel Plaisted 2018-11-20 10:17:29 -08:00
parent c3e38959d8
commit 7b76c6dd89
2 changed files with 40 additions and 0 deletions

View file

@ -212,10 +212,17 @@
ReplacementStrings="$(ReplacementString)" /> ReplacementStrings="$(ReplacementString)" />
</Target> </Target>
<Target Name="GenerateVersionFile" DependsOnTargets="SetupBundledComponents;GetCoreSdkGitCommitInfo">
<WriteLinesToFile File="$(SdkOutputDirectory).version"
Lines="$(GitCommitHash);$(SdkVersion);$(Rid)"
Overwrite="true" />
</Target>
<Target Name="GenerateLayout" <Target Name="GenerateLayout"
DependsOnTargets="DownloadBundledComponents; DependsOnTargets="DownloadBundledComponents;
CleanLayoutPath; CleanLayoutPath;
ExtractBundledComponents; ExtractBundledComponents;
GenerateVersionFile;
GenerateBundledVersions; GenerateBundledVersions;
LayoutTemplates; LayoutTemplates;
LayoutBundledTools; LayoutBundledTools;

View file

@ -0,0 +1,33 @@
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace EndToEnd.Tests
{
public class VersionTests : TestBase
{
[Fact]
public void DotnetVersionReturnsCorrectVersion()
{
var result = new DotnetCommand()
.ExecuteWithCapturedOutput("--version");
result.Should().Pass();
var dotnetFolder = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
var sdkFolders = Directory.GetDirectories(Path.Combine(dotnetFolder, "sdk"));
sdkFolders.Length.Should().Be(1, "Only one SDK folder is expected in the layout");
var expectedSdkVersion = Path.GetFileName(sdkFolders.Single());
result.StdOut.Trim().Should().Be(expectedSdkVersion);
}
}
}