76728be4cb
CompileTargets moved to MSBuild. Still need to work on input/outputs, refactoring of targets, specially around CompileStage and moving some of the tasks back to msbuild instead of C# code.
189 lines
No EOL
8.7 KiB
XML
189 lines
No EOL
8.7 KiB
XML
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<Import Project="compile/Microsoft.DotNet.Cli.Archive.targets" />
|
|
|
|
<UsingTask TaskName="FixModeFlags" AssemblyFile="$(CLIBuildDll)" />
|
|
<UsingTask TaskName="ChangeEntryPointLibraryName" AssemblyFile="$(CLIBuildDll)" />
|
|
<UsingTask TaskName="RemoveAssetFromDepsPackages" AssemblyFile="$(CLIBuildDll)" />
|
|
<UsingTask TaskName="CleanPublishOutput" AssemblyFile="$(CLIBuildDll)" />
|
|
<UsingTask TaskName="SharedFrameworkNameVersionPath" AssemblyFile="$(CLIBuildDll)" />
|
|
<UsingTask TaskName="CrossgenDirectory" AssemblyFile="$(CLIBuildDll)" />
|
|
|
|
<Target Name="Compile" DependsOnTargets="BuildDotnetCliBuildFramework;
|
|
CompileStage1;
|
|
CompileStage2">
|
|
</Target>
|
|
|
|
<Target Name="CompileStage1"
|
|
DependsOnTargets="Init;
|
|
SetupStage1;
|
|
CompileStage;
|
|
AfterCompileStage">
|
|
</Target>
|
|
|
|
<Target Name="SetupStage1">
|
|
<PropertyGroup>
|
|
<StageDirectory>$(Stage1Directory)</StageDirectory>
|
|
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
|
|
<DotnetExe>$(Stage0Path)/dotnet.exe</DotnetExe>
|
|
</PropertyGroup>
|
|
</Target>
|
|
|
|
<Target Name="CompileStage2"
|
|
DependsOnTargets="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">
|
|
<PropertyGroup>
|
|
<SdkOutputDirectory>$(StageDirectory)/sdk/$(NugetVersion)</SdkOutputDirectory>
|
|
<BinaryToCorehostifyRelDir>runtimes/any/native</BinaryToCorehostifyRelDir>
|
|
<BinaryToCorehostifyOutDir>$(SdkOutputDirectory)/$(BinaryToCorehostifyRelDir)</BinaryToCorehostifyOutDir>
|
|
<MSBuildTargetsDirectory>$(SdkOutputDirectory)/runtimes/any/native</MSBuildTargetsDirectory>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<SharedFramework Include="$(IntermediateDirectory)/sharedFrameworkPublish/**/*.*" />
|
|
|
|
<BinariesToRemove Include="csc" />
|
|
<BinariesToRemove Include="vbc" />
|
|
|
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.targets" />
|
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.Targets" />
|
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.props" />
|
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.overridetasks" />
|
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.tasks" />
|
|
</ItemGroup>
|
|
|
|
<!-- CopySharedFramework -->
|
|
<Copy SourceFiles="@(SharedFramework)"
|
|
DestinationFiles="@(SharedFramework->'$(StageDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
|
|
|
<!-- Publish DotNet -->
|
|
<Exec Command="$(DotnetExe) publish
|
|
--native-subdirectory
|
|
--output $(SdkOutputDirectory)
|
|
--configuration $(Configuration)
|
|
--version-suffix $(CommitCount)
|
|
$(SrcDirectory)/dotnet" />
|
|
|
|
<!-- Corehostify Binaries -->
|
|
<FixModeFlags Dir="$(SdkOutputDirectory)" />
|
|
|
|
<Exec Command="$(DotnetExe) publish
|
|
--output $(SdkOutputDirectory)
|
|
--framework netcoreapp1.0
|
|
$(SrcDirectory)/compilers" />
|
|
|
|
<Copy SourceFiles="$(BinaryToCorehostifyOutDir)/csc.exe"
|
|
DestinationFiles="$(SdkOutputDirectory)/csc.dll" />
|
|
|
|
<Move SourceFiles="$(BinaryToCorehostifyOutDir)/csc.exe"
|
|
DestinationFiles="$(SdkOutputDirectory)/csc.exe" />
|
|
|
|
<Copy SourceFiles="$(SdkOutputDirectory)/compilers.deps.json"
|
|
DestinationFiles="$(SdkOutputDirectory)/csc.deps.json" />
|
|
|
|
<Copy SourceFiles="$(SdkOutputDirectory)/compilers.runtimeconfig.json"
|
|
DestinationFiles="$(SdkOutputDirectory)/csc.runtimeconfig.json" />
|
|
|
|
<ChangeEntryPointLibraryName
|
|
DepsFile="$(SdkOutputDirectory)/csc.deps.json"
|
|
NewName="csc.deps.json" />
|
|
|
|
<RemoveAssetFromDepsPackages DepsFile="$(BinaryToCorehostifyRelDir)/csc.deps.json"
|
|
SectionName="runtimeTargets"
|
|
AssetPath="$(BinaryToCorehostifyRelDir)/%(BinariesToRemove.Identity).exe" />
|
|
<RemoveAssetFromDepsPackages DepsFile="$(SdkOutputDirectory)/dotnet.deps.json"
|
|
SectionName="runtimeTargets"
|
|
AssetPath="$(BinaryToCorehostifyRelDir)/%(BinariesToRemove.Identity).exe" />
|
|
|
|
<!-- cleanup compilers project output we don't need -->
|
|
<CleanPublishOutput Path="$(SdkOutputDirectory)"
|
|
Name="compilers"
|
|
DeleteRuntimeConfigJson="true"
|
|
DeleteDepsJson="true" />
|
|
|
|
<!-- Copy Host to SDK Directory -->
|
|
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(DotnetHostBaseName)"
|
|
DestinationFiles="$(SdkOutputDirectory)/corehost$(ExeSuffix)" />
|
|
|
|
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(DotnetHostFxrBaseName)"
|
|
DestinationFiles="$(SdkOutputDirectory)/$(DotnetHostFxrBaseName)" />
|
|
|
|
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(HostPolicyBaseName)"
|
|
DestinationFiles="$(SdkOutputDirectory)/$(HostPolicyBaseName)" />
|
|
|
|
<CrossgenDirectory SharedFrameworkNameVersionPath="$(SharedFrameworkNameVersionPath)"
|
|
SdkOutputDirectory="$(SdkOutputDirectory)" />
|
|
|
|
<!-- Generate .version file -->
|
|
<WriteLinesToFile File="$(SdkOutputDirectory)/.version"
|
|
Lines="$(CommitHash)$(NewLine)$(NugetVersion)$(NewLine)"
|
|
Overwrite="true" />
|
|
|
|
<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/**/*" />
|
|
</ItemGroup>
|
|
|
|
<SharedFrameworkNameVersionPath RootOutputDirectory="$(StageDirectory)">
|
|
<Output TaskParameter="OutputSharedFrameworkNameVersionPath" PropertyName="SharedFrameworkNameVersionPath" />
|
|
</SharedFrameworkNameVersionPath>
|
|
|
|
<Delete Files="@(BinObj)" />
|
|
|
|
<RemoveDir Directories="$(StageDirectory)" />
|
|
<MakeDir Directories="$(StageDirectory)"/>
|
|
</Target>
|
|
|
|
<Target Name="AfterCompileStage">
|
|
<ItemGroup>
|
|
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
|
|
<FilesToCopy Include="$(StageDirectory)/**/*.*" />
|
|
<PdbsToClean Include="$(StageDirectory)/sdk/**/*.pdb" />
|
|
</ItemGroup>
|
|
|
|
<Delete Files="@(FilesToClean)" />
|
|
|
|
<Copy SourceFiles="@(FilesToCopy)"
|
|
DestinationFiles="@(FilesToCopy->'$(StageSymbolsDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
|
|
|
<Delete Files="@(PdbsToClean)" />
|
|
</Target>
|
|
</Project> |