diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-11-09 03:20:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-09 03:20:39 +0300 |
commit | 162cead08753e6440d7e90ec4fb453a1a651785a (patch) | |
tree | dbb0478e51bd5b376386e6d0a38df7037fe51526 /src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets | |
parent | 2bc2edc1e2b1b0e835366668b53ccfc48ece0949 (diff) | |
parent | 0566d28cd25fb5a8b708b94dd9ba7960a75e3b07 (diff) |
Merge pull request #4894 from dotnet/master
Merge master to nmirror
Diffstat (limited to 'src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets')
-rw-r--r-- | src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets b/src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets new file mode 100644 index 000000000..755aa647f --- /dev/null +++ b/src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets @@ -0,0 +1,61 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + + <PropertyGroup> + <BuildTasksPath Condition="'$(BuildTasksPath)' == ''">$(MSBuildThisFileDirectory)..\tools\ILCompiler.Build.Tasks.dll</BuildTasksPath> + + <!-- + Prevent dotnet CLI from deploying the CoreCLR shim executable since we produce + a native executable. + --> + <DeployAppHost>false</DeployAppHost> + </PropertyGroup> + + <Target Name="_ComputeIlcCompileInputs" + BeforeTargets="ComputeIlcCompileInputs"> + <ItemGroup> + <IlcReference Include="@(_ManagedResolvedAssembliesToPublish)" /> + </ItemGroup> + </Target> + + <!-- + This target hooks into the dotnet CLI publish pipeline. That pipeline has + a target called ComputeFilesToPublish which produces the ItemGroup + ResolvedFileToPublish based on the inputs of @(IntermediateAssembly) + and @(ResolvedAssembliesToPublish). We modify those two item groups + to control what gets published after CoreRT optimizes the application. + --> + <Target Name="ComputeLinkedFilesToPublish" + BeforeTargets="ComputeFilesToPublish" + DependsOnTargets="_ComputeAssembliesToCompileToNative;LinkNative"> + + <ItemGroup> + <ResolvedAssembliesToPublish Remove="@(_AssembliesToSkipPublish)" /> + <ResolvedAssembliesToPublish Include="@(_LinkedResolvedAssemblies)" /> + </ItemGroup> + + <ItemGroup> + <_NativeIntermediateAssembly Include="@(IntermediateAssembly->'$(NativeOutputPath)%(Filename)$(NativeBinaryExt)')" /> + <IntermediateAssembly Remove="@(IntermediateAssembly)" /> + <IntermediateAssembly Include="@(_NativeIntermediateAssembly)" /> + </ItemGroup> + </Target> + + <!-- + Filter the input publish file list selecting managed assemblies for compilation. + Also produces _AssembliesToSkipPublish which chops out things from the publish + pipeline we don't want to see in the output (native images, CoreCLR artifacts) + until we get a proper AOT NetCore app package. + --> + <UsingTask TaskName="ComputeManagedAssemblies" AssemblyFile="$(BuildTasksPath)" /> + <Target Name="_ComputeAssembliesToCompileToNative"> + + <ComputeManagedAssemblies Assemblies="@(ResolvedAssembliesToPublish)" + DotNetAppHostExecutableName="$(_DotNetAppHostExecutableName)" DotNetHostFxrLibraryName="$(_DotNetHostFxrLibraryName)" DotNetHostPolicyLibraryName="$(_DotNetHostPolicyLibraryName)" + SdkAssemblies="@(PrivateSdkAssemblies)" FrameworkAssemblies="@(FrameworkAssemblies)"> + <Output TaskParameter="ManagedAssemblies" ItemName="_ManagedResolvedAssembliesToPublish" /> + <Output TaskParameter="AssembliesToSkipPublish" ItemName="_AssembliesToSkipPublish" /> + </ComputeManagedAssemblies> + + </Target> + +</Project> |