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

[wasm] Use the KnownFrameworkReference update to change the targeting pack #93625

Merged
merged 2 commits into from
Oct 18, 2023
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
1 change: 0 additions & 1 deletion eng/testing/workloads-testing.targets
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
LocalNuGetsPath="$(LibrariesShippingPackagesDir)"
TemplateNuGetConfigPath="$(RepoRoot)NuGet.config"
SdkWithNoWorkloadInstalledPath="$(_SdkWithNoWorkloadPath)"
SkipUpdateAppRefPack="true"
/>

<Touch Files="$(_SdkWithNoWorkloadStampPath)" AlwaysCreate="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@
<!-- Overrides for wasm threading support -->
<RuntimePackNamePatterns Condition="'$(RuntimeIdentifier)' == 'browser-wasm' and '$(WasmEnableThreads)' == 'true'">Microsoft.NETCore.App.Runtime.Mono.multithread.**RID**</RuntimePackNamePatterns>
</KnownRuntimePack>
<KnownFrameworkReference Update="Microsoft.NETCore.App">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for this pr, but we should have the same thing for net8 also.

<TargetingPackVersion Condition="'$(TargetsCurrent)' == 'true'">$(_MonoWorkloadRuntimePackPackageVersion)</TargetingPackVersion>
</KnownFrameworkReference>
<KnownWebAssemblySdkPack Update="@(KnownWebAssemblySdkPack)">
<WebAssemblySdkPackVersion Condition="'%(KnownWebAssemblySdkPack.TargetFramework)' == '${NetCoreAppCurrent}'">$(_KnownWebAssemblySdkPackVersion)</WebAssemblySdkPackVersion>
<WebAssemblySdkPackVersion Condition="'%(KnownWebAssemblySdkPack.TargetFramework)' == 'net8.0'">$(_KnownWebAssemblySdkPackVersion)</WebAssemblySdkPackVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ protected void InitPaths(string id)
Directory.CreateDirectory(_logPath);
}

protected void InitProjectDir(string dir, bool addNuGetSourceForLocalPackages = false, string targetFramework = DefaultTargetFramework)
protected void InitProjectDir(string dir, bool addNuGetSourceForLocalPackages = true, string targetFramework = DefaultTargetFramework)
{
Directory.CreateDirectory(dir);
File.WriteAllText(Path.Combine(dir, "Directory.Build.props"), s_buildEnv.DirectoryBuildPropsContents);
Expand Down
31 changes: 0 additions & 31 deletions src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public partial class InstallWorkloadFromArtifacts : Task
[Required, NotNull]
public string SdkWithNoWorkloadInstalledPath { get; set; } = string.Empty;

public bool SkipUpdateAppRefPack { get; set; }
public bool OnlyUpdateManifests{ get; set; }

private const string s_nugetInsertionTag = "<!-- TEST_RESTORE_SOURCES_INSERTION_LINE -->";
Expand Down Expand Up @@ -159,11 +158,6 @@ private bool ExecuteInternal(InstallWorkloadRequest req)
if (!InstallPacks(req, nugetConfigContents))
return false;

if (!SkipUpdateAppRefPack)
UpdateAppRef(req.TargetPath, req.Version);
else
Log.LogMessage(MessageImportance.Low, "Skipping update of app.ref pack");

return !Log.HasLoggedErrors;
}

Expand Down Expand Up @@ -256,31 +250,6 @@ private bool InstallPacks(InstallWorkloadRequest req, string nugetConfigContents
return !Log.HasLoggedErrors;
}

private void UpdateAppRef(string sdkPath, string version)
{
Log.LogMessage(MessageImportance.Normal, $" - Updating Targeting pack");

string pkgPath = Path.Combine(LocalNuGetsPath, $"Microsoft.NETCore.App.Ref.{version}.nupkg");
if (!File.Exists(pkgPath))
throw new LogAsErrorException($"Could not find {pkgPath} needed to update the targeting pack to the newly built one." +
" Make sure to build the subset `packs`, like `./build.sh -os browser -s mono+libs+packs`.");

string packDir = Path.Combine(sdkPath, "packs", "Microsoft.NETCore.App.Ref");
string[] dirs = Directory.EnumerateDirectories(packDir).ToArray();
if (dirs.Length != 1)
throw new LogAsErrorException($"Expected to find exactly one versioned directory under {packDir}, but got " +
string.Join(',', dirs));

string dstDir = dirs[0];

Directory.Delete(dstDir, recursive: true);
Log.LogMessage($"Deleting {dstDir}");

Directory.CreateDirectory(dstDir);
ZipFile.ExtractToDirectory(pkgPath, dstDir);
Log.LogMessage($"Extracting {pkgPath} to {dstDir}");
}

private string GetNuGetConfig()
{
string contents = File.ReadAllText(TemplateNuGetConfigPath);
Expand Down