Generate properties to pass to the next stage of the build

(cherry picked from commit 12f8c2377f)
This commit is contained in:
Daniel Plaisted 2017-08-11 07:09:01 -07:00 committed by Nick Guerrera
parent ee7852a790
commit f39315771e
8 changed files with 75 additions and 13 deletions

View file

@ -47,9 +47,9 @@ tools\TestAssetsDependencies\TestAssetsDependencies.csproj
<Import Project="build/FileExtensions.props" /> <Import Project="build/FileExtensions.props" />
<Import Project="build/InputDirectories.props" /> <Import Project="build/InputDirectories.props" />
<Import Project="build/MSBuildExtensions.props" /> <Import Project="build/MSBuildExtensions.props" />
<Import Project="build/Stage0.props" />
<Import Project="build/OutputDirectories.props" /> <Import Project="build/OutputDirectories.props" />
<Import Project="build/BuildDefaults.props" /> <Import Project="build/BuildDefaults.props" />
<Import Project="build/Stage0.props" />
<Import Project="build/VersionBadge.props" /> <Import Project="build/VersionBadge.props" />
<Import Project="build/BundledRuntimes.props" /> <Import Project="build/BundledRuntimes.props" />
<Import Project="build/CrossGen.props" /> <Import Project="build/CrossGen.props" />

View file

