forked from dotnet/core-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
233 lines (191 loc) · 15 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(RepositoryEngineeringDir)/DisableSourceControlManagement.targets" Condition="'$(EnableSourceLink)' == 'false'" />
<!-- Provide default targets which can be hooked onto or overridden as necessary -->
<Target Name="Pack" />
<UsingTask TaskName="GenerateGuidFromName" AssemblyFile="$(LocalBuildToolsTaskFile)" />
<UsingTask TaskName="GenerateMsiVersion" AssemblyFile="$(LocalBuildToolsTaskFile)" />
<UsingTask TaskName="GetTargetMachineInfo" AssemblyFile="$(LocalBuildToolsTaskFile)" />
<UsingTask TaskName="RegenerateReadmeTable" AssemblyFile="$(LocalBuildToolsTaskFile)" />
<PropertyGroup>
<!--
Define this here (not just in Versions.props) because the SDK resets it
unconditionally in Microsoft.NETCoreSdk.BundledVersions.props.
-->
<NETCoreAppMaximumVersion>$(MajorVersion).$(MinorVersion)</NETCoreAppMaximumVersion>
</PropertyGroup>
<!-- Common target to find all sfxproj. In a target to avoid evaluating for every project. -->
<Target Name="GetSharedFrameworkProjects">
<ItemGroup>
<SharedFrameworkProject Include="$(SourceDir)pkg\projects\**\*.sfxproj" />
</ItemGroup>
</Target>
<!--
Arcade SDK versioning is defined by static properties in a targets file: work around this by
moving properties based on versioning into a target.
-->
<Target Name="GetProductVersions">
<PropertyGroup>
<IncludePreReleaseLabelInPackageVersion Condition="'$(DotNetFinalVersionKind)' != 'release'">true</IncludePreReleaseLabelInPackageVersion>
<IncludeBuildNumberInPackageVersion Condition="'$(StabilizePackageVersion)' != 'true'">true</IncludeBuildNumberInPackageVersion>
<ProductVersionSuffix Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">-$(VersionSuffix)</ProductVersionSuffix>
<ProductBandVersion Condition="'$(ProductBandVersion)' == ''">$(MajorVersion).$(MinorVersion)</ProductBandVersion>
<ProductionVersion Condition="'$(ProductionVersion)' == ''">$(ProductBandVersion).$(PatchVersion)</ProductionVersion>
<ProductVersion>$(ProductionVersion)$(ProductVersionSuffix)</ProductVersion>
<SharedFrameworkNugetVersion>$(ProductVersion)</SharedFrameworkNugetVersion>
<RuntimeDepsRpmVersion Condition="'$(RuntimeDepsRpmVersion)'==''">$(ProductVersion)</RuntimeDepsRpmVersion>
<RuntimeDepsDebVersion Condition="'$(RuntimeDepsDebVersion)'==''">$(ProductVersion)</RuntimeDepsDebVersion>
<NuGetVersion>$(SharedFrameworkNugetVersion)</NuGetVersion>
<!--
By default, we are always building the nuget packages for HostPolicy, HostFXR and
Dotnet/AppHost. Thus, the "UseShipped*" properties (below) are always set to false.
However, there are scenarios when some of these components will not change (e.g. during
servicing, we may only change HostPolicy but not HostFXR and Dotnet/AppHost). In such cases,
set the appropriate "UseShipped*" property below to true and the corresponding "*Version"
property to the desired version so that we use the last shipped version of the package.
-->
<!-- The host/apphost package versions are only updated whenever there is a change in the components -->
<UseShippedHostPackage>false</UseShippedHostPackage>
<HostVersion Condition="'$(UseShippedHostPackage)' != 'true'">$(ProductVersion)</HostVersion>
<HostVersion Condition="'$(UseShippedHostPackage)' == 'true'">2.0.0</HostVersion>
<!-- The AppHostVersion is used for all hosts that aren't dotnet.exe -->
<UseShippedAppHostPackage>false</UseShippedAppHostPackage>
<AppHostVersion Condition="'$(UseShippedAppHostPackage)' != 'true'">$(ProductVersion)</AppHostVersion>
<AppHostVersion Condition="'$(UseShippedAppHostPackage)' == 'true'">2.0.0</AppHostVersion>
<!--
The FXR Resolver package version is only updated whenever there is a change in it.
If there is ever a need to use a shipped version of the package, then set the property
below to true.
-->
<UseShippedHostResolverPackage>false</UseShippedHostResolverPackage>
<HostResolverVersion Condition="'$(UseShippedHostResolverPackage)' != 'true'">$(ProductVersion)</HostResolverVersion>
<HostResolverVersion Condition="'$(UseShippedHostResolverPackage)' == 'true'">2.0.0</HostResolverVersion>
<!--
Host Policy package version is only updated whenever there is a change in it.
If there is ever a need to use a shipped version of the package, then set the property
below to true.
-->
<UseShippedHostPolicyPackage>false</UseShippedHostPolicyPackage>
<HostPolicyVersion Condition="'$(UseShippedHostPolicyPackage)' != 'true'">$(ProductVersion)</HostPolicyVersion>
<HostPolicyVersion Condition="'$(UseShippedHostPolicyPackage)' == 'true'">2.0.0</HostPolicyVersion>
<BinariesRelativePath>Runtime/$(SharedFrameworkNugetVersion)/</BinariesRelativePath>
<InstallersRelativePath>Runtime/$(SharedFrameworkNugetVersion)/</InstallersRelativePath>
</PropertyGroup>
<PropertyGroup Condition="'$(OutputRid)' != ''">
<ProductMoniker>$(SharedFrameworkNugetVersion)-$(PackageTargetRid)</ProductMoniker>
<HostResolverVersionMoniker>$(HostResolverVersion)-$(PackageTargetRid)</HostResolverVersionMoniker>
</PropertyGroup>
<PropertyGroup>
<HostPackageVersion>$(HostVersion)</HostPackageVersion>
<HostPackageRelease>1</HostPackageRelease>
<HostResolverPackageVersion>$(HostResolverVersion)</HostResolverPackageVersion>
<HostResolverPackageRelease>1</HostResolverPackageRelease>
<RuntimePackageVersion>$(SharedFrameworkNugetVersion)</RuntimePackageVersion>
<RuntimePackageRelease>1</RuntimePackageRelease>
<RuntimeDepsDebPackageVersion>$(RuntimeDepsDebVersion)</RuntimeDepsDebPackageVersion>
<RuntimeDepsDebPackageRelease>1</RuntimeDepsDebPackageRelease>
<RuntimeDepsRpmPackageVersion>$(RuntimeDepsRpmVersion)</RuntimeDepsRpmPackageVersion>
<RuntimeDepsRpmPackageRelease>1</RuntimeDepsRpmPackageRelease>
</PropertyGroup>
<PropertyGroup Condition="'$(InstallerExtension)' == '.deb'">
<HostPackageVersion Condition="'$(UseShippedHostPackage)' != 'true'">$(ProductionVersion)</HostPackageVersion>
<HostPackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true' AND '$(VersionSuffix)' !=''">$(ProductionVersion)~$(VersionSuffix)</HostPackageVersion>
<HostResolverPackageVersion Condition="'$(UseShippedHostResolverPackage)' != 'true'">$(ProductionVersion)</HostResolverPackageVersion>
<HostResolverPackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true' AND '$(VersionSuffix)' !=''">$(ProductionVersion)~$(VersionSuffix)</HostResolverPackageVersion>
<RuntimePackageVersion>$(ProductionVersion)</RuntimePackageVersion>
<RuntimePackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">$(ProductionVersion)~$(VersionSuffix)</RuntimePackageVersion>
<RuntimeDepsDebPackageVersion>$(ProductionVersion)</RuntimeDepsDebPackageVersion>
<RuntimeDepsDebPackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true' AND '$(VersionSuffix)' !=''">$(ProductionVersion)~$(VersionSuffix)</RuntimeDepsDebPackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(InstallerExtension)' == '.rpm'">
<HostPackageVersion Condition="'$(UseShippedHostPackage)' != 'true'">$(ProductionVersion)</HostPackageVersion>
<HostPackageRelease Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">0.1.$(VersionSuffix)</HostPackageRelease>
<HostPackageRelease>$([System.String]::Copy('$(HostPackageRelease)').Replace('-', '_'))</HostPackageRelease>
<HostResolverPackageVersion Condition="'$(UseShippedHostResolverPackage)' != 'true'">$(ProductionVersion)</HostResolverPackageVersion>
<HostResolverPackageRelease Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">0.1.$(VersionSuffix)</HostResolverPackageRelease>
<HostResolverPackageRelease>$([System.String]::Copy('$(HostResolverPackageRelease)').Replace('-', '_'))</HostResolverPackageRelease>
<RuntimePackageVersion>$(ProductionVersion)</RuntimePackageVersion>
<RuntimePackageRelease Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">0.1.$(VersionSuffix)</RuntimePackageRelease>
<RuntimePackageRelease>$([System.String]::Copy('$(RuntimePackageRelease)').Replace('-', '_'))</RuntimePackageRelease>
<RuntimeDepsRpmPackageVersion>$(ProductionVersion)</RuntimeDepsRpmPackageVersion>
<RuntimeDepsRpmPackageRelease Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">0.1.$(VersionSuffix)</RuntimeDepsRpmPackageRelease>
<RuntimeDepsRpmPackageRelease>$([System.String]::Copy('$(RuntimeDepsRpmPackageRelease)').Replace('-', '_'))</RuntimeDepsRpmPackageRelease>
</PropertyGroup>
</Target>
<Target Name="GetInstallerLocations"
DependsOnTargets="GetProductVersions">
<PropertyGroup>
<CombinedInstallerFile>$(CombinedInstallerStart)$(ProductMoniker)$(CombinedInstallerExtension)</CombinedInstallerFile>
<CombinedInstallerEngine>$(CombinedInstallerStart)$(ProductMoniker)-engine.exe</CombinedInstallerEngine>
<SharedHostInstallerFile>$(SharedHostInstallerStart)$(ProductMoniker)$(InstallerExtension)</SharedHostInstallerFile>
<HostFxrInstallerFile>$(HostFxrInstallerStart)$(HostResolverVersionMoniker)$(InstallerExtension)</HostFxrInstallerFile>
<SharedFrameworkInstallerFile>$(SharedFrameworkInstallerStart)$(ProductMoniker)$(InstallerExtension)</SharedFrameworkInstallerFile>
<DotnetRuntimeDependenciesPackageInstallerFile>$(DotnetRuntimeDependenciesPackageInstallerStart)$(ProductMoniker)$(InstallerExtension)</DotnetRuntimeDependenciesPackageInstallerFile>
<CombinedCompressedFile>dotnet-runtime-$(ProductMoniker)$(CompressedFileExtension)</CombinedCompressedFile>
<HostFxrCompressedFile>dotnet-hostfxr-internal-$(PackageTargetRid).$(HostResolverVersion)$(CompressedFileExtension)</HostFxrCompressedFile>
<NetHostCompressedFile>dotnet-nethost-$(AppHostVersion)-$(PackageTargetRid)$(CompressedFileExtension)</NetHostCompressedFile>
<SharedFrameworkCompressedFile>dotnet-runtime-internal-$(ProductMoniker)$(CompressedFileExtension)</SharedFrameworkCompressedFile>
<SharedFrameworkSymbolsCompressedFile>dotnet-runtime-symbols-$(ProductMoniker)$(CompressedFileExtension)</SharedFrameworkSymbolsCompressedFile>
<HostFxrDebPkgName>$(DotnetHostFxrString)$(ProductBandVersion)</HostFxrDebPkgName>
<HostFxrDebPkgName>$(HostFxrDebPkgName.ToLower())</HostFxrDebPkgName>
<SharedFxDebPkgName>$(DotnetRuntimeString)$(ProductBandVersion)</SharedFxDebPkgName>
<SharedFxDebPkgName>$(SharedFxDebPkgName.ToLower())</SharedFxDebPkgName>
<RuntimeDependenciesDebPkgName>$(DotnetRuntimeDependenciesPackageString)$(ProductBandVersion)</RuntimeDependenciesDebPkgName>
<RuntimeDependenciesDebPkgName>$(RuntimeDependenciesDebPkgName.ToLower())</RuntimeDependenciesDebPkgName>
<HostFxrRpmPkgName>dotnet-hostfxr-$(ProductBandVersion)</HostFxrRpmPkgName>
<HostFxrRpmPkgName>$(HostFxrRpmPkgName.ToLower())</HostFxrRpmPkgName>
<SharedFxRpmPkgName>dotnet-runtime-$(ProductBandVersion)</SharedFxRpmPkgName>
<SharedFxRpmPkgName>$(SharedFxRpmPkgName.ToLower())</SharedFxRpmPkgName>
<RuntimeDependenciesRpmPkgName>$(DotnetRuntimeDependenciesPackageString)$(ProductBandVersion)</RuntimeDependenciesRpmPkgName>
<RuntimeDependenciesRpmPkgName>$(RuntimeDependenciesRpmPkgName.ToLower())</RuntimeDependenciesRpmPkgName>
</PropertyGroup>
<PropertyGroup>
<TargetingPackInstallerFile>$(AssetOutputPath)dotnet-targeting-pack-$(ProductMoniker)$(InstallerExtension)</TargetingPackInstallerFile>
<AppHostPackInstallerFile>$(AssetOutputPath)dotnet-apphost-pack-$(ProductMoniker)$(InstallerExtension)</AppHostPackInstallerFile>
<NetStandardProductBandVersion>2.1</NetStandardProductBandVersion>
<NetStandardProductMoniker>$(NetStandardProductBandVersion).$(PatchVersion)$(ProductVersionSuffix)-$(PackageTargetRid)</NetStandardProductMoniker>
<NetStandardTargetingPackInstallerFile>$(AssetOutputPath)netstandard-targeting-pack-$(NetStandardProductMoniker)$(InstallerExtension)</NetStandardTargetingPackInstallerFile>
<WindowsDesktopSharedFrameworkInstallerFile>$(AssetOutputPath)windowsdesktop-runtime-$(ProductMoniker)$(InstallerExtension)</WindowsDesktopSharedFrameworkInstallerFile>
<WindowsDesktopTargetingPackInstallerFile>$(AssetOutputPath)windowsdesktop-targeting-pack-$(ProductMoniker)$(InstallerExtension)</WindowsDesktopTargetingPackInstallerFile>
</PropertyGroup>
<!-- Runtime Deb and Rpm packages are distro version agnostic -->
<PropertyGroup Condition="'$(InstallerExtension)' == '.deb' or '$(InstallerExtension)' == '.rpm'">
<SharedHostInstallerFile>$(SharedHostInstallerStart)$(SharedFrameworkNugetVersion)-$(TargetArchitecture)$(InstallerExtension)</SharedHostInstallerFile>
<HostFxrInstallerFile>$(HostFxrInstallerStart)$(HostResolverVersion)-$(TargetArchitecture)$(InstallerExtension)</HostFxrInstallerFile>
<SharedFrameworkInstallerFile>$(SharedFrameworkInstallerStart)$(SharedFrameworkNugetVersion)-$(TargetArchitecture)$(InstallerExtension)</SharedFrameworkInstallerFile>
</PropertyGroup>
<!-- Runtime-deps Deb package is distro version agnostic. -->
<PropertyGroup Condition="'$(InstallerExtension)' == '.deb'">
<DotnetRuntimeDependenciesPackageInstallerFile>$(DotnetRuntimeDependenciesPackageInstallerStart)$(SharedFrameworkNugetVersion)-$(TargetArchitecture)$(InstallerExtension)</DotnetRuntimeDependenciesPackageInstallerFile>
</PropertyGroup>
</Target>
<Target Name="CreateHostMachineInfoFile">
<GetTargetMachineInfo>
<Output PropertyName="HostMachineRid" TaskParameter="RuntimeIdentifier" />
</GetTargetMachineInfo>
<PropertyGroup>
<HostMachineInfoPropsContent>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<HostMachineRid>$(HostMachineRid)</HostMachineRid>
</PropertyGroup>
</Project>
</HostMachineInfoPropsContent>
</PropertyGroup>
<WriteLinesToFile File="$(HostMachineInfoProps)"
Lines="$(HostMachineInfoPropsContent)"
Overwrite="True" />
</Target>
<Target Name="GetLatestCommitHash"
Condition="'$(LatestCommit)' == ''">
<!-- Get the latest commit hash -->
<Exec Command="git rev-parse HEAD 2>&1" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="LatestCommit" />
<Output TaskParameter="ExitCode" PropertyName="LatestCommitExitCode" />
</Exec>
<!-- We shouldn't fail the build if we can't retreive the commit hash, so in this case just set it to N/A -->
<PropertyGroup Condition="'$(LatestCommitExitCode)'!='0'">
<LatestCommit>N/A</LatestCommit>
</PropertyGroup>
</Target>
</Project>