Merge pull request #5617 from dotnet/dev/jgoshi/firstPassProps
Generate host and build info and store them in .props files
This commit is contained in:
commit
0986cc079a
12 changed files with 100 additions and 30 deletions
|
@ -1,6 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="BuildTheWholeCli" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" DefaultTargets="BuildTheWholeCli" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||||
|
<Import Project="build/Microsoft.DotNet.Cli.InitRepo.props" />
|
||||||
|
<Import Condition=" Exists('$(GitCommitInfoProps)') Or '$(GeneratingPropsFile)' != 'true' " Project="$(GitCommitInfoProps)" />
|
||||||
|
<Import Condition=" Exists('$(HostInfoProps)') Or '$(GeneratingPropsFile)' != 'true' " Project="$(HostInfoProps)" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Monikers.props" />
|
<Import Project="build/Microsoft.DotNet.Cli.Monikers.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -73,12 +76,16 @@
|
||||||
WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>
|
<Target Name="BuildTheWholeCli" DependsOnTargets="$(CLITargets)" />
|
||||||
|
|
||||||
|
<Import Project="build/Microsoft.DotNet.Cli.GitCommitInfo.targets" />
|
||||||
|
<Import Project="build/Microsoft.DotNet.Cli.HostInfo.targets" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Prepare.targets" />
|
<Import Project="build/Microsoft.DotNet.Cli.Prepare.targets" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Compile.targets" />
|
<Import Project="build/Microsoft.DotNet.Cli.Compile.targets" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Package.targets" />
|
<Import Project="build/Microsoft.DotNet.Cli.Package.targets" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Test.targets" />
|
<Import Project="build/Microsoft.DotNet.Cli.Test.targets" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Publish.targets" />
|
<Import Project="build/Microsoft.DotNet.Cli.Publish.targets" />
|
||||||
<Import Project="build/Microsoft.DotNet.Cli.Run.targets" />
|
<Import Project="build/Microsoft.DotNet.Cli.Run.targets" />
|
||||||
|
|
||||||
|
<Import Project="build/Microsoft.DotNet.Cli.InitRepo.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<Project ToolsVersion="15.0">
|
<Project ToolsVersion="15.0">
|
||||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BundledSdk Include="NuGet.Build.Tasks.Pack" Version="$(CLI_NuGet_Version)" />
|
<BundledSdk Include="NuGet.Build.Tasks.Pack" Version="$(CLI_NuGet_Version)" />
|
||||||
<BundledSdk Include="Microsoft.NET.Sdk" Version="$(CLI_NETSDK_Version)" />
|
<BundledSdk Include="Microsoft.NET.Sdk" Version="$(CLI_NETSDK_Version)" />
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<Project ToolsVersion="15.0">
|
<Project ToolsVersion="15.0">
|
||||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BundledTemplate Include="Microsoft.DotNet.Common.ItemTemplates" Version="$(TemplateEngineTemplateVersion)" />
|
<BundledTemplate Include="Microsoft.DotNet.Common.ItemTemplates" Version="$(TemplateEngineTemplateVersion)" />
|
||||||
<BundledTemplate Include="Microsoft.DotNet.Common.ProjectTemplates.2.0" Version="$(TemplateEngineTemplate2_0Version)" />
|
<BundledTemplate Include="Microsoft.DotNet.Common.ProjectTemplates.2.0" Version="$(TemplateEngineTemplate2_0Version)" />
|
||||||
|
|
42
build/Microsoft.DotNet.Cli.GitCommitInfo.targets
Normal file
42
build/Microsoft.DotNet.Cli.GitCommitInfo.targets
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<Project ToolsVersion="15.0">
|
||||||
|
<Target Name="WriteGitCommitInfoProps"
|
||||||
|
DependsOnTargets="BuildDotnetCliBuildFramework">
|
||||||
|
<GetCommitHash RepoRoot="$(RepoRoot)">
|
||||||
|
<Output TaskParameter="CommitHash" PropertyName="GitInfoCommitHash" />
|
||||||
|
</GetCommitHash>
|
||||||
|
|
||||||
|
<GenerateBuildVersionInfo RepoRoot="$(RepoRoot)"
|
||||||
|
VersionMajor="$(VersionMajor)"
|
||||||
|
VersionMinor="$(VersionMinor)"
|
||||||
|
VersionPatch="$(VersionPatch)"
|
||||||
|
ReleaseSuffix="$(ReleaseSuffix)">
|
||||||
|
<Output TaskParameter="CommitCount" PropertyName="GitInfoCommitCount" />
|
||||||
|
<Output TaskParameter="MsiVersion" PropertyName="BuildInfoMsiVersion" />
|
||||||
|
<Output TaskParameter="VersionBadgeMoniker" PropertyName="BuildInfoVersionBadgeMoniker" />
|
||||||
|
</GenerateBuildVersionInfo>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<ShouldOverWriteThePropsFile
|
||||||
|
Condition=" '$(CommitHash)' != '$(GitInfoCommitHash)' Or
|
||||||
|
'$(CommitCount)' != '$(GitInfoCommitCount)' Or
|
||||||
|
'$(MsiVersion)' != '$(BuildInfoMsiVersion)' Or
|
||||||
|
'$(VersionBadgeMoniker)' != '$(BuildInfoVersionBadgeMoniker)' ">true</ShouldOverWriteThePropsFile>
|
||||||
|
|
||||||
|
<GitCommitInfoPropsContent>
|
||||||
|
<Project ToolsVersion="15.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<CommitHash>$(GitInfoCommitHash)</CommitHash>
|
||||||
|
<CommitCount>$(GitInfoCommitCount)</CommitCount>
|
||||||
|
<MsiVersion>$(BuildInfoMsiVersion)</MsiVersion>
|
||||||
|
<VersionBadgeMoniker>$(BuildInfoVersionBadgeMoniker)</VersionBadgeMoniker>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
</GitCommitInfoPropsContent>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<WriteLinesToFile File="$(GitCommitInfoProps)"
|
||||||
|
Lines="$(GitCommitInfoPropsContent)"
|
||||||
|
Condition=" '$(ShouldOverwriteThePropsFile)' == 'true' "
|
||||||
|
Overwrite="true" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
28
build/Microsoft.DotNet.Cli.HostInfo.targets
Normal file
28
build/Microsoft.DotNet.Cli.HostInfo.targets
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<Project ToolsVersion="15.0">
|
||||||
|
<Target Name="WriteHostInfoProps"
|
||||||
|
Condition=" !Exists('$(HostInfoProps)') "
|
||||||
|
DependsOnTargets="BuildDotnetCliBuildFramework">
|
||||||
|
<!-- Current Runtime Information -->
|
||||||
|
<GetCurrentRuntimeInformation OverrideRid="$(OverrideRid)">
|
||||||
|
<Output TaskParameter="Rid" PropertyName="HostRid" />
|
||||||
|
<Output TaskParameter="Architecture" PropertyName="HostArchitecture" />
|
||||||
|
<Output TaskParameter="OSName" PropertyName="HostOSName" />
|
||||||
|
</GetCurrentRuntimeInformation>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<HostInfoPropsContent>
|
||||||
|
<Project ToolsVersion="15.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Rid>$(HostRid)</Rid>
|
||||||
|
<Architecture>$(HostArchitecture)</Architecture>
|
||||||
|
<OSName>$(HostOSName)</OSName>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
</HostInfoPropsContent>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<WriteLinesToFile File="$(HostInfoProps)"
|
||||||
|
Lines="$(HostInfoPropsContent)"
|
||||||
|
Overwrite="true" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
7
build/Microsoft.DotNet.Cli.InitRepo.props
Normal file
7
build/Microsoft.DotNet.Cli.InitRepo.props
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<Project ToolsVersion="15.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<GeneratedPropsDir>$(RepoRoot)/artifacts/obj</GeneratedPropsDir>
|
||||||
|
<GitCommitInfoProps>$(GeneratedPropsDir)/GitCommitInfo.props</GitCommitInfoProps>
|
||||||
|
<HostInfoProps>$(GeneratedPropsDir)/HostInfo.props</HostInfoProps>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
12
build/Microsoft.DotNet.Cli.InitRepo.targets
Normal file
12
build/Microsoft.DotNet.Cli.InitRepo.targets
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<Project ToolsVersion="15.0">
|
||||||
|
<Target Name="WriteDynamicPropsToStaticPropsFiles"
|
||||||
|
DependsOnTargets="BuildDotnetCliBuildFramework;
|
||||||
|
EnsureGeneratedPropsDirectory;
|
||||||
|
WriteGitCommitInfoProps;
|
||||||
|
WriteHostInfoProps"/>
|
||||||
|
|
||||||
|
<Target Name="EnsureGeneratedPropsDirectory">
|
||||||
|
<MakeDir Condition=" !Exists('$(GeneratedPropsDir)') "
|
||||||
|
Directories="$(GeneratedPropsDir)" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
|
@ -4,7 +4,6 @@
|
||||||
<Import Project="prepare/CheckPrereqs.targets" />
|
<Import Project="prepare/CheckPrereqs.targets" />
|
||||||
<Import Project="Microsoft.DotNet.Cli.BundledSdks.props" />
|
<Import Project="Microsoft.DotNet.Cli.BundledSdks.props" />
|
||||||
<Import Project="Microsoft.DotNet.Cli.BundledTemplates.props" />
|
<Import Project="Microsoft.DotNet.Cli.BundledTemplates.props" />
|
||||||
<Import Project="Microsoft.DotNet.Cli.DependencyVersions.props" />
|
|
||||||
|
|
||||||
<Target Name="Prepare"
|
<Target Name="Prepare"
|
||||||
DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages" />
|
DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages" />
|
||||||
|
@ -18,13 +17,6 @@
|
||||||
<Target Name="InitializeCommonProps"
|
<Target Name="InitializeCommonProps"
|
||||||
DependsOnTargets="BuildDotnetCliBuildFramework" >
|
DependsOnTargets="BuildDotnetCliBuildFramework" >
|
||||||
|
|
||||||
<!-- Current Runtime Information -->
|
|
||||||
<GetCurrentRuntimeInformation OverrideRid="$(OverrideRid)">
|
|
||||||
<Output TaskParameter="Rid" PropertyName="Rid" />
|
|
||||||
<Output TaskParameter="Architecture" PropertyName="Architecture" />
|
|
||||||
<Output TaskParameter="OSName" PropertyName="OSName" />
|
|
||||||
</GetCurrentRuntimeInformation>
|
|
||||||
|
|
||||||
<!-- Common Properties -->
|
<!-- Common Properties -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsDesktopAvailable>False</IsDesktopAvailable>
|
<IsDesktopAvailable>False</IsDesktopAvailable>
|
||||||
|
@ -49,19 +41,6 @@
|
||||||
<CoreCLRRid Condition=" '$(OSName)' == 'centos' OR '$(OSName)' == 'rhel' ">rhel.7-x64</CoreCLRRid>
|
<CoreCLRRid Condition=" '$(OSName)' == 'centos' OR '$(OSName)' == 'rhel' ">rhel.7-x64</CoreCLRRid>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<GetCommitHash RepoRoot="$(RepoRoot)">
|
|
||||||
<Output TaskParameter="CommitHash" PropertyName="CommitHash" />
|
|
||||||
</GetCommitHash>
|
|
||||||
|
|
||||||
<GenerateBuildVersionInfo RepoRoot="$(RepoRoot)"
|
|
||||||
VersionMajor="$(VersionMajor)"
|
|
||||||
VersionMinor="$(VersionMinor)"
|
|
||||||
VersionPatch="$(VersionPatch)"
|
|
||||||
ReleaseSuffix="$(ReleaseSuffix)">
|
|
||||||
<Output TaskParameter="CommitCount" PropertyName="DefaultCommitCount" />
|
|
||||||
<Output TaskParameter="MsiVersion" PropertyName="MsiVersion" />
|
|
||||||
<Output TaskParameter="VersionBadgeMoniker" PropertyName="VersionBadgeMoniker" />
|
|
||||||
</GenerateBuildVersionInfo>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<CommitCount Condition=" '$(CommitCount)' == '' ">$(DefaultCommitCount)</CommitCount>
|
<CommitCount Condition=" '$(CommitCount)' == '' ">$(DefaultCommitCount)</CommitCount>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Test">
|
<Project ToolsVersion="14.0" DefaultTargets="Test">
|
||||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PathSeparator>/</PathSeparator>
|
<PathSeparator>/</PathSeparator>
|
||||||
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
|
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<!-- NuGet Information -->
|
<!-- NuGet Information -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
||||||
|
|
||||||
<NuGetPackagesDir>$(NUGET_PACKAGES)</NuGetPackagesDir>
|
<NuGetPackagesDir>$(NUGET_PACKAGES)</NuGetPackagesDir>
|
||||||
<NuGetPackagesDir Condition=" '$(NuGetPackagesDir)' == '' ">$(RepoRoot)/.nuget/packages</NuGetPackagesDir>
|
<NuGetPackagesDir Condition=" '$(NuGetPackagesDir)' == '' ">$(RepoRoot)/.nuget/packages</NuGetPackagesDir>
|
||||||
|
|
||||||
|
@ -21,6 +21,5 @@
|
||||||
<CliVersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)</CliVersionPrefix>
|
<CliVersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)</CliVersionPrefix>
|
||||||
|
|
||||||
<CliTargetFramework>netcoreapp2.0</CliTargetFramework>
|
<CliTargetFramework>netcoreapp2.0</CliTargetFramework>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -114,6 +114,7 @@ if ($NoBuild)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dotnet msbuild build.proj /p:Architecture=$Architecture /p:GeneratingPropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
|
||||||
dotnet msbuild build.proj /m /v:diag /p:Architecture=$Architecture $ExtraParameters
|
dotnet msbuild build.proj /m /v:diag /p:Architecture=$Architecture $ExtraParameters
|
||||||
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
|
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,7 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
echo "${args[@]}"
|
echo "${args[@]}"
|
||||||
|
|
||||||
if [ $BUILD -eq 1 ]; then
|
if [ $BUILD -eq 1 ]; then
|
||||||
|
dotnet msbuild build.proj /p:Architecture=$ARCHITECTURE /p:GeneratingPropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
|
||||||
dotnet msbuild build.proj /m /v:diag /p:Architecture=$ARCHITECTURE "${args[@]}"
|
dotnet msbuild build.proj /m /v:diag /p:Architecture=$ARCHITECTURE "${args[@]}"
|
||||||
else
|
else
|
||||||
echo "Not building due to --nobuild"
|
echo "Not building due to --nobuild"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue