Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Microsoft.NETCore.Native.Publish.targets « BuildIntegration « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bf6c643daa3c0e17aac2765514334cef6be4b864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <IlcBuildTasksPath Condition="'$(IlcBuildTasksPath)' == ''">$(MSBuildThisFileDirectory)..\tools\ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
    
    <!--
      Prevent dotnet CLI from deploying the CoreCLR shim executable since we produce
      a native executable.
    -->
    <DeployAppHost>false</DeployAppHost>
  </PropertyGroup>

  <Target Name="_ComputeIlcCompileInputs"
          BeforeTargets="ComputeIlcCompileInputs"
          DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
    <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="$(IlcBuildTasksPath)" />
  <Target Name="_ComputeAssembliesToCompileToNative" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">

    <!-- Fail with descriptive error message for common mistake. -->
    <Error Condition="'$(RuntimeIdentifier)' == ''" Text="RuntimeIdentifier is required for native compilation. Try running dotnet publish with the -r option value specified." />

    <!-- Fail with descriptive error message for common unsupported case. -->
    <Error Condition="'$(OS)' == 'Windows_NT' and !$(RuntimeIdentifier.StartsWith('win'))" Text="Cross-compilation is not supported yet. https://github.com/dotnet/corert/issues/5458" />
    <Error Condition="'$(OS)' != 'Windows_NT' and $(RuntimeIdentifier.StartsWith('win'))" Text="Cross-compilation is not supported yet. https://github.com/dotnet/corert/issues/5458" />

    <!-- CoreRT SDK and Framework Assemblies need to be defined to avoid CoreCLR implementations being set as compiler inputs -->  
    <Error Condition="'@(PrivateSdkAssemblies)' == ''" Text="The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
    <Error Condition="'@(FrameworkAssemblies)' == ''" Text="The FrameworkAssemblies ItemGroup is required for _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>

  <Target Name="CopyNativePdb" Condition="'$(DebugType)' != 'None' and '$(TargetOS)' == 'Windows_NT'" AfterTargets="Publish">
    <!-- dotnet CLI produces managed debug symbols - substitute with those we generated during native compilation -->
    <Delete Files="$(PublishDir)\$(TargetName).pdb"/>    
    <Copy SourceFiles="$(NativeOutputPath)$(TargetName).pdb" DestinationFolder="$(PublishDir)" />  
  </Target>

</Project>