dotnet-installer/build/ComposeSdk.targets
2017-10-13 16:40:31 -07:00

116 lines
4.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(RepoRoot)/build/compile/LzmaArchive.targets" />
<PropertyGroup>
<PublishDir>$(SdkOutputDirectory)</PublishDir>
</PropertyGroup>
<Target Name="ComposeSdk" DependsOnTargets="Prepare;
PrepareOutputDirectory;
PublishSharedFramework;
PublishToolset;
PublishTemplates;
PublishAspNetRuntimePackageStore;
PublishLzmaArchive" />
<Target Name="PrepareOutputDirectory">
<RemoveDir Directories="$(OutputDirectory)" />
<MakeDir Directories="$(OutputDirectory)"/>
</Target>
<Target Name="PublishSharedFramework">
<ItemGroup>
<SharedFramework Remove="*" />
<SharedFramework Include="$(SharedFrameworkPublishDirectory)/**/*" />
</ItemGroup>
<Copy SourceFiles="@(SharedFramework)"
DestinationFiles="@(SharedFramework->'$(OutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishToolset">
<ItemGroup>
<Toolset Remove="*" />
<Toolset Include="$(ToolsetPublishDirectory)/**/*" />
</ItemGroup>
<Copy SourceFiles="@(Toolset)"
DestinationFiles="@(Toolset->'$(OutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="CrossgenPublishDir"
Condition=" '$(DISABLE_CROSSGEN)' == '' ">
<!-- Disabling crossgen until we have non-crossgened toolset -->
<!-- AfterTargets="PublishToolset"> -->
<ItemGroup>
<!-- Removing Full CLR built TestHost assemblies from getting Crossgen as it is throwing error -->
<SdkFiles Include="$(PublishDir)/**/*" Exclude="$(PublishDir)/TestHost*/**/*;$(PublishDir)/Sdks/**/*" />
<!-- Don't try to CrossGen .NET Framework support assemblies for .NET Standard -->
<SdkFiles Remove="$(PublishDir)/Microsoft\Microsoft.NET.Build.Extensions\net*\**\*" />
<!-- Don't try to CrossGen tasks and supporting DLLs compiled for .NET Framework -->
<SdkFiles Remove="$(PublishDir)/Microsoft\Microsoft.NET.Build.Extensions\tools\net*\**\*" />
</ItemGroup>
<AddMetadataIsPE Items="@(SdkFiles)">
<Output TaskParameter="ResultItems" ItemName="SdkFilesWithPEMarker" />
</AddMetadataIsPE>
<ItemGroup>
<CrossgenTargets Include="%(SdkFilesWithPEMarker.FullPath)" Condition=" '%(SdkFilesWithPEMarker.IsPE)' == 'True' " />
</ItemGroup>
<RemoveDuplicates Inputs="@(SdkFiles->'%(RootDir)%(Directory)')">
<Output TaskParameter="Filtered" ItemName="PublishDirSubDirectories" />
</RemoveDuplicates>
<!-- Ensure crossgen tool is executable. See https://github.com/NuGet/Home/issues/4424 -->
<Chmod Condition=" '$(OSName)' != 'win' "
Glob="$(CrossgenPath)"
Mode="u+x" />
<Crossgen SourceAssembly="%(CrossgenTargets.FullPath)"
DestinationPath="%(CrossgenTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);
@(PublishDirSubDirectories);
$(SharedFrameworkNameVersionPath)" />
</Target>
<Target Name="PublishTemplates">
<ItemGroup>
<TemplatesToBundle Include="$(RepoRoot)/build/BundledTemplates.proj">
<Properties>
TemplateLayoutDirectory=$(SdkOutputDirectory)/Templates;
TemplatePackageName=%(BundledTemplate.Identity);
TemplatePackageVersion=%(BundledTemplate.Version);
PreviousStageDirectory=$(PreviousStageDirectory)
</Properties>
</TemplatesToBundle>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(TemplatesToBundle)">
</MSBuild>
</Target>
<Target Name="PublishAspNetRuntimePackageStore">
<ItemGroup>
<AspNetRuntimePackageStore Remove="*" />
<AspNetRuntimePackageStore Include="$(AspNetRuntimePackageStorePublishDirectory)/**/*" />
</ItemGroup>
<Copy SourceFiles="@(AspNetRuntimePackageStore)"
DestinationFiles="@(AspNetRuntimePackageStore->'$(OutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="PublishLzmaArchive"
Condition="'$(CLIBUILD_SKIP_LZMA)' != 'true'"
DependsOnTargets="GetNuGetPackagesArchive">
</Target>
</Project>