Skip to content

Commit

Permalink
Move TargetsCurrent to net9 and add net8 workload (#91480)
Browse files Browse the repository at this point in the history
* Move TargetsCurrent to net9 and add net8 workload

* Fix version references

* Update src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in

* [wasm] build net8 workload

* Update emsdk

* Update current template to reference net9

* Bump 8.0 version used for workloads

* Fix version for latest emscripten packages

* fix typo in 8.0 version used for the workload

* disamiguate templates

* WBT: explicitly use net8.0 projects for template projects

* Update emsdk dependency to get the workload fix

* fix

* Add some addtional workarounds for net8

* Remove extra character

* Fix test

* More wasi fixes

* Add net8 wasi-wasm runtime pack reference

* Add wasi-experimental-net8 workload

* [wasi] Fix use of workload

* [wasm] WBT: Fix test

* wasi: Allow wasi-wasm runtimepacks even when targeting net8

* fix test

---------

Co-authored-by: Ankit Jain <radical@gmail.com>
  • Loading branch information
lewing and radical authored Sep 26, 2023
1 parent 0392c1a commit ac1cf4c
Show file tree
Hide file tree
Showing 32 changed files with 751 additions and 45 deletions.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
<Sha>89be445dd4936157533ad96bafb95f701430653a</Sha>
<SourceBuild RepoName="cecil" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-alpha.1.23465.3">
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-alpha.1.23471.2">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>bebe955e9f7d392fbca594b1c76c54ba2e27027e</Sha>
<Sha>fc01829cbf76b7bbf48a39161562468715a0a3b4</Sha>
<SourceBuild RepoName="emsdk" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.23468.3">
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MinorVersion>0</MinorVersion>
<PatchVersion>0</PatchVersion>
<SdkBandVersion>9.0.100</SdkBandVersion>
<PackageVersionNet8>8.0.0-rc.1.23414.4</PackageVersionNet8>
<PackageVersionNet8>8.0.0-rc.2.23469.22</PackageVersionNet8>
<PackageVersionNet7>7.0.8</PackageVersionNet7>
<PackageVersionNet6>6.0.$([MSBuild]::Add($([System.Version]::Parse('$(PackageVersionNet7)').Build),11))</PackageVersionNet6>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
Expand Down Expand Up @@ -235,7 +235,7 @@
Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml
like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-8_0_100_Transport
-->
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-alpha.1.23465.3</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-alpha.1.23471.2</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
<MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion)</MicrosoftNETRuntimeEmscriptenVersion>
<!-- workloads -->
<SwixPackageVersion>1.1.87-gba258badda</SwixPackageVersion>
Expand Down
7 changes: 6 additions & 1 deletion eng/testing/tests.browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@
Variant="latest"
Version="$(PackageVersionForWorkloadManifests)" />

<WorkloadIdForTesting Include="wasm-tools-net8;wasm-experimental-net8"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.net8"
Variant="net8"
Version="$(PackageVersionForWorkloadManifests)" />

<WorkloadIdForTesting Include="wasm-tools-net7;wasm-experimental-net7"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.net7"
Variant="net7"
Expand All @@ -277,7 +282,7 @@
IgnoreErrors="$(WasmIgnoreNet6WorkloadInstallErrors)"
Condition="'$(WorkloadsTestPreviousVersions)' == 'true'" />