@ -1,10 +1,19 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory> <CliBuildStage Condition="'$(CliBuildStage)' == '' And '$(CliOuterBuildStage)' != ''">$([MSBuild]::Add($(CliOuterBuildStage), '1'))</CliBuildStage>
<OutputDirectory>$(BaseOutputDirectory)/stage2</OutputDirectory> <CliBuildStage Condition="'$(CliBuildStage)' == ''">2</CliBuildStage>
<Stage2WithBackwardsCompatibleRuntimesOutputDirectory>$(BaseOutputDirectory)/stage2WithBackwardsCompatibleRuntimes</Stage2WithBackwardsCompatibleRuntimesOutputDirectory>
<!-- BaseOutputDirectory is the root output path for this stage and RID
BaseOutputPath is the project-specific output folder that each project builds into.
This is not confusing at all. -->
<BaseOutputDirectory>$(RepoRoot)/artifacts/stage$(CliBuildStage)/$(Rid)</BaseOutputDirectory>
<BaseOutputPath>$([System.IO.Path]::GetFullPath('$(BaseOutputDirectory)/bin/$(MSBuildProjectName)'))</BaseOutputPath>
<BaseIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(BaseOutputDirectory)/obj/$(MSBuildProjectName)'))</BaseIntermediateOutputPath>
<OutputDirectory>$(BaseOutputDirectory)/dotnet</OutputDirectory>
<Stage2WithBackwardsCompatibleRuntimesOutputDirectory>$(BaseOutputDirectory)/dotnetWithBackwardsCompatibleRuntimes</Stage2WithBackwardsCompatibleRuntimesOutputDirectory>
<SdkOutputDirectory>$(OutputDirectory)/sdk/$(SdkVersion)</SdkOutputDirectory> <SdkOutputDirectory>$(OutputDirectory)/sdk/$(SdkVersion)</SdkOutputDirectory>
<SymbolsDirectory>$(BaseOutputDirectory)/stage2symbols</SymbolsDirectory> <SymbolsDirectory>$(BaseOutputDirectory)/symbols</SymbolsDirectory>
<RoslynDirectory>$(SdkOutputDirectory)/Roslyn</RoslynDirectory> <RoslynDirectory>$(SdkOutputDirectory)/Roslyn</RoslynDirectory>
<FSharpDirectory>$(SdkOutputDirectory)/FSharp</FSharpDirectory> <FSharpDirectory>$(SdkOutputDirectory)/FSharp</FSharpDirectory>
<CompilationDirectory>$(BaseOutputDirectory)/stage2compilation</CompilationDirectory> <CompilationDirectory>$(BaseOutputDirectory)/stage2compilation</CompilationDirectory>
@ -12,6 +21,7 @@
<PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory> <PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory>
<SharedFrameworkPublishDirectory>$(IntermediateDirectory)/sharedFrameworkPublish</SharedFrameworkPublishDirectory> <SharedFrameworkPublishDirectory>$(IntermediateDirectory)/sharedFrameworkPublish</SharedFrameworkPublishDirectory>
<!-- The 'AspNetRuntimePackageStorePublishDirectory' needs to be very short due to path length constraints on Win8.1 --> <!-- The 'AspNetRuntimePackageStorePublishDirectory' needs to be very short due to path length constraints on Win8.1 -->
<!-- Will this still work now that the stage has been added to the path? -->
<AspNetRuntimePackageStorePublishDirectory>$(BaseOutputDirectory)/AspRT</AspNetRuntimePackageStorePublishDirectory> <AspNetRuntimePackageStorePublishDirectory>$(BaseOutputDirectory)/AspRT</AspNetRuntimePackageStorePublishDirectory>
<BackwardsCompatibleSharedFrameworksPublishDirectory>$(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish</BackwardsCompatibleSharedFrameworksPublishDirectory> <BackwardsCompatibleSharedFrameworksPublishDirectory>$(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish</BackwardsCompatibleSharedFrameworksPublishDirectory>
<TestOutputDir>$(BaseOutputDirectory)/testpackages/</TestOutputDir> <TestOutputDir>$(BaseOutputDirectory)/testpackages/</TestOutputDir>
@ -19,5 +29,7 @@
<GeneratedMSBuildExtensionsDirectory>$(IntermediateDirectory)/GeneratedMSBuildExtensions</GeneratedMSBuildExtensionsDirectory> <GeneratedMSBuildExtensionsDirectory>$(IntermediateDirectory)/GeneratedMSBuildExtensions</GeneratedMSBuildExtensionsDirectory>
<MSBuildExtensionsLayoutDirectory>$(IntermediateDirectory)/MSBuildExtensionsLayout</MSBuildExtensionsLayoutDirectory> <MSBuildExtensionsLayoutDirectory>$(IntermediateDirectory)/MSBuildExtensionsLayout</MSBuildExtensionsLayoutDirectory>
<SdkResolverOutputDirectory>$(MSBuildExtensionsLayoutDirectory)/MSBuildSdkResolver</SdkResolverOutputDirectory> <SdkResolverOutputDirectory>$(MSBuildExtensionsLayoutDirectory)/MSBuildSdkResolver</SdkResolverOutputDirectory>
<NextStagePropsPath>$(BaseOutputDirectory)/PreviousStage.props</NextStagePropsPath>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -4,7 +4,7 @@
<Import Project="prepare/CheckPrereqs.targets" /> <Import Project="prepare/CheckPrereqs.targets" />
<Target Name="Prepare" <Target Name="Prepare"
DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages;IsolateArtifactsFromDirectoryBuildFiles" /> DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages;IsolateArtifactsFromDirectoryBuildFiles;CreatePropsForNextStage" />
<Target Name="Init" <Target Name="Init"
DependsOnTargets="PrintBuildInfo; DependsOnTargets="PrintBuildInfo;
@ -104,4 +104,32 @@
SkipUnchangedFiles="true" /> SkipUnchangedFiles="true" />
</Target> </Target>
<Target Name="CreatePropsForNextStage">
<PropertyGroup>
<NextStagePropsContent>
&lt;Project&gt;
&lt;PropertyGroup&gt;
&lt;PreviousStageDirectory&gt;$(OutputDirectory)&lt;/PreviousStageDirectory&gt;
&lt;PreviousStageDotnet&gt;$(DotnetInOutputDirectory)&lt;/PreviousStageDotnet&gt;
&lt;CliOuterBuildStage&gt;$(CliBuildStage)&lt;/CliOuterBuildStage&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</NextStagePropsContent>
<ExistingNextStagePropsContent Condition=" Exists('$(NextStagePropsPath)') ">
$([System.IO.File]::ReadAllText($(NextStagePropsPath)))
</ExistingNextStagePropsContent>
<ShouldOverwriteNextStagePropsFile>false</ShouldOverwriteNextStagePropsFile>
<ShouldOverwriteNextStagePropsFile
Condition=" '$(ExistingNextStagePropsContent.Trim())' != '$(NextStagePropsContent.Trim())' ">true</ShouldOverwriteNextStagePropsFile>
</PropertyGroup>
<WriteLinesToFile File="$(NextStagePropsPath)"
Lines="$(NextStagePropsContent)"
Condition=" '$(ShouldOverwriteNextStagePropsFile)' == 'true' "
Overwrite="true" />
</Target>
</Project> </Project>

View file

@ -1,8 +1,18 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup Condition="'$(PreviousStageProps)' == ''">
<Stage0Directory>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Directory> <Stage0Directory>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Directory>
<Stage0PjDirectory>$(RepoRoot)/.dotnet_stage0PJ/$(Architecture)</Stage0PjDirectory>
<DotnetStage0>$(Stage0Directory)/dotnet$(ExeExtension)</DotnetStage0> <DotnetStage0>$(Stage0Directory)/dotnet$(ExeExtension)</DotnetStage0>
</PropertyGroup>
<Import Project="$(PreviousStageProps)" Condition="'$(PreviousStageProps)' != ''" />
<PropertyGroup Condition="'$(PreviousStageProps)' != ''">
<Stage0Directory>$(PreviousStageDirectory)</Stage0Directory>
<DotnetStage0>$(PreviousStageDotnet)</DotnetStage0>
</PropertyGroup>
<PropertyGroup>
<IsDesktopAvailable>False</IsDesktopAvailable> <IsDesktopAvailable>False</IsDesktopAvailable>
<IsDesktopAvailable Condition=" '$(OSName)' == 'win' ">True</IsDesktopAvailable> <IsDesktopAvailable Condition=" '$(OSName)' == 'win' ">True</IsDesktopAvailable>
</PropertyGroup> </PropertyGroup>

View file

@ -26,6 +26,7 @@
Configuration=$(Configuration); Configuration=$(Configuration);
TestArtifactsDir=$(TestArtifactsDir); TestArtifactsDir=$(TestArtifactsDir);
TestPackagesDir=$(TestPackagesDir); TestPackagesDir=$(TestPackagesDir);
PreviousStageProps=$(NextStagePropsPath);
TestProject=%(TestProjects.Identity); TestProject=%(TestProjects.Identity);
TestResultXmlDir=$(TestResultXmlDir); TestResultXmlDir=$(TestResultXmlDir);
ToolPath=$(OutputDirectory); ToolPath=$(OutputDirectory);
@ -54,13 +55,15 @@
DependsOnTargets="PrepareTests; DependsOnTargets="PrepareTests;
CreateTestAssetPackageNuPkgs;"> CreateTestAssetPackageNuPkgs;">
<DotNetRestore ToolPath="$(OutputDirectory)" <DotNetRestore ToolPath="$(OutputDirectory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;" /> ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
AdditionalParameters="/p:PreviousStageProps=$(NextStagePropsPath)" />
</Target> </Target>
<Target Name="BuildTests" <Target Name="BuildTests"
DependsOnTargets="RestoreTests;"> DependsOnTargets="RestoreTests;">
<DotNetBuild ToolPath="$(OutputDirectory)" <DotNetBuild ToolPath="$(OutputDirectory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;" ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
AdditionalParameters="/p:PreviousStageProps=$(NextStagePropsPath)"
MaxCpuCount="1" /> MaxCpuCount="1" />
</Target> </Target>
@ -71,7 +74,7 @@
<DotNetRestore ToolPath="$(OutputDirectory)" <DotNetRestore ToolPath="$(OutputDirectory)"
WorkingDirectory="$([System.IO.Directory]::GetParent('%(TestPackageProject.ProjectPath)'))" WorkingDirectory="$([System.IO.Directory]::GetParent('%(TestPackageProject.ProjectPath)'))"
ProjectPath="%(TestPackageProject.ProjectPath)" ProjectPath="%(TestPackageProject.ProjectPath)"
AdditionalParameters="/p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages" AdditionalParameters="/p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages /p:PreviousStageProps=$(NextStagePropsPath)"
/> />
<!-- https://github.com/NuGet/Home/issues/4063 --> <!-- https://github.com/NuGet/Home/issues/4063 -->
@ -79,7 +82,7 @@
ProjectPath="%(TestPackageProject.ProjectPath)" ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(OutputDirectory)" ToolPath="$(OutputDirectory)"
VersionSuffix="%(TestPackageProject.VersionSuffix)" VersionSuffix="%(TestPackageProject.VersionSuffix)"
MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion) /p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages" /> MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion) /p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages /p:PreviousStageProps=$(NextStagePropsPath)" />
</Target> </Target>

View file

@ -14,6 +14,7 @@
<ItemGroup> <ItemGroup>
<EnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" /> <EnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
<EnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" /> <EnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" />
<EnvironmentVariables Include="PreviousStageProps=$(PreviousStageProps)" />
</ItemGroup> </ItemGroup>
<DotNetTest EnvironmentVariables="@(EnvironmentVariables)" <DotNetTest EnvironmentVariables="@(EnvironmentVariables)"

View file

@ -13,11 +13,13 @@ namespace Microsoft.DotNet.Cli.Build
public string Verbosity { get; set; } public string Verbosity { get; set; }
public string AdditionalParameters { get; set; }
protected override string Args protected override string Args
{ {
get get
{ {
return $"{GetVerbosityArg()} {GetMaxCpuCountArg()}"; return $"{GetVerbosityArg()} {GetMaxCpuCountArg()} {GetAdditionalParameters()}";
} }
} }
@ -40,5 +42,10 @@ namespace Microsoft.DotNet.Cli.Build
return null; return null;
} }
private string GetAdditionalParameters()
{
return AdditionalParameters;
}
} }
} }

View file

@ -23,7 +23,8 @@
<Target Name="PrecompileScript" <Target Name="PrecompileScript"
BeforeTargets="Build" BeforeTargets="Build"
Condition=" '$(IsCrossTargetingBuild)' != 'true' "> Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="$(DotnetInOutputDirectory) publish ../ArgumentsReflector/ArgumentsReflector.csproj --output $(OutputPath)" />
<Exec Command="$(PreviousStageDotnet) publish ../ArgumentsReflector/ArgumentsReflector.csproj --output $(OutputPath)" />
</Target> </Target>
</Project> </Project>