-
Notifications
You must be signed in to change notification settings - Fork 347
/
SourceBuildArcade.targets
104 lines (81 loc) · 7.24 KB
/
SourceBuildArcade.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!-- Repo extensibility point. -->
<Import Project="$(RepositoryEngineeringDir)SourceBuild.props" Condition="Exists('$(RepositoryEngineeringDir)SourceBuild.props')" />
<PropertyGroup>
<SourceBuildOutputDir Condition="'$(SourceBuildOutputDir)' == ''">$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'source-build'))</SourceBuildOutputDir>
<SourceBuildSelfDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildOutputDir)', 'self'))</SourceBuildSelfDir>
<CurrentRepoSourceBuildSourceDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildSelfDir)', 'src'))</CurrentRepoSourceBuildSourceDir>
<CurrentRepoSourceBuildPackageCache>$([MSBuild]::NormalizeDirectory('$(SourceBuildSelfDir)', 'package-cache'))</CurrentRepoSourceBuildPackageCache>
<SourceBuildSelfPrebuiltReportDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildSelfDir)', 'prebuilt-report'))</SourceBuildSelfPrebuiltReportDir>
<!--
Keep artifacts/ inside source dir so that ancestor-based file lookups find the inner repo, not
the outer repo. The inner repo global.json and NuGet.config files may have been modified by
source-build, and we want projects inside the artifacts/ dir to respect that.
-->
<CurrentRepoSourceBuildArtifactsDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildSourceDir)', 'artifacts'))</CurrentRepoSourceBuildArtifactsDir>
<CurrentRepoSourceBuildArtifactsPackagesDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildArtifactsDir)', 'packages', '$(Configuration)'))</CurrentRepoSourceBuildArtifactsPackagesDir>
<CurrentRepoSourceBuiltNupkgCacheDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildArtifactsDir)', 'obj', 'source-built-upstream-cache'))</CurrentRepoSourceBuiltNupkgCacheDir>
<PrebuiltBaselineDataFileDefault>$(RepositoryEngineeringDir)SourceBuildPrebuiltBaseline.xml</PrebuiltBaselineDataFileDefault>
<PrebuiltBaselineDataFile Condition="Exists('$(PrebuiltBaselineDataFileDefault)')">$(PrebuiltBaselineDataFileDefault)</PrebuiltBaselineDataFile>
<!-- By default, use the license file from the root of the repo for the intermediate nupkg. -->
<DetectSourceBuildIntermediateNupkgLicense Condition="'$(DetectSourceBuildIntermediateNupkgLicense)' == ''">true</DetectSourceBuildIntermediateNupkgLicense>
<EnableDefaultSourceBuildIntermediateItems Condition="'$(EnableDefaultSourceBuildIntermediateItems)' == ''">true</EnableDefaultSourceBuildIntermediateItems>
<!--
This is fed into the inner source build as an environment variable (DotNetTargetFrameworkFilter) to enable filtering.
The default target framework filter includes all recent netcoreapps in SBRP, as well as 8.0 (latest) and 7.0 (working to get rid of it.
TFM filtering is enabled by default and can be disabled, at repo level, by setting NoTargetFrameworkFiltering property to true,
in repo's root Directory.Build.props file.
-->
<_DefaultNetFrameworkFilter>netstandard2.0%3bnetstandard2.1%3bnetcoreapp2.1%3bnetcoreapp3.1%3bnet5.0%3bnet6.0%3bnet7.0%3bnet8.0</_DefaultNetFrameworkFilter>
<SourceBuildTargetFrameworkFilter Condition="'$(SourceBuildTargetFrameworkFilter)' == ''">$(_DefaultNetFrameworkFilter)</SourceBuildTargetFrameworkFilter>
</PropertyGroup>
<Target Name="GetSourceBuildIntermediateNupkgNameConvention">
<PropertyGroup>
<HostArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</HostArchitecture>
<SourceBuildTargetArchitecture Condition="'$(SourceBuildTargetArchitecture)' == ''">$(HostArchitecture)</SourceBuildTargetArchitecture>
<SourceBuildTargetPortableOSPlatform Condition="$([MSBuild]::IsOSPlatform('windows'))">win</SourceBuildTargetPortableOSPlatform>
<SourceBuildTargetPortableOSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx</SourceBuildTargetPortableOSPlatform>
<SourceBuildTargetPortableOSPlatform Condition="$([MSBuild]::IsOSPlatform('linux'))">linux</SourceBuildTargetPortableOSPlatform>
<SourceBuildTargetPortableOSPlatform Condition="'$(SourceBuildTargetPortableOSPlatform)'==''">linux</SourceBuildTargetPortableOSPlatform>
<PortableRid>$(SourceBuildTargetPortableOSPlatform)-$(SourceBuildTargetArchitecture)</PortableRid>
<TargetRid Condition="'$(SourceBuildNonPortable)' == 'true' and '$(TargetRid)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
<!-- Default to building for the portable OS platform with host machine architecture. -->
<TargetRid Condition="'$(TargetRid)' == ''">$(PortableRid)</TargetRid>
<SourceBuildIntermediateNupkgRid Condition="'$(SourceBuildIntermediateNupkgRid)' == ''">$(PortableRid)</SourceBuildIntermediateNupkgRid>
<SourceBuildIntermediateNupkgPrefix>Microsoft.SourceBuild.Intermediate.</SourceBuildIntermediateNupkgPrefix>
<SourceBuildIntermediateNupkgSuffix Condition="'$(SourceBuildManagedOnly)' != 'true'">.$(SourceBuildIntermediateNupkgRid)</SourceBuildIntermediateNupkgSuffix>
</PropertyGroup>
</Target>
<!--
Get the list of nupkg contents, categorized into supplemental categories if necessary. By
default, all non-symbol-package nupkg files and tar.gz files in
'artifacts/packages/{configuration}' are packed in the intermediate nupkg.
To configure this, add a target to eng/SourceBuild.props with
'BeforeTargets="GetCategorizedIntermediateNupkgContents"' that sets up
'IntermediateNupkgArtifactFile' items with optional 'Category' metadata.
When 'Category' is set, this tooling produces one supplemental intermediate nupkg per named
category. All files not in a category are put into the "main" intermediate nupkg.
-->
<Target Name="GetCategorizedIntermediateNupkgContents">
<ItemGroup Condition="'$(EnableDefaultSourceBuildIntermediateItems)' == 'true'">
<!-- Catch-all: anything not in a category gets packed in the 'main' intermediate nupkg. -->
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.nupkg" />
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.tar.gz" />
<!-- Don't pack any symbol packages: not needed for downstream source-build CI. -->
<IntermediateNupkgArtifactFile Remove="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.symbols.nupkg" />
</ItemGroup>
<ItemGroup>
<IntermediateNupkgFile Include="@(IntermediateNupkgArtifactFile)" PackagePath="artifacts" />
<!-- Report goes into the 'main' intermediate nupkg. -->
<IntermediateNupkgFile Include="$(SourceBuildSelfPrebuiltReportDir)**\*" PackagePath="prebuilt-report" />
</ItemGroup>
<RemoveDuplicates Inputs="@(IntermediateNupkgFile)">
<Output TaskParameter="Filtered" ItemName="IntermediatePackageFile" />
</RemoveDuplicates>
<ItemGroup>
<IntermediateNonShippingNupkgFile Include="@(IntermediatePackageFile)" Condition="$([System.Text.RegularExpressions.Regex]::Match(%(Identity),'[\\\\/]NonShipping[\\\\/]').Success)"/>
<SupplementalIntermediateNupkgCategory Include="%(IntermediatePackageFile.Category)" />
</ItemGroup>
</Target>
</Project>