<WorkloadCombinationsToInstall Include="latest" Variants="latest" />
<WorkloadCombinationsToInstall Include="latest" Variants="latest;net8" />
<WorkloadCombinationsToInstall Include="net7" Variants="net7" Condition="'$(WorkloadsTestPreviousVersions)' == 'true'" />
<WorkloadCombinationsToInstall Include="net7+latest" Variants="net7;latest" Condition="'$(WorkloadsTestPreviousVersions)' == 'true'" />
<!--<WorkloadCombinationsToInstall Include="net6" Variants="net6" />-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup>
<WasmNativeWorkload Condition="'$(WasmNativeWorkload)' == ''">net8.0</WasmNativeWorkload>
<WasmNativeWorkload8>true</WasmNativeWorkload8>
<WasmNativeWorkload Condition="'$(WasmNativeWorkload)' == ''">net9.0</WasmNativeWorkload>
<WasmNativeWorkload9>true</WasmNativeWorkload9>
<!--<WasmNativeWorkloadAvailableList>$(WasmNativeWorkloadAvailableList)+net8.0+</WasmNativeWorkloadAvailableList>-->
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
<ItemGroup>
<_WorkloadManifestValues Include="WorkloadVersion" Value="$(PackageVersion)" />
<_WorkloadManifestValues Include="PackageVersion" Value="$(PackageVersion)" />
<_WorkloadManifestValues Include="PackageVersionNet8" Value="$(PackageVersionNet8)" Condition="'$(PackageVersionNet8)' != ''" />
<_WorkloadManifestValues Include="PackageVersionNet8" Value="$(PackageVersion)" Condition="'$(PackageVersionNet8)' == ''" />
<_WorkloadManifestValues Include="PackageVersionNet7" Value="$(PackageVersionNet7)" />
<_WorkloadManifestValues Include="PackageVersionNet6" Value="$(PackageVersionNet6)" />
<_WorkloadManifestValues Include="PackageVersionNet7" Value="$(PackageVersionNet7)" Condition="'$(PackageVersionNet7)' != ''" />
<_WorkloadManifestValues Include="PackageVersionNet7" Value="$(PackageVersion)" Condition="'$(PackageVersionNet7)' == ''" />
<_WorkloadManifestValues Include="NetCoreAppCurrent" Value="$(NetCoreAppCurrent)" />
<_WorkloadManifestValues Include="EmscriptenVersion" Value="$(MicrosoftNETRuntimeEmscriptenVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'wasi-wasm'">
<WasiNativeWorkloadAvailable Condition="'$(TargetsCurrent)' == 'true' and '$(WasiNativeWorkload)' == 'net8.0'">true</WasiNativeWorkloadAvailable>
<PropertyGroup>
<WasiNativeWorkloadAvailable Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0')) and '$(WasiNativeWorkload)' == 'net8.0'">true</WasiNativeWorkloadAvailable>
<TargetsCurrent Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0'))">true</TargetsCurrent>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'wasi-wasm' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<UsingWasiRuntimeWorkload Condition="'$(UsingWasiRuntimeWorkload)' == ''">$(WasiNativeWorkloadAvailable)</UsingWasiRuntimeWorkload>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"description": ".NET WebAssembly experimental tooling",
"packs": [
"Microsoft.NET.Runtime.WebAssembly.Templates",
"Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm",
"Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm"
],
"extends": [ "wasm-tools" ],
"platforms": [ "win-x64", "win-arm64", "linux-x64", "linux-arm64", "osx-x64", "osx-arm64" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
<Project>
<PropertyGroup>
<_RuntimePackInWorkloadVersionCurrent>${PackageVersion}</_RuntimePackInWorkloadVersionCurrent>
<_RuntimePackInWorkloadVersion8>${PackageVersionNet8}</_RuntimePackInWorkloadVersion8>
<_RuntimePackInWorkloadVersion7>${PackageVersionNet7}</_RuntimePackInWorkloadVersion7>
<_RuntimePackInWorkloadVersion6>${PackageVersionNet6}</_RuntimePackInWorkloadVersion6>

<TargetsNet9 Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionEquals('$(TargetFrameworkVersion)', '9.0'))">true</TargetsNet9>
<TargetsNet8 Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionEquals('$(TargetFrameworkVersion)', '8.0'))">true</TargetsNet8>
<TargetsNet6 Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionEquals('$(TargetFrameworkVersion)', '6.0'))">true</TargetsNet6>
<TargetsNet7 Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionEquals('$(TargetFrameworkVersion)', '7.0'))">true</TargetsNet7>
<TargetsCurrent Condition="'$(TargetsNet8)' == 'true'">true</TargetsCurrent>
<TargetsNet6 Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionEquals('$(TargetFrameworkVersion)', '6.0'))">true</TargetsNet6>

<TargetsCurrent Condition="'$(TargetsNet9)' == 'true'">true</TargetsCurrent>

