Making CompileStage batch over the different stages to avoid msbuild caching of targets.

This commit is contained in:
Livar Cunha 2016-06-29 17:17:32 -07:00
parent 58c75d54fd
commit e100b950d2
3 changed files with 64 additions and 87 deletions

View file

@ -8,7 +8,7 @@
<PlatformScriptHost Condition=" '$(OS)' != 'Windows_NT' "></PlatformScriptHost>
<PlatformScriptExtension Condition=" '$(OS)' == 'Windows_NT' ">.ps1</PlatformScriptExtension>
<PlatformScriptExtension Condition=" '$(OS)' != 'Windows_NT' ">.sh</PlatformScriptExtension>
<PlatformScriptExtension Condition=" '$(OS)' != 'Windows_NT' ">.sh</PlatformScriptExtension>
<NoRunArg Condition=" '$(OS)' == 'Windows_NT' ">-NoRun</NoRunArg>
<NoRunArg Condition=" '$(OS)' != 'Windows_NT' ">--norun</NoRunArg>
@ -55,10 +55,6 @@
<UsingTask TaskName="TestTargets" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="PublishTargets" AssemblyFile="$(CLIBuildDll)" />
<Target DependsOnTargets="BuildDotnetCliBuildFramework" Name="Prepare">
<PrepareTargets />
</Target>
<Target DependsOnTargets="BuildDotnetCliBuildFramework" Name="Test">
<TestTargets />
</Target>

View file

