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/InputDirectories.props" />
<Import Project="build/MSBuildExtensions.props" />
<Import Project="build/Stage0.props" />
<Import Project="build/OutputDirectories.props" />
<Import Project="build/BuildDefaults.props" />
<Import Project="build/Stage0.props" />
<Import Project="build/VersionBadge.props" />
<Import Project="build/BundledRuntimes.props" />
<Import Project="build/CrossGen.props" />

View file

@ -1,10 +1,19 @@
<Project>
<PropertyGroup>
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
<OutputDirectory>$(BaseOutputDirectory)/stage2</OutputDirectory>
<Stage2WithBackwardsCompatibleRuntimesOutputDirectory>$(BaseOutputDirectory)/stage2WithBackwardsCompatibleRuntimes</Stage2WithBackwardsCompatibleRuntimesOutputDirectory>
<CliBuildStage Condition="'$(CliBuildStage)' == '' And '$(CliOuterBuildStage)' != ''">$([MSBuild]::Add($(CliOuterBuildStage), '1'))</CliBuildStage>
<CliBuildStage Condition="'$(CliBuildStage)' == ''">2</CliBuildStage>
<!-- 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>
<SymbolsDirectory>$(BaseOutputDirectory)/stage2symbols</SymbolsDirectory>
<SymbolsDirectory>$(BaseOutputDirectory)/symbols</SymbolsDirectory>
<RoslynDirectory>$(SdkOutputDirectory)/Roslyn</RoslynDirectory>
<FSharpDirectory>$(SdkOutputDirectory)/FSharp</FSharpDirectory>
<CompilationDirectory>$(BaseOutputDirectory)/stage2compilation</CompilationDirectory>
@ -12,6 +21,7 @@
<PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory>
<SharedFrameworkPublishDirectory>$(IntermediateDirectory)/sharedFrameworkPublish</SharedFrameworkPublishDirectory>
<!-- 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>
<BackwardsCompatibleSharedFrameworksPublishDirectory>$(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish</BackwardsCompatibleSharedFrameworksPublishDirectory>
<TestOutputDir>$(BaseOutputDirectory)/testpackages/</TestOutputDir>
@ -19,5 +29,7 @@
<GeneratedMSBuildExtensionsDirectory>$(IntermediateDirectory)/GeneratedMSBuildExtensions</GeneratedMSBuildExtensionsDirectory>
<MSBuildExtensionsLayoutDirectory>$(IntermediateDirectory)/MSBuildExtensionsLayout</MSBuildExtensionsLayoutDirectory>
<SdkResolverOutputDirectory>$(MSBuildExtensionsLayoutDirectory)/MSBuildSdkResolver</SdkResolverOutputDirectory>
<NextStagePropsPath>$(BaseOutputDirectory)/PreviousStage.props</NextStagePropsPath>
</PropertyGroup>
</Project>

View file

@ -4,7 +4,7 @@
<Import Project="prepare/CheckPrereqs.targets" />
<Target Name="Prepare"
DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages;IsolateArtifactsFromDirectoryBuildFiles" />
DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestoreSrcPackages;RestoreToolsPackages;IsolateArtifactsFromDirectoryBuildFiles;CreatePropsForNextStage" />
<Target Name="Init"
DependsOnTargets="PrintBuildInfo;
@ -104,4 +104,32 @@
SkipUnchangedFiles="true" />
</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>

View file

@ -1,8 +1,18 @@
<Project>
<PropertyGroup>
<PropertyGroup Condition="'$(PreviousStageProps)' == ''">
<Stage0Directory>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Directory>
<Stage0PjDirectory>$(RepoRoot)/.dotnet_stage0PJ/$(Architecture)</Stage0PjDirectory>
<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 Condition=" '$(OSName)' == 'win' ">True</IsDesktopAvailable>
</PropertyGroup>

View file

@ -26,6 +26,7 @@
Configuration=$(Configuration);
TestArtifactsDir=$(TestArtifactsDir);
TestPackagesDir=$(TestPackagesDir);
PreviousStageProps=$(NextStagePropsPath);
TestProject=%(TestProjects.Identity);
TestResultXmlDir=$(TestResultXmlDir);
ToolPath=$(OutputDirectory);
@ -54,13 +55,15 @@
DependsOnTargets="PrepareTests;
CreateTestAssetPackageNuPkgs;">
<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 Name="BuildTests"
DependsOnTargets="RestoreTests;">
<DotNetBuild ToolPath="$(OutputDirectory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
AdditionalParameters="/p:PreviousStageProps=$(NextStagePropsPath)"
MaxCpuCount="1" />
</Target>
@ -71,7 +74,7 @@
<DotNetRestore ToolPath="$(OutputDirectory)"
WorkingDirectory="$([System.IO.Directory]::GetParent('%(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 -->
@ -79,7 +82,7 @@
ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(OutputDirectory)"
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>

View file

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

View file

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

View file

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