Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0-preview1] Install workload manifests in sdk band version derived from the #81457

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
<WorkloadVersionSuffix Condition="'$(PreReleaseVersionLabel)' != 'release'">-$(PreReleaseVersionLabel).$(PreReleaseVersionIteration)</WorkloadVersionSuffix>
<SdkBandVersionForWorkload>$(SdkBandVersion)$(WorkloadVersionSuffix)</SdkBandVersionForWorkload>
<SdkBandVersionForWorkload_FromRuntimeVersions>$(SdkBandVersion)$(WorkloadVersionSuffix)</SdkBandVersionForWorkload_FromRuntimeVersions>
<!-- 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
7 changes: 2 additions & 5 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,17 @@
<WorkloadIdForTesting Include="wasm-tools;wasm-experimental"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.Current"
Variant="latest"
Version="$(PackageVersionForWorkloadManifests)"
VersionBand="$(SdkBandVersionForWorkload)" />
Version="$(PackageVersionForWorkloadManifests)" />

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

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

<WorkloadCombinationsToInstall Include="latest" Variants="latest" />
Expand Down
39 changes: 37 additions & 2 deletions eng/testing/workloads-testing.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<_SdkWithNoWorkloadStampPath>$([MSBuild]::NormalizePath($(_SdkWithNoWorkloadPath), '.version-for-none-$(SdkVersionForWorkloadTesting).stamp'))</_SdkWithNoWorkloadStampPath>
<InstallWorkloadUsingArtifactsDependsOn>
$(InstallWorkloadUsingArtifactsDependsOn);
_ProvisionDotNetForWorkloadTesting;
_GetDotNetVersion;
_SetPackageVersionForWorkloadsTesting;
_GetNuGetsToBuild;
_PreparePackagesForWorkloadInstall;
GetWorkloadInputs;
_ProvisionDotNetForWorkloadTesting;
_InstallWorkloads
</InstallWorkloadUsingArtifactsDependsOn>
</PropertyGroup>
Expand Down Expand Up @@ -85,6 +86,39 @@
<RemoveDir Directories="@(_ManifestsToRemove)" Condition="Exists(%(_ManifestsToRemove.Identity))" />
</Target>

<Target Name="_GetDotNetVersion">
<PropertyGroup>
<_DotNetPath>$([MSBuild]::NormalizePath($(_SdkWithNoWorkloadPath), 'dotnet'))</_DotNetPath>
<_DotNetPath Condition="$([MSBuild]::IsOSPlatform('windows'))">$(_DotNetPath).exe</_DotNetPath>
<_DotNetVersionCommand>$(_DotNetPath) --version</_DotNetVersionCommand>
</PropertyGroup>

<Exec Command="$(_DotNetVersionCommand)" ConsoleToMsBuild="true" StandardOutputImportance="Low" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_DotNetVersionOutput" />
<Output TaskParameter="ExitCode" PropertyName="_DotNetVersionExitCode" />
</Exec>

<!-- If `dotnet -version` failed, then run it again, so we can surface the output as *Errors*.
This allows the errors to show up correctly, versus trying to use the output lines with
the Error task -->
<Exec Condition="$(_DotNetVersionExitCode) != '0'" Command="$(_DotNetVersionCommand)" CustomErrorRegularExpression=".*" />

<PropertyGroup>
<SdkBandVersionForWorkload_ComputedFromInstaller>$(SdkBandVersion)$([System.Text.RegularExpressions.Regex]::Match($(_DotNetVersionOutput), `-[A-z]*[\.]*\d*`))</SdkBandVersionForWorkload_ComputedFromInstaller>
</PropertyGroup>

<Message Text="** Using sdk band version for installing manifests: $(SdkBandVersionForWorkload_ComputedFromInstaller)" Importance="High" />
<Message Text="
********************

Warning: Using sdk band version for installing manifests: $(SdkBandVersionForWorkload_ComputedFromInstaller),
but the sdk band version in runtime is : $(SdkBandVersionForWorkload_FromRuntimeVersions)

********************"
Condition="$(SdkBandVersionForWorkload_ComputedFromInstaller) != $(SdkBandVersionForWorkload_FromRuntimeVersions)"
Importance="High" />
</Target>

<Target Name="_SetPackageVersionForWorkloadsTesting">
<PropertyGroup>
<!-- Used for workload testing -->
Expand Down Expand Up @@ -226,7 +260,8 @@
<InstallWorkloadFromArtifacts
WorkloadIds="@(WorkloadIdForTesting)"
InstallTargets="@(_SdkWithWorkloadToInstall)"
VersionBand="$(SdkBandVersionForWorkload)"
VersionBandForSdkManifestsDir="$(SdkBandVersionForWorkload_ComputedFromInstaller)"
VersionBandForManifestPackages="$(SdkBandVersionForWorkload_FromRuntimeVersions)"
LocalNuGetsPath="$(LibrariesShippingPackagesDir)"
TemplateNuGetConfigPath="$(RepoRoot)NuGet.config"
SdkWithNoWorkloadInstalledPath="$(_SdkWithNoWorkloadPath)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
</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.Current.Manifest-$(SdkBandVersionForWorkload)</Id>
<Id>Microsoft.NET.Workload.Mono.ToolChain.Current.Manifest-$(SdkBandVersionForWorkload_FromRuntimeVersions)</Id>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
</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.net6.Manifest-$(SdkBandVersionForWorkload)</Id>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net6.Manifest-$(SdkBandVersionForWorkload_FromRuntimeVersions)</Id>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
</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.net7.Manifest-$(SdkBandVersionForWorkload)</Id>
<Id>Microsoft.NET.Workload.Mono.ToolChain.net7.Manifest-$(SdkBandVersionForWorkload_FromRuntimeVersions)</Id>
</PropertyGroup>

<PropertyGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public class InstallWorkloadFromArtifacts : Task
public ITaskItem[] InstallTargets { get; set; } = Array.Empty<ITaskItem>();

[Required, NotNull]
public string? VersionBand { get; set; }
public string? VersionBandForSdkManifestsDir { get; set; }

[Required, NotNull]
public string? VersionBandForManifestPackages { get; set; }

[Required, NotNull]
public string? LocalNuGetsPath { get; set; }
Expand Down Expand Up @@ -301,7 +304,7 @@ private bool InstallWorkloadManifest(ITaskItem workloadId, string name, string v
// Multiple directories for a manifest, differing only in case causes
// workload install to fail due to duplicate manifests!
// This is applicable only on case-sensitive filesystems
string manifestVersionBandDir = Path.Combine(sdkDir, "sdk-manifests", VersionBand);
string manifestVersionBandDir = Path.Combine(sdkDir, "sdk-manifests", VersionBandForSdkManifestsDir);
if (!Directory.Exists(manifestVersionBandDir))
{
Log.LogMessage(MessageImportance.Low, $" Could not find {manifestVersionBandDir}. Creating it..");
Expand All @@ -310,7 +313,7 @@ private bool InstallWorkloadManifest(ITaskItem workloadId, string name, string v

string outputDir = FindSubDirIgnoringCase(manifestVersionBandDir, name);

PackageReference pkgRef = new(Name: $"{name}.Manifest-{VersionBand}",
PackageReference pkgRef = new(Name: $"{name}.Manifest-{VersionBandForManifestPackages}",
Version: version,
OutputDir: outputDir,
relativeSourceDir: "data");
Expand Down