This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
183 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,6 @@ cmake/ | |
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Layout" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<UsingTask TaskName="Rid" AssemblyFile="$(CLIBuildDll)" /> | ||
<UsingTask TaskName="Architecture" AssemblyFile="$(CLIBuildDll)" /> | ||
<UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" /> | ||
|
||
<Target Name="Init" > | ||
<!-- Current Runtime Information --> | ||
<Rid> | ||
<Output TaskParameter="OutputRid" PropertyName="Rid" /> | ||
</Rid> | ||
<Architecture> | ||
<Output TaskParameter="OutputArchitecture" PropertyName="Architecture" /> | ||
</Architecture> | ||
|
||
<!-- Common Properties --> | ||
<PropertyGroup> | ||
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory> | ||
<OutputDirectory>$(BaseOutputDirectory)/stage2</OutputDirectory> | ||
<Stage2CompilationDirectory>$(BaseOutputDirectory)/stage2compilation</Stage2CompilationDirectory> | ||
<IntermediateDirectory>$(BaseOutputDirectory)/intermediate</IntermediateDirectory> | ||
</PropertyGroup> | ||
|
||
<!-- Generates BuildVersion Item | ||
BuildVersion Metadata: | ||
- Major | ||
- Minor | ||
- Patch | ||
- ReleaseSuffix | ||
- CommitHash | ||
- CommitCount | ||
- VersionSuffix | ||
- SimpleVersion | ||
- NugetVersion | ||
- MsiVersion --> | ||
<GenerateBuildVersionInfo RepoRoot="$(RepoRoot)"> | ||
<Output TaskParameter="OutputBuildVersionInfo" | ||
ItemName="BuildVersion" /> | ||
</GenerateBuildVersionInfo> | ||
|
||
<PropertyGroup> | ||
<SdkVersion>@(BuildVersion ->'%(NugetVersion)')</SdkVersion> | ||
<SdkBrandName>Microsoft .NET Core 1.0.0 - SDK Preview 2</SdkBrandName> | ||
</PropertyGroup> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Runtime.InteropServices; | ||
using System.Net.Http; | ||
using Microsoft.Build.Utilities; | ||
using Microsoft.DotNet.Cli.Build.Framework; | ||
using Microsoft.DotNet.InternalAbstractions; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; | ||
|
||
namespace Microsoft.DotNet.Cli.Build | ||
{ | ||
public class Architecture : Task | ||
{ | ||
[Output] | ||
public string OutputArchitecture { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
OutputArchitecture = RuntimeEnvironment.RuntimeArchitecture; | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Runtime.InteropServices; | ||
using System.Net.Http; | ||
using Microsoft.Build.Utilities; | ||
using Microsoft.DotNet.Cli.Build.Framework; | ||
using Microsoft.DotNet.InternalAbstractions; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
using System.Security.Cryptography; | ||
|
||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; | ||
|
||
namespace Microsoft.DotNet.Cli.Build | ||
{ | ||
public class GenerateBuildVersionInfo : Task | ||
{ | ||
[Required] | ||
public string RepoRoot { get; set; } | ||
|
||
[Output] | ||
public ITaskItem OutputBuildVersionInfo { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
var branchInfo = new BranchInfo(RepoRoot); | ||
|
||
var commitCount = GitUtils.GetCommitCount(); | ||
var commitHash = GitUtils.GetCommitHash(); | ||
|
||
var buildVersion = new BuildVersion() | ||
{ | ||
Major = int.Parse(branchInfo.Entries["MAJOR_VERSION"]), | ||
Minor = int.Parse(branchInfo.Entries["MINOR_VERSION"]), | ||
Patch = int.Parse(branchInfo.Entries["PATCH_VERSION"]), | ||
ReleaseSuffix = branchInfo.Entries["RELEASE_SUFFIX"], | ||
CommitCount = commitCount | ||
}; | ||
|
||
OutputBuildVersionInfo = ConstructBuildVersionInfoItem(buildVersion, commitHash); | ||
|
||
return true; | ||
} | ||
|
||
private ITaskItem ConstructBuildVersionInfoItem(BuildVersion buildVersion, string commitHash) | ||
{ | ||
var versionInfo = new TaskItem(); | ||
versionInfo.ItemSpec = "BuildVersionInfo"; | ||
|
||
versionInfo.SetMetadata("CommitHash", commitHash); | ||
versionInfo.SetMetadata("Major", buildVersion.Major.ToString()); | ||
versionInfo.SetMetadata("Minor", buildVersion.Minor.ToString()); | ||
versionInfo.SetMetadata("Patch", buildVersion.Patch.ToString()); | ||
versionInfo.SetMetadata("ReleaseSuffix", buildVersion.ReleaseSuffix); | ||
versionInfo.SetMetadata("CommitCount", buildVersion.CommitCountString); | ||
versionInfo.SetMetadata("VersionSuffix", buildVersion.VersionSuffix); | ||
versionInfo.SetMetadata("SimpleVersion", buildVersion.SimpleVersion); | ||
versionInfo.SetMetadata("NugetVersion", buildVersion.NuGetVersion); | ||
versionInfo.SetMetadata("MsiVersion", buildVersion.GenerateMsiVersion()); | ||
|
||
return versionInfo; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Runtime.InteropServices; | ||
using System.Net.Http; | ||
using Microsoft.Build.Utilities; | ||
using Microsoft.DotNet.Cli.Build.Framework; | ||
using Microsoft.DotNet.InternalAbstractions; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; | ||
|
||
namespace Microsoft.DotNet.Cli.Build | ||
{ | ||
public class Rid : Task | ||
{ | ||
[Output] | ||
public string OutputRid { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
OutputRid = RuntimeEnvironment.GetRuntimeIdentifier(); | ||
|
||
return true; | ||
} | ||
} | ||
} |