<!-- override WorkloadDetectionWhen net7 == net8 -->
<WasmNativeWorkload7 Condition="'${PackageVersionNet7}' == '${PackageVersion}'">$(WasmNativeWorkload8)</WasmNativeWorkload7>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)WorkloadManifest.Wasi.targets" />
<Import Project="$(MSBuildThisFileDirectory)WorkloadManifest.Wasi.targets" Condition="'$(RuntimeIdentifier)' == 'wasi-wasm'" />

<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<_BrowserWorkloadNotSupportedForTFM Condition="$([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '6.0'))">true</_BrowserWorkloadNotSupportedForTFM>
Expand All @@ -31,8 +34,9 @@

<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<SelfContained>true</SelfContained>
<WasmNativeWorkloadAvailable Condition="'$(TargetsNet7)' == 'true'">$(WasmNativeWorkload7)</WasmNativeWorkloadAvailable>
<WasmNativeWorkloadAvailable Condition="'$(TargetsNet9)' == 'true'">$(WasmNativeWorkload9)</WasmNativeWorkloadAvailable>
<WasmNativeWorkloadAvailable Condition="'$(TargetsNet8)' == 'true'">$(WasmNativeWorkload8)</WasmNativeWorkloadAvailable>
<WasmNativeWorkloadAvailable Condition="'$(TargetsNet7)' == 'true'">$(WasmNativeWorkload7)</WasmNativeWorkloadAvailable>
<WasmNativeWorkloadAvailable Condition="'$(TargetsNet6)' == 'true'">$(WasmNativeWorkload)</WasmNativeWorkloadAvailable>
<WasmNativeWorkloadAvailable Condition="'$(WasmNativeWorkloadAvailable)' == '' or '$(WasmNativeWorkload)' == 'false'">false</WasmNativeWorkloadAvailable>
<WasmNativeWorkload>$(WasmNativeWorkloadAvailable)</WasmNativeWorkload>
Expand Down Expand Up @@ -141,14 +145,14 @@
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Runtime.MonoTargets.Sdk" />
</ImportGroup>

<ImportGroup Condition="'$(TargetsCurrent)' == 'true' and '$(RuntimeIdentifier)' == 'wasi-wasm' and '$(UsingWasiRuntimeWorkload)' == 'true'">
<ImportGroup Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0')) and '$(RuntimeIdentifier)' == 'wasi-wasm' and '$(UsingWasiRuntimeWorkload)' == 'true'">
<Import Project="Sdk.props" Sdk="Microsoft.NET.Runtime.MonoTargets.Sdk" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Runtime.MonoTargets.Sdk" />
</ImportGroup>

<PropertyGroup Condition="'$(TargetsCurrent)' == 'true' and ('$(UsingMobileWorkload)' == 'true' or '$(RuntimeIdentifier)' == 'browser-wasm' or '$(RuntimeIdentifier)' == 'wasi-wasm')">
<PropertyGroup Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0')) and ('$(UsingMobileWorkload)' == 'true' or '$(RuntimeIdentifier)' == 'browser-wasm' or '$(RuntimeIdentifier)' == 'wasi-wasm')">
<_MonoWorkloadTargetsMobile>true</_MonoWorkloadTargetsMobile>
<_MonoWorkloadRuntimePackPackageVersion>$(_RuntimePackInWorkloadVersionCurrent)</_MonoWorkloadRuntimePackPackageVersion>
<_KnownWebAssemblySdkPackVersion>$(_RuntimePackInWorkloadVersionCurrent)</_KnownWebAssemblySdkPackVersion>
Expand All @@ -163,7 +167,16 @@
<SdkSupportedTargetPlatformVersion Include="1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetsCurrent)' == 'true' and '$(_MonoWorkloadTargetsMobile)' == 'true'">
<!-- Support for "wasi" target platform identifier -->
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'wasi' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0'))">
<TargetPlatformSupported>true</TargetPlatformSupported>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">1.0</TargetPlatformVersion>
</PropertyGroup>
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'wasi' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0'))">
<SdkSupportedTargetPlatformVersion Include="1.0" />
</ItemGroup>

