Skip to content

Commit d18295e

Browse files
authored
[wasm] Use the KnownFrameworkReference update to change the targeting pack (#93625)
* Use the KnownFrameworkReference update to change the targeting pack * Default to adding local nuget source
1 parent bf547c6 commit d18295e

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

eng/testing/workloads-testing.targets

-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@
207207
LocalNuGetsPath="$(LibrariesShippingPackagesDir)"
208208
TemplateNuGetConfigPath="$(RepoRoot)NuGet.config"
209209
SdkWithNoWorkloadInstalledPath="$(_SdkWithNoWorkloadPath)"
210-
SkipUpdateAppRefPack="true"
211210
/>
212211

213212
<Touch Files="$(_SdkWithNoWorkloadStampPath)" AlwaysCreate="true" />

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

+3
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@
182182
<!-- Overrides for wasm threading support -->
183183
<RuntimePackNamePatterns Condition="'$(RuntimeIdentifier)' == 'browser-wasm' and '$(WasmEnableThreads)' == 'true'">Microsoft.NETCore.App.Runtime.Mono.multithread.**RID**</RuntimePackNamePatterns>
184184
</KnownRuntimePack>
185+
<KnownFrameworkReference Update="Microsoft.NETCore.App">
186+
<TargetingPackVersion Condition="'$(TargetsCurrent)' == 'true'">$(_MonoWorkloadRuntimePackPackageVersion)</TargetingPackVersion>
187+
</KnownFrameworkReference>
185188
<KnownWebAssemblySdkPack Update="@(KnownWebAssemblySdkPack)">
186189
<WebAssemblySdkPackVersion Condition="'%(KnownWebAssemblySdkPack.TargetFramework)' == '${NetCoreAppCurrent}'">$(_KnownWebAssemblySdkPackVersion)</WebAssemblySdkPackVersion>
187190
<WebAssemblySdkPackVersion Condition="'%(KnownWebAssemblySdkPack.TargetFramework)' == 'net8.0'">$(_KnownWebAssemblySdkPackVersion)</WebAssemblySdkPackVersion>

src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ protected void InitPaths(string id)
334334
Directory.CreateDirectory(_logPath);
335335
}
336336

337-
protected void InitProjectDir(string dir, bool addNuGetSourceForLocalPackages = false, string targetFramework = DefaultTargetFramework)
337+
protected void InitProjectDir(string dir, bool addNuGetSourceForLocalPackages = true, string targetFramework = DefaultTargetFramework)
338338
{
339339
Directory.CreateDirectory(dir);
340340
File.WriteAllText(Path.Combine(dir, "Directory.Build.props"), s_buildEnv.DirectoryBuildPropsContents);

src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs

-31
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public partial class InstallWorkloadFromArtifacts : Task
4242
[Required, NotNull]
4343
public string SdkWithNoWorkloadInstalledPath { get; set; } = string.Empty;
4444

45-
public bool SkipUpdateAppRefPack { get; set; }
4645
public bool OnlyUpdateManifests{ get; set; }
4746

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

162-
if (!SkipUpdateAppRefPack)
163-
UpdateAppRef(req.TargetPath, req.Version);
164-
else
165-
Log.LogMessage(MessageImportance.Low, "Skipping update of app.ref pack");
166-
167161
return !Log.HasLoggedErrors;
168162
}
169163

@@ -256,31 +250,6 @@ private bool InstallPacks(InstallWorkloadRequest req, string nugetConfigContents
256250
return !Log.HasLoggedErrors;
257251
}
258252

259-
private void UpdateAppRef(string sdkPath, string version)
260-
{
261-
Log.LogMessage(MessageImportance.Normal, $" - Updating Targeting pack");
262-
263-
string pkgPath = Path.Combine(LocalNuGetsPath, $"Microsoft.NETCore.App.Ref.{version}.nupkg");
264-
if (!File.Exists(pkgPath))
265-
throw new LogAsErrorException($"Could not find {pkgPath} needed to update the targeting pack to the newly built one." +
266-
" Make sure to build the subset `packs`, like `./build.sh -os browser -s mono+libs+packs`.");
267-
268-
string packDir = Path.Combine(sdkPath, "packs", "Microsoft.NETCore.App.Ref");
269-
string[] dirs = Directory.EnumerateDirectories(packDir).ToArray();
270-
if (dirs.Length != 1)
271-
throw new LogAsErrorException($"Expected to find exactly one versioned directory under {packDir}, but got " +
272-
string.Join(',', dirs));
273-
274-
string dstDir = dirs[0];
275-
276-
Directory.Delete(dstDir, recursive: true);
277-
Log.LogMessage($"Deleting {dstDir}");
278-
279-
Directory.CreateDirectory(dstDir);
280-
ZipFile.ExtractToDirectory(pkgPath, dstDir);
281-
Log.LogMessage($"Extracting {pkgPath} to {dstDir}");
282-
}
283-
284253
private string GetNuGetConfig()
285254
{
286255
string contents = File.ReadAllText(TemplateNuGetConfigPath);

0 commit comments

Comments
 (0)