|
177 | 177 | <InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
|
178 | 178 | </PropertyGroup>
|
179 | 179 |
|
180 |
| - <PropertyGroup Label="CalculateOS"> |
181 |
| - <!-- Default to portable build if not explicitly set --> |
| 180 | + <PropertyGroup Label="CalculatePortableBuild"> |
182 | 181 | <PortableBuild Condition="'$(PortableBuild)' == '' and '$(DotNetBuildFromSource)' == 'true'">false</PortableBuild>
|
183 | 182 | <PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
|
| 183 | + </PropertyGroup> |
184 | 184 |
|
185 |
| - <_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid> |
186 |
| - <_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid> |
| 185 | + <!-- _portableOS is the portable rid-OS corresponding to the target platform. --> |
| 186 | + <PropertyGroup Label="CalculatePortableOS"> |
| 187 | + <!-- To determine _portableOS we use TargetOS. |
| 188 | + TargetOS is not a rid-OS. For example: for Windows it is 'windows' instead of 'win'. |
| 189 | + And, for flavors of Linux, like 'linux-musl' and 'linux-bionic', TargetOS is 'linux'. --> |
187 | 190 |
|
188 |
| - <_parseDistroRid>$(__DistroRid)</_parseDistroRid> |
189 |
| - <_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid> |
190 |
| - <_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex> |
| 191 | + <_portableOS>$(TargetOS.ToLowerInvariant())</_portableOS> |
| 192 | + <_portableOS Condition="'$(_portableOS)' == 'windows'">win</_portableOS> |
191 | 193 |
|
192 |
| - <_runtimeOS>$(RuntimeOS)</_runtimeOS> |
193 |
| - <_runtimeOS Condition="'$(_runtimeOS)' == ''">$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_runtimeOS> |
194 |
| - |
195 |
| - <!-- _runtimeOS is calculated based on the build system OS, however if building for Browser/iOS/Android we need to let |
196 |
| - the build system to use browser/ios/android as the _runtimeOS for produced package RIDs. --> |
197 |
| - <_runtimeOS Condition="'$(TargetsMobile)' == 'true'">$(TargetOS.ToLowerInvariant())</_runtimeOS> |
198 |
| - |
199 |
| - <_portableOS>linux</_portableOS> |
200 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'linux-musl' or $(_runtimeOS.StartsWith('alpine'))">linux-musl</_portableOS> |
201 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'linux-bionic'">linux-bionic</_portableOS> |
202 |
| - <_portableOS Condition="'$(_hostOS)' == 'osx'">osx</_portableOS> |
203 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'win' or '$(TargetOS)' == 'windows'">win</_portableOS> |
204 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'freebsd' or '$(TargetOS)' == 'freebsd'">freebsd</_portableOS> |
205 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'illumos' or '$(TargetOS)' == 'illumos'">illumos</_portableOS> |
206 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'solaris' or '$(TargetOS)' == 'solaris'">solaris</_portableOS> |
207 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'browser'">browser</_portableOS> |
208 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'wasi'">wasi</_portableOS> |
209 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'maccatalyst'">maccatalyst</_portableOS> |
210 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'ios'">ios</_portableOS> |
211 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'iossimulator'">iossimulator</_portableOS> |
212 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'tvos'">tvos</_portableOS> |
213 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'tvossimulator'">tvossimulator</_portableOS> |
214 |
| - <_portableOS Condition="'$(_runtimeOS)' == 'android'">android</_portableOS> |
215 |
| - |
216 |
| - <_runtimeOS Condition="$(_runtimeOS.StartsWith('tizen'))">linux</_runtimeOS> |
217 |
| - <_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS> |
218 |
| - <_runtimeOS Condition="'$(RuntimeOS)' == '' and '$(DotNetBuildFromSource)' == 'true'">$(_portableOS)</_runtimeOS> |
219 |
| - |
220 |
| - <_packageLibc Condition="$(_runtimeOS.Contains('musl'))">-musl</_packageLibc> |
221 |
| - <_packageOS Condition="'$(CrossBuild)' == 'true'">$(_hostOS)$(_packageLibc)</_packageOS> |
222 |
| - <_packageOS Condition="'$(_packageOS)' == '' and '$(PortableBuild)' == 'true'">$(_portableOS)</_packageOS> |
223 |
| - <_packageOS Condition="'$(_packageOS)' == ''">$(_runtimeOS)</_packageOS> |
| 194 | + <!-- TargetOS=AnyOS is a sentinel value used by tests, ignore it. --> |
| 195 | + <_portableOS Condition="'$(_portableOS)' == 'anyos'">$(__PortableTargetOS)</_portableOS> |
| 196 | + |
| 197 | + <!-- Detect linux flavors using __PortableTargetOS from the native script. --> |
| 198 | + <_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-musl'">linux-musl</_portableOS> |
| 199 | + <_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-bionic'">linux-bionic</_portableOS> |
| 200 | + </PropertyGroup> |
| 201 | + |
| 202 | + <!-- PackageRID is used for packages needed for the target. --> |
| 203 | + <PropertyGroup Label="CalculatePackageRID"> |
| 204 | + <_packageOS>$(_portableOS)</_packageOS> |
| 205 | + |
| 206 | + <_packageOS Condition="'$(CrossBuild)' == 'true' and '$(_portableOS)' != 'linux-musl' and '$(_portableOS)' != 'linux-bionic'">$(_hostOS)</_packageOS> |
| 207 | + |
| 208 | + <!-- source-build sets PackageOS to build with non-portable rid packages that were source-built previously. --> |
| 209 | + <PackageRID Condition="'$(PackageOS)' != ''">$(PackageOS)-$(TargetArchitecture)</PackageRID> |
| 210 | + <PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID> |
224 | 211 | </PropertyGroup>
|
225 | 212 |
|
226 |
| - <PropertyGroup Label="CalculateRID"> |
227 |
| - <_toolsRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS)-$(_hostArch)</_toolsRID> |
228 |
| - <_toolsRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64</_toolsRID> |
229 |
| - <_toolsRID Condition="'$(_toolsRID)' == ''">$(_runtimeOS)-$(_hostArch)</_toolsRID> |
| 213 | + <!-- ToolsRID is used for packages needed on the build host. --> |
| 214 | + <PropertyGroup Label="CalculateToolsRID"> |
| 215 | + <!-- _portableHostOS is the portable rid-OS corresponding to the build host platform. |
230 | 216 |
|
231 |
| - <!-- There are no WebAssembly tools, so use the default ones --> |
232 |
| - <_toolsRID Condition="'$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi'">linux-x64</_toolsRID> |
233 |
| - <_toolsRID Condition="('$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi') and '$(HostOS)' == 'windows'">win-x64</_toolsRID> |
234 |
| - <_toolsRID Condition="('$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi') and '$(HostOS)' == 'osx'">osx-x64</_toolsRID> |
| 217 | + To determine _portableHostOS we use _hostOS, similar to how _portableOS is calculated from TargetOS. |
235 | 218 |
|
236 |
| - <!-- There are no Android tools, so use the default ones --> |
237 |
| - <_toolsRID Condition="'$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic'">linux-x64</_toolsRID> |
238 |
| - <_toolsRID Condition="('$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic') and '$(HostOS)' == 'windows'">win-x64</_toolsRID> |
239 |
| - <_toolsRID Condition="('$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic') and '$(HostOS)' == 'osx'">osx-x64</_toolsRID> |
| 219 | + When we're not cross-building we can detect linux flavors by looking at _portableOS |
| 220 | + because the target platform and the build host platform are the same. |
| 221 | + For cross-builds, we're currently unable to detect the flavors. --> |
| 222 | + <_portableHostOS>$(_hostOS)</_portableHostOS> |
| 223 | + <_portableHostOS Condition="'$(_portableHostOS)' == 'windows'">win</_portableHostOS> |
| 224 | + <_portableHostOS Condition="'$(CrossBuild)' != 'true' and '$(_portableOS)' == 'linux-musl'">linux-musl</_portableHostOS> |
240 | 225 |
|
241 |
| - <!-- There are no Mac Catalyst, iOS or tvOS tools and it can be built on OSX only, so use that --> |
242 |
| - <_toolsRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'iossimulator' or '$(_runtimeOS)' == 'tvos' or '$(_runtimeOS)' == 'tvossimulator'">osx-x64</_toolsRID> |
| 226 | + <!-- source-build sets ToolsOS to build with non-portable rid packages that were source-built previously. --> |
| 227 | + <ToolsRID Condition="'$(ToolsOS)' != ''">$(ToolsOS)-$(_hostArch)</ToolsRID> |
| 228 | + <ToolsRID Condition="'$(ToolsRID)' == ''">$(_portableHostOS)-$(_hostArch)</ToolsRID> |
243 | 229 |
|
244 |
| - <!-- There are no non-portable builds for Ilasm, Ildasm, ILC etc. --> |
245 |
| - <ToolsRID Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</ToolsRID> |
246 |
| - <ToolsRID Condition="'$(ToolsRID)' == ''">$(_toolsRID)</ToolsRID> |
| 230 | + <!-- Microsoft.NET.Sdk.IL SDK defaults to the portable host rid. Match it to ToolsRID (for source-build). --> |
247 | 231 | <MicrosoftNetCoreIlasmPackageRuntimeId>$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
|
| 232 | + </PropertyGroup> |
248 | 233 |
|
249 |
| - <PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID> |
| 234 | + <!-- OutputRID is used to name the target platform. |
| 235 | + For portable builds, OutputRID matches _portableOS. |
| 236 | + For non-portable builds, it uses __DistroRid (from the native build script), or falls back to RuntimeInformation.RuntimeIdentifier. |
| 237 | + Source-build sets OutputRID directly. --> |
| 238 | + <PropertyGroup Label="CalculateOutputRID"> |
250 | 239 |
|
251 |
| - <OutputRid Condition="'$(OutputRid)' == '' and '$(DotNetBuildFromSource)' == 'true'">$(_hostRid)</OutputRid> |
252 |
| - <OutputRid Condition="'$(OutputRid)' == ''">$(PackageRID)</OutputRid> |
253 |
| - <OutputRid Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</OutputRid> |
254 |
| - <TargetsLinuxBionic Condition="$(OutputRid.StartsWith('linux-bionic'))">true</TargetsLinuxBionic> |
255 |
| - <TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl> |
| 240 | + <_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid> |
| 241 | + <_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid> |
| 242 | + |
| 243 | + <_parseDistroRid>$(__DistroRid)</_parseDistroRid> |
| 244 | + <_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid> |
| 245 | + <_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex> |
| 246 | + |
| 247 | + <_outputOS>$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_outputOS> |
| 248 | + <_outputOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_outputOS> |
| 249 | + |
| 250 | + <OutputRID Condition="'$(OutputRID)' == ''">$(_outputOS)-$(TargetArchitecture)</OutputRID> |
256 | 251 | </PropertyGroup>
|
257 | 252 |
|
258 |
| - <PropertyGroup Label="CalculateTargetOSName" Condition="'$(SkipInferTargetOSName)' != 'true'"> |
| 253 | + <PropertyGroup Label="CalculateTargetOSName"> |
259 | 254 | <TargetsFreeBSD Condition="'$(TargetOS)' == 'freebsd'">true</TargetsFreeBSD>
|
260 | 255 | <Targetsillumos Condition="'$(TargetOS)' == 'illumos'">true</Targetsillumos>
|
261 | 256 | <TargetsSolaris Condition="'$(TargetOS)' == 'solaris'">true</TargetsSolaris>
|
262 | 257 | <TargetsLinux Condition="'$(TargetOS)' == 'linux' or '$(TargetOS)' == 'android'">true</TargetsLinux>
|
| 258 | + <TargetsLinuxBionic Condition="'$(_portableOS)' == 'linux-bionic'">true</TargetsLinuxBionic> |
| 259 | + <TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl> |
263 | 260 | <TargetsNetBSD Condition="'$(TargetOS)' == 'netbsd'">true</TargetsNetBSD>
|
264 | 261 | <TargetsOSX Condition="'$(TargetOS)' == 'osx'">true</TargetsOSX>
|
265 | 262 | <TargetsMacCatalyst Condition="'$(TargetOS)' == 'maccatalyst'">true</TargetsMacCatalyst>
|
|
279 | 276 | <MicrosoftNetCoreAppRefPackRefDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'ref', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRefPackRefDir>
|
280 | 277 | <MicrosoftNetCoreAppRefPackDataDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'data'))</MicrosoftNetCoreAppRefPackDataDir>
|
281 | 278 |
|
282 |
| - <MicrosoftNetCoreAppRuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.$(OutputRid)', '$(LibrariesConfiguration)'))</MicrosoftNetCoreAppRuntimePackDir> |
283 |
| - <MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackDir)', 'runtimes', '$(OutputRid)'))</MicrosoftNetCoreAppRuntimePackRidDir> |
| 279 | + <MicrosoftNetCoreAppRuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.$(OutputRID)', '$(LibrariesConfiguration)'))</MicrosoftNetCoreAppRuntimePackDir> |
| 280 | + <MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackDir)', 'runtimes', '$(OutputRID)'))</MicrosoftNetCoreAppRuntimePackRidDir> |
284 | 281 | <MicrosoftNetCoreAppRuntimePackRidLibTfmDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'lib', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRuntimePackRidLibTfmDir>
|
285 | 282 | <MicrosoftNetCoreAppRuntimePackNativeDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'native'))</MicrosoftNetCoreAppRuntimePackNativeDir>
|
286 | 283 | </PropertyGroup>
|
287 | 284 |
|
288 | 285 | <PropertyGroup>
|
289 |
| - <DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRid).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir> |
| 286 | + <DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRID).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir> |
290 | 287 | </PropertyGroup>
|
291 | 288 |
|
292 | 289 | <!--Feature switches -->
|
|
0 commit comments