<ItemGroup Condition="(('$(RuntimeIdentifier)' == 'wasi-wasm' and '$(TargetsNet8)' == 'true') or '$(TargetsCurrent)' == 'true') and '$(_MonoWorkloadTargetsMobile)' == 'true'">
<KnownRuntimePack Update="@(KnownRuntimePack)">
<!-- FIXMEWASI: workaround for now -->
<RuntimePackRuntimeIdentifiers Condition="'$(RuntimeIdentifier)' == 'wasi-wasm'">%(RuntimePackRuntimeIdentifiers);wasi-wasm</RuntimePackRuntimeIdentifiers>
Expand Down Expand Up @@ -212,6 +225,6 @@
Importance="High" />
</Target>

<Import Condition="'$(TargetsCurrent)' == 'true' and ('$(UsingBrowserRuntimeWorkload)' == 'true' or '$(UsingMobileWorkload)' == 'true')"
<Import Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0')) and ('$(UsingBrowserRuntimeWorkload)' == 'true' or '$(UsingMobileWorkload)' == 'true')"
Project="$(MSBuildThisFileDirectory)WorkloadTelemetry.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<Project DefaultTargets="Build">
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

<PropertyGroup>
<PackageDescription>Internal toolchain package not meant for direct consumption. Please do not reference directly.</PackageDescription>
</PropertyGroup>

<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles" Returns="@(PackageFile)">
<Error Condition="'$(SdkBandVersionForWorkload_FromRuntimeVersions)' == ''"
Text="%24(SdkBandVersionForWorkload_FromRuntimeVersions) is not set" />

<!-- Override the id to include the sdk band as per the workload installer spec -->
<PropertyGroup>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net8.Manifest-$(SdkBandVersionForWorkload_FromRuntimeVersions)</Id>
</PropertyGroup>

<PropertyGroup>
<WorkloadManifestPath>$(IntermediateOutputPath)WorkloadManifest.json</WorkloadManifestPath>
<WorkloadManifestTargetsPath>$(IntermediateOutputPath)WorkloadManifest.targets</WorkloadManifestTargetsPath>
</PropertyGroup>

<ItemGroup>
<PackageFile Include="$(WorkloadManifestPath)" TargetPath="data" />
<PackageFile Include="$(WorkloadManifestTargetsPath)" TargetPath="data" />
</ItemGroup>

<ItemGroup>
<File Include="localize/**/*">
<TargetPath>data/localize</TargetPath>
</File>
</ItemGroup>
</Target>

<!-- Running this target ensures we have the fully evaluated PackageVersion -->
<Target Name="_WriteManifestValues" AfterTargets="CalculatePackageVersion">
<PropertyGroup>
<PackagePathVersion>PackageVersion=$(PackageVersion);</PackagePathVersion>
</PropertyGroup>

<ItemGroup>
<_WorkloadManifestValues Include="WorkloadVersion" Value="$(PackageVersion)" />
<_WorkloadManifestValues Include="PackageVersionNet8" Value="$(PackageVersionNet8)" Condition="'$(PackageVersionNet8)' != ''" />
<_WorkloadManifestValues Include="PackageVersionNet8" Value="$(PackageVersion)" Condition="'$(PackageVersionNet8)' == ''" />
<_WorkloadManifestValues Include="EmscriptenVersion" Value="$(MicrosoftNETRuntimeEmscriptenVersion)" />
<_WorkloadManifestValues Include="NetCoreAppCurrent" Value="$(NetCoreAppCurrent)" />
</ItemGroup>

<Error Condition="'%(_WorkloadManifestValues.Value)' == ''"
Text="No version specified for template variable '%(_WorkloadManifestValues.Identity)'" />

<GenerateFileFromTemplate
TemplateFile="WorkloadManifest.json.in"
Properties="@(_WorkloadManifestValues)"
OutputPath="$(WorkloadManifestPath)" />

<GenerateFileFromTemplate
TemplateFile="WorkloadManifest.targets.in"
Properties="@(_WorkloadManifestValues)"
OutputPath="$(WorkloadManifestTargetsPath)" />
</Target>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
Loading

0 comments on commit ac1cf4c

Please sign in to comment.