Skip to content

Commit

Permalink
[workloads] Add Current to the name of the workload manifest (#80401)
Browse files Browse the repository at this point in the history
dotnet/sdk@f5cb7e3 introduced a change that would make `microsoft.net.workload.mono.toolchain` an outdated id in order to work around manifest errors when older previews of the .NET 7 SDK were installed. The unfortunate side effect of this change meant the name of the runtime manifest needs to be changed.

On the main branch, the manifest id will now contain current in the name for the .net version being developed.

Co-authored-by: Ankit Jain <radical@gmail.com>
  • Loading branch information
steveisok and radical committed Jan 28, 2023
1 parent 08f13dd commit 63c51a3
Show file tree
Hide file tree
Showing 29 changed files with 55 additions and 21 deletions.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<Uri>https://github.com/dotnet/msquic</Uri>
<Sha>dc012a715ceb9b5d5258f2fda77520586af5a36a</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.net7.Manifest-8.0.100" Version="8.0.0-alpha.1.23073.2">
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100-alpha.1" Version="8.0.0-alpha.1.23077.1">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>ff2362091c3ce19e09606a7de927670ba5d1cb81</Sha>
<Sha>93f95eea76ca8b74ffffb6cb2581fae0a35272ed</Sha>
</Dependency>
<Dependency Name="System.ServiceModel.Primitives" Version="4.9.0-rc2.21473.1">
<Uri>https://github.com/dotnet/wcf</Uri>
Expand Down
6 changes: 4 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<PackageVersionNet7>7.0.0</PackageVersionNet7>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
<WorkloadVersionSuffix Condition="'$(PreReleaseVersionLabel)' != 'release'">-$(PreReleaseVersionLabel).$(PreReleaseVersionIteration)</WorkloadVersionSuffix>
<SdkBandVersionForWorkload>$(SdkBandVersion)$(WorkloadVersionSuffix)</SdkBandVersionForWorkload>
<!-- Set assembly version to align with major and minor version,
as for the patches and revisions should be manually updated per assembly if it is serviced. -->
<AssemblyVersion>$(MajorVersion).$(MinorVersion).0.0</AssemblyVersion>
Expand Down Expand Up @@ -233,8 +235,8 @@
<runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>14.0.0-alpha.1.23074.1</runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>14.0.0-alpha.1.23074.1</runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
<!-- emscripten / Node -->
<MicrosoftNETWorkloadEmscriptennet7Manifest80100Version>8.0.0-alpha.1.23073.2</MicrosoftNETWorkloadEmscriptennet7Manifest80100Version>
<MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETWorkloadEmscriptennet7Manifest80100Version)</MicrosoftNETRuntimeEmscriptenVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100alpha1Version>8.0.0-alpha.1.23077.1</MicrosoftNETWorkloadEmscriptenCurrentManifest80100alpha1Version>
<MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100alpha1Version)</MicrosoftNETRuntimeEmscriptenVersion>
<!-- workloads -->
<SwixPackageVersion>1.1.87-gba258badda</SwixPackageVersion>
<WixPackageVersion>1.0.0-v3.14.0.5722</WixPackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/common/evaluate-default-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
- src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/*
- src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/*
- src/mono/nuget/Microsoft.NET.Runtime.wasm.Sample.Mono/*
- src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/*
- src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/*
- src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest/*
- src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net7.Manifest/*
- src/mono/nuget/Microsoft.NETCore.BrowserDebugHost.Transport/*
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/mono/templates/workloads-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.maccatalyst-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.tvos-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.tvossimulator-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Workload.Mono.ToolChain.Manifest*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Workload.Mono.ToolChain.Current.Manifest*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Workload.Mono.ToolChain.net6.Manifest*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Workload.Mono.ToolChain.net7.Manifest*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.MonoTargets.Sdk*.nupkg
Expand Down
8 changes: 4 additions & 4 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -339,22 +339,22 @@
<Target Name="_GetWorkloadsToInstall" DependsOnTargets="_SetPackageVersionForWorkloadsTesting" Returns="@(WorkloadIdForTesting);@(WorkloadCombinationsToInstall)">
<ItemGroup>
<WorkloadIdForTesting Include="wasm-tools;wasm-experimental"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.Current"
Variant="latest"
Version="$(PackageVersionForWorkloadManifests)"
VersionBand="$(SdkBandVersion)" />
VersionBand="$(SdkBandVersionForWorkload)" />

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

<WorkloadIdForTesting Include="wasm-tools-net6"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.net6"
Variant="net6"
Version="$(PackageVersionForWorkloadManifests)"
VersionBand="$(SdkBandVersion)"
VersionBand="$(SdkBandVersionForWorkload)"
IgnoreErrors="$(WasmIgnoreNet6WorkloadInstallErrors)" />

<WorkloadCombinationsToInstall Include="latest" Variants="latest" />
Expand Down
10 changes: 9 additions & 1 deletion eng/testing/workloads-testing.targets
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@

<Exec Condition="$([MSBuild]::IsOSPlatform('windows'))"
Command='powershell -ExecutionPolicy ByPass -NoProfile -command "&amp; $(_DotNetInstallCommand)"' />

<!-- HACK: Remove the now invalid manifest `microsoft.net.workload.mono.toolchain` as a workaround
till the sdk removes it completely. -->
<ItemGroup>
<_ManifestsToRemove Include="$(_SdkWithNoWorkloadPath)\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain" />
</ItemGroup>
<Message Text="Removing @(_ManifestsToRemove)" Condition="Exists(%(_ManifestsToRemove.Identity))" Importance="High" />
<RemoveDir Directories="@(_ManifestsToRemove)" Condition="Exists(%(_ManifestsToRemove.Identity))" />
</Target>

<Target Name="_SetPackageVersionForWorkloadsTesting">
Expand Down Expand Up @@ -218,7 +226,7 @@
<InstallWorkloadFromArtifacts
WorkloadIds="@(WorkloadIdForTesting)"
InstallTargets="@(_SdkWithWorkloadToInstall)"
VersionBand="$(SdkBandVersion)"
VersionBand="$(SdkBandVersionForWorkload)"
LocalNuGetsPath="$(LibrariesShippingPackagesDir)"
TemplateNuGetConfigPath="$(RepoRoot)NuGet.config"
SdkWithNoWorkloadInstalledPath="$(_SdkWithNoWorkloadPath)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles" Returns="@(PackageFile)">
<!-- Override the id to include the sdk band as per the workload installer spec -->
<PropertyGroup>
<Id>Microsoft.NET.Workload.Mono.ToolChain.Manifest-$(SdkBandVersion)</Id>
<Id>Microsoft.NET.Workload.Mono.ToolChain.Current.Manifest-$(SdkBandVersionForWorkload)</Id>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "${WorkloadVersion}",
"depends-on": {
"Microsoft.NET.Workload.Emscripten.net7": "${EmscriptenVersion}"
"Microsoft.NET.Workload.Emscripten.Current": "${EmscriptenVersion}"
},
"workloads": {
"wasm-tools": {
Expand All @@ -11,7 +11,7 @@
"Microsoft.NETCore.App.Runtime.Mono.browser-wasm",
"Microsoft.NETCore.App.Runtime.AOT.Cross.browser-wasm"
],
"extends": [ "microsoft-net-runtime-mono-tooling", "microsoft-net-sdk-emscripten-net7" ],
"extends": [ "microsoft-net-runtime-mono-tooling", "microsoft-net-sdk-emscripten" ],
"platforms": [ "win-x64", "win-arm64", "linux-x64", "osx-x64", "osx-arm64"]
},
"wasm-experimental": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles" Returns="@(PackageFile)">
<!-- Override the id to include the sdk band as per the workload installer spec -->
<PropertyGroup>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net6.Manifest-$(SdkBandVersion)</Id>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net6.Manifest-$(SdkBandVersionForWorkload)</Id>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles" Returns="@(PackageFile)">
<!-- Override the id to include the sdk band as per the workload installer spec -->
<PropertyGroup>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net7.Manifest-$(SdkBandVersion)</Id>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net7.Manifest-$(SdkBandVersionForWorkload)</Id>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/nuget/mono-packages.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetsMobile)' == 'true' or '$(ForceBuildMobileManifests)' == 'true'">
<ProjectReference Include="Microsoft.NET.Workload.Mono.Toolchain.Manifest\Microsoft.NET.Workload.Mono.Toolchain.Manifest.pkgproj" />
<ProjectReference Include="Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest\Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest.pkgproj" />
<ProjectReference Include="Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest\Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest.pkgproj" />
<ProjectReference Include="Microsoft.NET.Workload.Mono.Toolchain.net7.Manifest\Microsoft.NET.Workload.Mono.Toolchain.net7.Manifest.pkgproj" />
<ProjectReference Include="Microsoft.NET.Runtime.MonoAOTCompiler.Task\Microsoft.NET.Runtime.MonoAOTCompiler.Task.pkgproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Bumping Emscripten version involves these steps:
* bump docker images in https://github.com/dotnet/icu, update emscripten files in eng/patches/
* update version number in docs
* update `Microsoft.NET.Runtime.Emscripten.<emscripten version>.Node.win-x64` package name, version and sha hash in https://github.com/dotnet/runtime/blob/main/eng/Version.Details.xml and in https://github.com/dotnet/runtime/blob/main/eng/Versions.props. the sha is the commit hash in https://github.com/dotnet/emsdk and the package version can be found at https://dev.azure.com/dnceng/public/_packaging?_a=feed&feed=dotnet6
* update packages in the workload manifest https://github.com/dotnet/runtime/blob/main/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in
* update packages in the workload manifest https://github.com/dotnet/runtime/blob/main/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.json.in

## Upgrading NPM packages

Expand Down
24 changes: 24 additions & 0 deletions src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public override bool Execute()
throw new LogAsErrorException($"Cannot find {nameof(LocalNuGetsPath)}={LocalNuGetsPath} . " +
"Set it to the Shipping packages directory in artifacts.");

ExecuteHackForRenamedManifest();
if (!InstallAllManifests())
return false;

Expand Down Expand Up @@ -147,6 +148,29 @@ private bool ExecuteInternal(InstallWorkloadRequest req)
return !Log.HasLoggedErrors;
}

private void ExecuteHackForRenamedManifest()
{
// HACK - Because the microsoft.net.workload.mono.toolchain is being renamed to microsoft.net.workload.mono.toolchain.current
// but the sdk doesn't have the change yet.
string? txtPath = Directory.EnumerateFiles(Path.Combine(SdkWithNoWorkloadInstalledPath, "sdk"), "IncludedWorkloadManifests.txt",
new EnumerationOptions { RecurseSubdirectories = true, MaxRecursionDepth = 2})
.FirstOrDefault();
if (txtPath is null)
throw new LogAsErrorException($"Could not find IncludedWorkloadManifests.txt in {SdkWithNoWorkloadInstalledPath}");

string stampPath = Path.Combine(Path.GetDirectoryName(txtPath)!, ".stamp");
if (File.Exists(stampPath))
return;

var lines = File.ReadAllLines(txtPath)
.Select(line => line == "microsoft.net.workload.mono.toolchain"
? "microsoft.net.workload.mono.toolchain.current"
: line);
File.WriteAllLines(txtPath, lines);

File.WriteAllText(stampPath, "");
}

private bool InstallAllManifests()
{
var allManifestPkgs = Directory.EnumerateFiles(LocalNuGetsPath, "*Manifest*nupkg");
Expand Down
6 changes: 3 additions & 3 deletions src/workloads/workloads.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project DefaultTargets="Restore;Build">
<Project DefaultTargets="Restore;Build">
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />

<PropertyGroup>
Expand Down Expand Up @@ -124,7 +124,7 @@
<ShortNames Include="Microsoft.NET.Workload.Mono.ToolChain.net">
<Replacement>Mono.</Replacement>
</ShortNames>
<ShortNames Include="Microsoft.NET.Workload.Mono.ToolChain.">
<ShortNames Include="Microsoft.NET.Workload.Mono.ToolChain.Current.">
<Replacement>Mono.</Replacement>
</ShortNames>
<ShortNames Include="microsoft.netcore.app.runtime;Microsoft.NETCore.App.Runtime;microsoft.net.runtime;Microsoft.NET.Runtime">
Expand All @@ -136,7 +136,7 @@
</ItemGroup>

<ItemGroup>
<ManifestPackages Include="$(PackageSource)Microsoft.NET.Workload.Mono.ToolChain.*Manifest-%(WorkloadSdkBandVersions.Identity).*.nupkg"
<ManifestPackages Include="$(PackageSource)Microsoft.NET.Workload.Mono.ToolChain.*Manifest-%(WorkloadSdkBandVersions.Identity)*.*.nupkg"
MsiVersion="$(MsiVersion)"
SupportsMachineArch="%(SupportsMachineArch)" />
</ItemGroup>
Expand Down

0 comments on commit 63c51a3

Please sign in to comment.