@ -9,47 +9,55 @@
<UsingTask TaskName="CrossgenDirectory" AssemblyFile="$(CLIBuildDll)" />
<Target Name="Compile" DependsOnTargets="BuildDotnetCliBuildFramework;
CompileStage1;
CompileStage2">
Init;
SetupStage;
CompileStage;
BuildProjectsForNuGetPackages;
GenerateNuGetPackagesArchive">
</Target>
<Target Name="SetupStage">
<ItemGroup>
<CompileStageInputs Include="$(RepoRoot)/src/**/*.cs" Exclude="$(RepoRoot)/src/**/obj/**/*.cs" />
<CompileStageInputs Include="$(RepoRoot)/src/**/project.json;$(RepoRoot)/src/**/project.lock.json" />
<Target Name="CompileStage1"
DependsOnTargets="BuildDotnetCliBuildFramework;
Init;
SetupStage1;
CompileStage;
AfterCompileStage">
</Target>
<Target Name="SetupStage1">
<PropertyGroup>
<StageDirectory>$(Stage1Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
<DotnetExe>$(Stage0Path)/dotnet.exe</DotnetExe>
</PropertyGroup>
<Stage Include="Stage1">
<Inputs>@(CompileStageInputs)</Inputs>
<StageDirectory>$(Stage1Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
<DotnetExe>$(Stage0Path)/dotnet.exe</DotnetExe>
</Stage>
<Stage Include="Stage2">
<Inputs>@(CompileStageInputs)</Inputs>
<StageDirectory>$(Stage2Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage2SymbolsDirectory)</StageSymbolsDirectory>
<DotnetExe>$(DotnetStage1)</DotnetExe>
</Stage>
</ItemGroup>
</Target>
<Target Name="CompileStage2"
DependsOnTargets="BuildDotnetCliBuildFramework;
Init;
SetupStage2;
CompileStage;
AfterCompileStage;
BuildProjectsForNuGetPackages;
GenerateNuGetPackagesArchive">
</Target>
<Target Name="SetupStage2">
<PropertyGroup>
<StageDirectory>$(Stage2Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage2SymbolsDirectory)</StageSymbolsDirectory>
<DotnetExe>$(DotnetStage1)</DotnetExe>
</PropertyGroup>
</Target>
<Target Name="CompileStage"
DependsOnTargets="BeforeCompileStage">
Inputs="%(Stage.Identity);%(Stage.Inputs)"
Outputs="%(StageDirectory)/sdk/$(NugetVersion)/dotnet.dll">
<PropertyGroup>
<SrcDirectory>$(RepoRoot)/src</SrcDirectory>
<ExeSuffix Condition=" '$(OSName)' == 'win' ">.exe</ExeSuffix>
<ExeSuffix Condition=" '$(OSName)' != 'win' "></ExeSuffix>
<DynamicLibPrefix Condition=" '$(OSName)' == 'win' "></DynamicLibPrefix>
<DynamicLibPrefix Condition=" '$(OSName)' != 'win' ">lib</DynamicLibPrefix>
<DynamicLibSuffix Condition=" '$(OSName)' == 'win' ">.dll</DynamicLibSuffix>
<DynamicLibSuffix Condition=" '$(OSName)' == 'osx' ">.dylib</DynamicLibSuffix>
<DynamicLibSuffix Condition=" '$(DynamicLibSuffix)' == '' ">.so</DynamicLibSuffix>
<DotnetHostBaseName>dotnet$(ExeSuffix)</DotnetHostBaseName>
<DotnetHostFxrBaseName>$(DynamicLibPrefix)hostfxr$(DynamicLibSuffix)</DotnetHostFxrBaseName>
<HostPolicyBaseName>$(DynamicLibPrefix)hostpolicy$(DynamicLibSuffix)</HostPolicyBaseName>
<StageDirectory>%(Stage.StageDirectory)</StageDirectory>
<StageSymbolsDirectory>%(Stage.StageSymbolsDirectory)</StageSymbolsDirectory>
<SdkOutputDirectory>$(StageDirectory)/sdk/$(NugetVersion)</SdkOutputDirectory>
<BinaryToCorehostifyRelDir>runtimes/any/native</BinaryToCorehostifyRelDir>
<BinaryToCorehostifyOutDir>$(SdkOutputDirectory)/$(BinaryToCorehostifyRelDir)</BinaryToCorehostifyOutDir>
@ -57,6 +65,10 @@
</PropertyGroup>
<ItemGroup>
<BinObj Include="$(SrcDirectory)/**/bin/**/*" />
<BinObj Include="$(SrcDirectory)/**/obj/**/*" />
<FilesToRemoveFromStageDirectory Include="$(StageDirectory)/**/*" />
<SharedFramework Include="$(IntermediateDirectory)/sharedFrameworkPublish/**/*.*" />
<BinariesToRemove Include="csc" />
@ -69,12 +81,22 @@
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.tasks" />
</ItemGroup>
<SharedFrameworkNameVersionPath RootOutputDirectory="$(StageDirectory)">
<Output TaskParameter="OutputSharedFrameworkNameVersionPath" PropertyName="SharedFrameworkNameVersionPath" />
</SharedFrameworkNameVersionPath>
<Delete Files="@(BinObj)" />
<Delete Files="@(FilesToRemoveFromStageDirectory)" />
<RemoveDir Directories="$(StageDirectory)" />
<MakeDir Directories="$(StageDirectory)"/>
<!-- CopySharedFramework -->
<Copy SourceFiles="@(SharedFramework)"
DestinationFiles="@(SharedFramework->'$(StageDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Publish DotNet -->
<Exec Command="$(DotnetExe) publish
<Exec Command="%(Stage.DotnetExe) publish
--native-subdirectory
--output $(SdkOutputDirectory)
--configuration $(Configuration)
@ -84,7 +106,7 @@
<!-- Corehostify Binaries -->
<FixModeFlags Dir="$(SdkOutputDirectory)" />
<Exec Command="$(DotnetExe) publish
<Exec Command="%(Stage.DotnetExe) publish
--output $(SdkOutputDirectory)
--framework netcoreapp1.0
$(SrcDirectory)/compilers" />
@ -138,46 +160,13 @@
<Copy SourceFiles="@(MSBuildTargetsToCopy)"
DestinationFiles="@(MSBuildTargetsToCopy->'$(SdkOutputDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="BeforeCompileStage">
<PropertyGroup>
<SrcDirectory>$(RepoRoot)/src</SrcDirectory>
<ExeSuffix Condition=" '$(OSName)' == 'win' ">.exe</ExeSuffix>
<ExeSuffix Condition=" '$(OSName)' != 'win' "></ExeSuffix>
<DynamicLibPrefix Condition=" '$(OSName)' == 'win' "></DynamicLibPrefix>
<DynamicLibPrefix Condition=" '$(OSName)' != 'win' ">lib</DynamicLibPrefix>
<DynamicLibSuffix Condition=" '$(OSName)' == 'win' ">.dll</DynamicLibSuffix>
<DynamicLibSuffix Condition=" '$(OSName)' == 'osx' ">.dylib</DynamicLibSuffix>
<DynamicLibSuffix Condition=" '$(DynamicLibSuffix)' == '' ">.so</DynamicLibSuffix>
<DotnetHostBaseName>dotnet$(ExeSuffix)</DotnetHostBaseName>
<DotnetHostFxrBaseName>$(DynamicLibPrefix)hostfxr$(DynamicLibSuffix)</DotnetHostFxrBaseName>
<HostPolicyBaseName>$(DynamicLibPrefix)hostpolicy$(DynamicLibSuffix)</HostPolicyBaseName>
</PropertyGroup>
<ItemGroup>
<BinObj Include="$(SrcDirectory)/**/bin/**/*" />
<BinObj Include="$(SrcDirectory)/**/obj/**/*" />
<FilesToRemoveFromStageDirectory Include="$(StageDirectory)/**/*" />
</ItemGroup>
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
</ItemGroup>
<SharedFrameworkNameVersionPath RootOutputDirectory="$(StageDirectory)">
<Output TaskParameter="OutputSharedFrameworkNameVersionPath" PropertyName="SharedFrameworkNameVersionPath" />
</SharedFrameworkNameVersionPath>
<Delete Files="@(FilesToClean)" />
<Delete Files="@(BinObj)" />
<Delete Files="@(FilesToRemoveFromStageDirectory)" />
<RemoveDir Directories="$(StageDirectory)" />
<MakeDir Directories="$(StageDirectory)"/>
</Target>
<Target Name="AfterCompileStage"
DependsOnTargets="RemoveUnnecessaryFiles">
<ItemGroup>
<FilesToCopy Include="$(StageDirectory)/**/*.*" />
<PdbsToClean Include="$(StageDirectory)/sdk/**/*.pdb" />
@ -188,12 +177,4 @@
<Delete Files="@(PdbsToClean)" />
</Target>
<Target Name="RemoveUnnecessaryFiles">
<ItemGroup>
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
</ItemGroup>
<Delete Files="@(FilesToClean)" />
</Target>
</Project>

View file

@ -25,7 +25,7 @@
<Stage0Path Condition=" '$(OSName)' == 'osx' ">$(RepoRoot)/.dotnet_stage0/Darwin</Stage0Path>
<Stage0Path Condition=" '$(Stage0Path)' == '' ">$(RepoRoot)/.dotnet_stage0/Linux</Stage0Path>
<DotNetPath>$(Stage0Path)</DotNetPath>
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
<ToolsOutputDirectory>$(BaseOutputDirectory)/tools</ToolsOutputDirectory>
<Stage1Directory>$(BaseOutputDirectory)/stage1</Stage1Directory>