Skip to content
Draft
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: 1 addition & 0 deletions eng/testing/scenarios/BuildWasmAppsJobsList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest
Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest
Wasm.Build.Tests.InterpPgoTests
Wasm.Build.Templates.Tests.NativeBuildTests
Wasm.Build.Tests.Blazor.AppsettingsTests
Wasm.Build.Tests.Blazor.BuildPublishTests
Wasm.Build.Tests.Blazor.SimpleRunTests
Wasm.Build.Tests.Blazor.CleanTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public AppsettingsTests(ITestOutputHelper output, SharedBuildPerTestClassFixture
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/122338")] // add it back to eng\testing\scenarios\BuildWasmAppsJobsList.txt
public async Task FileInVfs()
{
Configuration config = Configuration.Debug;
Expand Down
6 changes: 3 additions & 3 deletions src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ protected BlazorWasmTestBase(ITestOutputHelper output, SharedBuildPerTestClassFi
: base(output, buildContext, new WasmSdkBasedProjectProvider(output, targetFramework ?? DefaultTargetFrameworkForBlazor))
{
_provider = GetProvider<WasmSdkBasedProjectProvider>();
_defaultBlazorPublishOptions = _defaultPublishOptions with { ExtraMSBuildArgs = _blazorExtraMSBuildArgs };
_defaultBlazorBuildOptions = _defaultBuildOptions with { ExtraMSBuildArgs = _blazorExtraMSBuildArgs };
_defaultBlazorPublishOptions = _defaultPublishOptions with { ExtraMSBuildArgs = _blazorExtraMSBuildArgs, TargetFramework = targetFramework ?? DefaultTargetFrameworkForBlazor };
_defaultBlazorBuildOptions = _defaultBuildOptions with { ExtraMSBuildArgs = _blazorExtraMSBuildArgs, TargetFramework = targetFramework ?? DefaultTargetFrameworkForBlazor };
}

private Dictionary<string, string> blazorHomePageReplacements = new Dictionary<string, string>
Expand Down Expand Up @@ -221,5 +221,5 @@ public override async Task<RunResult> RunForPublishWithWebServer(RunOptions runO
}

public string GetBlazorBinFrameworkDir(Configuration config, bool forPublish, string? framework = null, string? projectDir = null)
=> _provider.GetBinFrameworkDir(config: config, forPublish: forPublish, framework: framework ?? DefaultTargetFrameworkForBlazor, projectDir: projectDir);
=> _provider.GetBinFrameworkDir(config: config, forPublish: forPublish, framework: framework ?? _provider.GetDefaultTargetFramework(), projectDir: projectDir);
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,9 @@ public ProjectInfo CreateWasmTemplateProject(
(string projectName, string logPath, string nugetDir) =
InitProjectLocation(idPrefix, config, aot, appendUnicodeToPath ?? s_buildEnv.IsRunningOnCI);

if (addFrameworkArg) {
var defaultTarget = template switch
{
Template.BlazorWasm => DefaultTargetFrameworkForBlazorTemplate,
_ => DefaultTargetFramework,
};

extraArgs += $" -f {defaultTarget}";
if (addFrameworkArg)
{
extraArgs += $" -f {_provider.GetDefaultTargetFramework()}";
}

using DotNetCommand cmd = new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false);
Expand Down Expand Up @@ -282,7 +277,7 @@ protected void DeleteFile(string pathRelativeToProjectDir)

protected void UpdateBrowserMainJs(string? targetFramework = null, string runtimeAssetsRelativePath = DefaultRuntimeAssetsRelativePath)
{
targetFramework ??= DefaultTargetFramework;
targetFramework ??= _provider.GetDefaultTargetFramework();
string mainJsPath = Path.Combine(_projectDir, "wwwroot", "main.js");
string mainJsContent = File.ReadAllText(mainJsPath);
Version targetFrameworkVersion = new Version(targetFramework.Replace("net", ""));
Expand Down Expand Up @@ -431,10 +426,10 @@ void OnErrorMessage(string msg)
}

public string GetBinFrameworkDir(Configuration config, bool forPublish, string? framework = null, string? projectDir = null) =>
_provider.GetBinFrameworkDir(config, forPublish, framework ?? DefaultTargetFramework, projectDir);
_provider.GetBinFrameworkDir(config, forPublish, framework ?? _provider.GetDefaultTargetFramework(), projectDir);

public string GetObjDir(Configuration config, string? framework = null, string? projectDir = null) =>
_provider.GetObjDir(config, framework ?? DefaultTargetFramework, projectDir);
_provider.GetObjDir(config, framework ?? _provider.GetDefaultTargetFramework(), projectDir);

public BuildPaths GetBuildPaths(Configuration config, bool forPublish) =>
_provider.GetBuildPaths(config, forPublish);
Expand Down
11 changes: 7 additions & 4 deletions src/mono/wasm/Wasm.Build.Tests/WasmSdkBasedProjectProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public WasmSdkBasedProjectProvider(ITestOutputHelper _testOutput, string default

protected override string BundleDirName { get { return "wwwroot"; } }

public string GetDefaultTargetFramework() => _defaultTargetFramework;

protected override IReadOnlyDictionary<string, bool> GetAllKnownDotnetFilesToFingerprintMap(AssertBundleOptions assertOptions)
{
var result = new SortedDictionary<string, bool>()
Expand Down Expand Up @@ -127,7 +129,7 @@ private void AssertBundle(AssertBundleOptions assertOptions)
Assert.False(wasmAssemblies.Any(), $"Did not expect to find any .wasm files in {publishPath} but found {string.Join(",", wasmAssemblies)}");
}

if (!BuildTestBase.IsUsingWorkloads)
if (!BuildTestBase.IsUsingWorkloads || assertOptions.BuildOptions.TargetFramework != BuildTestBase.DefaultTargetFramework)
return;

// Compare files with the runtime pack
Expand Down Expand Up @@ -178,10 +180,11 @@ private void AssertBundle(AssertBundleOptions assertOptions)

public void AssertWasmSdkBundle(Configuration config, MSBuildOptions buildOptions, bool isUsingWorkloads, bool? isNativeBuild = null, bool? wasmFingerprintDotnetJs = null, string? buildOutput = null)
{
if (isUsingWorkloads && buildOutput is not null)
string targetFramework = buildOptions.TargetFramework ?? _defaultTargetFramework;

if (isUsingWorkloads && buildOutput is not null && targetFramework == BuildTestBase.DefaultTargetFramework)
{
// In no-workload case, the path would be from a restored nuget
ProjectProviderBase.AssertRuntimePackPath(buildOutput, buildOptions.TargetFramework ?? _defaultTargetFramework, buildOptions.RuntimeType);
AssertRuntimePackPath(buildOutput, targetFramework, buildOptions.RuntimeType);
}
AssertBundle(config, buildOptions, isUsingWorkloads, isNativeBuild, wasmFingerprintDotnetJs);
}
Expand Down
Loading