forked from dotnet/iot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.targets
72 lines (63 loc) · 3.07 KB
/
Directory.Build.targets
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
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<!-- Crosstargeting for RIDs -->
<PropertyGroup Condition="'$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' == ''">
<IsCrossTargetingRIDs>true</IsCrossTargetingRIDs>
</PropertyGroup>
<Choose>
<When Condition="'$(IsCrossTargetingRIDs)' == 'true'">
<PropertyGroup>
<CrossTargetingRIDTargetsPath>$(MSBuildThisFileDirectory)eng\CrosstargetingRIDs.targets</CrossTargetingRIDTargetsPath>
</PropertyGroup>
</When>
</Choose>
<Import Project="$(CrossTargetingRIDTargetsPath)" Condition="Exists('$(CrossTargetingRIDTargetsPath)')" />
<!-- Packaging Targets -->
<PropertyGroup>
<IncludeRIDSpecificBuildOutput Condition="'$(IncludeRIDSpecificBuildOutput)' == '' And '$(RuntimeIdentifiers)' != ''">true</IncludeRIDSpecificBuildOutput>
<TargetsForTfmSpecificContentInPackage Condition="'$(IncludeRIDSpecificBuildOutput)' == 'true'">$(TargetsForTfmSpecificContentInPackage);_WalkEachRIDForBuildOutput;_GetReferenceAssemblyForPackage;_GetNativeAssetsForPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<ItemGroup>
<_RuntimeIdentifiers Include="$(RuntimeIdentifiers)" />
</ItemGroup>
<Target Name="_WalkEachRIDForBuildOutput">
<MSBuild
Condition="'$(IncludeRIDSpecificBuildOutput)' == 'true'"
Projects="$(MSBuildProjectFullPath)"
Targets="_GetBuildOutputWithRID"
Properties="RuntimeIdentifier=%(_RuntimeIdentifiers.Identity)">
<Output
TaskParameter="TargetOutputs"
ItemName="TfmSpecificPackageFile" />
</MSBuild>
</Target>
<Target Name="_GetReferenceAssemblyForPackage">
<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetRefPath)">
<PackagePath>ref/$(TargetFramework)</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
<Target Name="_GetNativeAssetsForPackage">
<ItemGroup>
<_nativeAssetsToPackage Include="$(BaseOutputPath)../Native/Release/*.so" />
<TfmSpecificPackageFile Include="@(_nativeAssetsToPackage)">
<!-- For now, we are only building native assets for linux-arm so we can hardcode the package path.
Once we start producing arm64 native assets then we will have to change this so it is not hardcoded
and instead is calculated depending on where the assets are located. -->
<PackagePath>runtimes/linux-arm/native/</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
<!-- During CI or an official build, we should fail if there where no native assets to package -->
<Error Condition="'$(ContinuousIntegrationBuild)' == 'true' And '@(_nativeAssetsToPackage)' == ''"
Text="Unable to find native assets to include in the package" />
</Target>
<Target Name="_GetBuildOutputWithRID" Returns="@(RIDSpecificPackageFile)">
<ItemGroup>
<RIDSpecificPackageFile Include="$(TargetPath)">
<PackagePath>runtimes/$(RuntimeIdentifier)/lib/$(TargetFramework)</PackagePath>
</RIDSpecificPackageFile>
</ItemGroup>
</Target>
</Project>