dotnet-installer/build/Compile.targets
Piotr Puszkiewicz 5d193e8b39 Merge conflicts
2017-02-27 17:13:13 -08:00

179 lines
7.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="compile/LzmaArchive.targets" />
<PropertyGroup>
<RuntimeNETCoreAppPackageName>runtime.$(CoreCLRRid).microsoft.netcore.app</RuntimeNETCoreAppPackageName>
<CrossgenPath>$(NuGetPackagesDir)/$(RuntimeNETCoreAppPackageName)/$(CLI_SharedFrameworkVersion)/tools/crossgen$(ExeExtension)</CrossgenPath>
<LibCLRJitPath>$(NuGetPackagesDir)/$(RuntimeNETCoreAppPackageName)/$(CLI_SharedFrameworkVersion)/runtimes/$(CoreCLRRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension)</LibCLRJitPath>
<SharedFrameworkNameVersionPath>$(StageDirectory)/shared/$(SharedFrameworkName)/$(SharedFrameworkVersion)</SharedFrameworkNameVersionPath>
</PropertyGroup>
<ItemGroup>
<PublishOutputExtensions Include="$(ExeExtension);.dll;.pdb;.deps.json;.runtimeconfig.json" />
</ItemGroup>
<Target Name="Compile" DependsOnTargets="Prepare;
CompileCLI;
PublishSdks;
PublishTemplates;
BuildProjectsForNuGetPackages;
GetNuGetPackagesArchive;" />
<Target Name="CompileCLI">
<RemoveDir Directories="$(OutputDirectory)" />
<MakeDir Directories="$(OutputDirectory)"/>
<!-- Publish DotNet -->
<DotNetPublish ToolPath="$(Stage0Directory)"
Configuration="$(Configuration)"
ProjectPath="$(RootProject)" />
<!-- Publish Roslyn -->
<DotNetPublish ToolPath="$(Stage0Directory)"
Configuration="$(Configuration)"
ProjectPath="$(SrcDirectory)/tool_roslyn/tool_roslyn.csproj" />
<!-- copy core sdk -->
<Copy SourceFiles="@(MSBuildImportsContent)"
DestinationFolder="$(SdkOutputDirectory)/%(RecursiveDir)" />
<ItemGroup>
<NETCore10Assemblies Include="$(SdkOutputDirectory)/System.ComponentModel.Primitives.dll;
$(SdkOutputDirectory)/System.Collections.Specialized.dll;
$(SdkOutputDirectory)/System.Collections.NonGeneric.dll;
$(SdkOutputDirectory)/System.Private.DataContractSerialization.dll" />
</ItemGroup>
<!-- Move these "1.0" assemblies that TestPlatform lays down out of the way so crossgen doesn't pick them up.
We need https://github.com/dotnet/cli/issues/5464 fixed, so test platform is in a separate directory -->
<Move SourceFiles="@(NETCore10Assemblies)"
DestinationFiles="@(NETCore10Assemblies->'$(SdkOutputDirectory)/%(Filename)%(Extension).bak')" />
<!-- Crossgen the CLI -->
<ItemGroup>
<SdkFiles Remove="*" />
<!-- Removing Full CLR built TestHost assemblies from getting Crossgen as it is throwing error -->
<SdkFilesExclude Include="$(SdkOutputDirectory)/TestHost*/**/*" />
<SdkFiles Include="$(SdkOutputDirectory)/**/*" Exclude="@(SdkFilesExclude)" />
<SdkFilesWithPEMarker Remove="*" />
</ItemGroup>
<AddMetadataIsPE Items="@(SdkFiles)">
<Output TaskParameter="ResultItems" ItemName="SdkFilesWithPEMarker" />
</AddMetadataIsPE>
<ItemGroup>
<CrossgenTargets Remove="*" />
<CrossgenTargets Include="%(SdkFilesWithPEMarker.FullPath)" Condition=" '%(SdkFilesWithPEMarker.IsPE)' == 'True' " />
<CompileStageSdkDirectories Remove="*" />
</ItemGroup>
<RemoveDuplicates Inputs="@(SdkFiles->'%(RootDir)%(Directory)')">
<Output TaskParameter="Filtered" ItemName="CompileStageSdkDirectories" />
</RemoveDuplicates>
<!-- Ensure crossgen tool is executable. See https://github.com/NuGet/Home/issues/4424 -->
<Chmod Condition=" '$(OSName)' != 'win' And '$(DISABLE_CROSSGEN)' != '1' "
File="$(CrossgenPath)"
Mode="u+x" />
<Crossgen Condition=" '$(DISABLE_CROSSGEN)' != '1' "
SourceAssembly="%(CrossgenTargets.FullPath)"
DestinationPath="%(CrossgenTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);
@(CompileStageSdkDirectories);
$(SharedFrameworkNameVersionPath)" />
<!-- Corehostify Binaries -->
<ItemGroup Condition=" '$(OSName)' != 'win' ">
<SdkOutputChmodTargets Remove="*" />
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*.exe;
$(SdkOutputDirectory)/**/*.dll" >
<!-- Managed assemblies do not need execute -->
<Mode>u=rw,g=r,o=r</Mode>
</SdkOutputChmodTargets>
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*.dylib;
$(SdkOutputDirectory)/**/*.so" >
<!-- Generally, dylibs and sos have 'x' -->
<Mode>u=rwx,g=rx,o=rx</Mode>
</SdkOutputChmodTargets>
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*"
Exclude="$(SdkOutputDirectory)/**/*.*" >
<!-- Executables need x -->
<Mode>u=rwx,g=rx,o=rx</Mode>
</SdkOutputChmodTargets>
</ItemGroup>
<Chmod Condition=" '$(OSName)' != 'win' "
File="%(SdkOutputChModTargets.FullPath)"
Mode="%(SdkOutputChModTargets.Mode)" />
<!-- Move the "1.0" assemblies back -->
<Move SourceFiles="@(NETCore10Assemblies->'$(SdkOutputDirectory)/%(Filename)%(Extension).bak')"
DestinationFiles="@(NETCore10Assemblies)" />
<ItemGroup>
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
</ItemGroup>
<Delete Files="@(FilesToClean)" />
<ItemGroup>
<FilesToCopy Include="$(OutputDirectory)/**/*" />
<PdbsToClean Include="$(OutputDirectory)/sdk/**/*.pdb" />
</ItemGroup>
<Copy SourceFiles="@(FilesToCopy)"
DestinationFiles="@(FilesToCopy->'$(SymbolsDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Delete Files="@(PdbsToClean)" />
</Target>
<Target Name="PublishSdks"
DependsOnTargets="Prepare">
<ItemGroup>
<SdksToBundle Include="build/BundledSdks.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
NuGetPackagesDir=$(NuGetPackagesDir);
SdkLayoutDirectory=$(SdkOutputDirectory)/Sdks/%(BundledSdk.Identity);
SdkPackageName=%(BundledSdk.Identity);
SdkPackageVersion=%(BundledSdk.Version);
Stage0Directory=$(Stage0Directory)
</Properties>
</SdksToBundle>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(SdksToBundle)">
</MSBuild>
</Target>
<Target Name="PublishTemplates"
DependsOnTargets="Prepare">
<ItemGroup>
<TemplatesToBundle Include="build/BundledTemplates.proj">
<Properties>
TemplateLayoutDirectory=$(SdkOutputDirectory)/Templates;
TemplatePackageName=%(BundledTemplate.Identity);
TemplatePackageVersion=%(BundledTemplate.Version);
Stage0Directory=$(Stage0Directory)
</Properties>
</TemplatesToBundle>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(TemplatesToBundle)">
</MSBuild>
</Target>
</Project>