Skip to content

Commit

Permalink
[wasm] Bump sdk for workload testing to 7.0.100-preview.3.22151.18 (#…
Browse files Browse the repository at this point in the history
…65003)

* [wasm] bump sdk for workload testing to 7.0.100-preview.2.22108.4

* [wasm] dotnet-install.sh logs errors from curl, while trying older urls,

.. don't let that fail the build.

* [wasm] trigger Wasm.Build.Tests when workload-testing.targets changes

* [wasm] trigger Wasm.Build.Tests on CI when eng/Versions.props changes

* [wasm] Update Wasm.Build.Tests to target net7.0 by default

net6 projects don't build with the workload currently. Tests will be
added for that once it is fixed.

* Bump sdk for workload testing to 7.0.100-preview.3.22128.3

* Bump sdk version for workload testing to 7.0.100-preview.3.22151.18
  • Loading branch information
radical authored Mar 3, 2022
1 parent 7830fdd commit 1d60246
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 55 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<SQLitePCLRawbundle_greenVersion>2.0.4</SQLitePCLRawbundle_greenVersion>
<MoqVersion>4.12.0</MoqVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<SdkVersionForWorkloadTesting>7.0.100-alpha.1.21528.1</SdkVersionForWorkloadTesting>
<SdkVersionForWorkloadTesting>7.0.100-preview.3.22151.18</SdkVersionForWorkloadTesting>
<CompilerPlatformTestingVersion>1.1.1-beta1.22103.1</CompilerPlatformTestingVersion>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>6.0.0-preview-20220104.1</MicrosoftPrivateIntellisenseVersion>
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/common/evaluate-default-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ jobs:
- src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/*
- src/mono/mono/*
- eng/testing/scenarios/BuildWasmAppsJobsList.txt
- eng/testing/workloads-testing.targets
- eng/Version.Details.xml
- eng/Versions.props
- src/mono/wasm/emscripten-version.txt
- subset: wasmdebuggertests
include:
Expand Down
2 changes: 2 additions & 0 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<_ShellCommandSeparator Condition="'$(OS)' == 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator>
<_ShellCommandSeparator Condition="'$(OS)' != 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator>
<_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName>
<_WasmStrictVersionMatch Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</_WasmStrictVersionMatch>
<XUnitUseRandomizedTestOrderer Condition="'$(XUnitUseRandomizedTestOrderer)' == '' and '$(IsTestProject)' == 'true'">true</XUnitUseRandomizedTestOrderer>
</PropertyGroup>

Expand Down Expand Up @@ -165,6 +166,7 @@
<_WasmPropertyNames Include="WasmNativeStrip" />
<_WasmPropertyNames Include="WasmEnableES6" />
<_WasmPropertyNames Include="_WasmDevel" />
<_WasmPropertyNames Include="_WasmStrictVersionMatch" />
<_WasmPropertyNames Include="WasmEmitSymbolMap" />

<_WasmPropertiesToPass
Expand Down
7 changes: 5 additions & 2 deletions src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,13 @@
</ItemGroup>
<PropertyGroup>
<ActualEmccVersionRaw>%(_ReversedVersionLines.Identity)</ActualEmccVersionRaw>
<_VersionMismatchMessage>Emscripten version mismatch. The runtime pack in $(MicrosoftNetCoreAppRuntimePackDir) expects '$(RuntimeEmccVersionRaw)', but emcc being used has version '$(ActualEmccVersionRaw)'. This might cause build failures.</_VersionMismatchMessage>
</PropertyGroup>

<Warning Condition="'$(RuntimeEmccVersionRaw)' != '$(ActualEmccVersionRaw)'"
Text="Emscripten version mismatch. The runtime pack in $(MicrosoftNetCoreAppRuntimePackDir) expects '$(RuntimeEmccVersionRaw)', but emcc being used has version '$(ActualEmccVersionRaw)'. This might cause build failures." />
<Warning Condition="'$(RuntimeEmccVersionRaw)' != '$(ActualEmccVersionRaw)' and '$(_WasmStrictVersionMatch)' != 'true'"
Text="$(_VersionMismatchMessage)" />
<Error Condition="'$(RuntimeEmccVersionRaw)' != '$(ActualEmccVersionRaw)' and '$(_WasmStrictVersionMatch)' == 'true'"
Text="$(_VersionMismatchMessage)" />
</Target>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public void DefaultTemplate_NoAOT_WithWorkload(string config)
string id = $"blz_no_aot_{config}";
CreateBlazorWasmTemplateProject(id);

BlazorBuild(id, config, NativeFilesType.FromRuntimePack);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.FromRuntimePack));
if (config == "Release")
{
// relinking in publish for Release config
BlazorPublish(id, config, NativeFilesType.Relinked);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));
}
else
{
BlazorPublish(id, config, NativeFilesType.FromRuntimePack);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.FromRuntimePack));
}
}

Expand All @@ -68,13 +68,13 @@ public void DefaultTemplate_AOT_InProjectFile(string config)
AddItemsPropertiesToProject(projectFile, extraProperties: "<RunAOTCompilation>true</RunAOTCompilation>");

// No relinking, no AOT
BlazorBuild(id, config, NativeFilesType.FromRuntimePack);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.FromRuntimePack));

// will aot
BlazorPublish(id, config, NativeFilesType.AOT);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.AOT));

// build again
BlazorBuild(id, config, NativeFilesType.FromRuntimePack);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.FromRuntimePack));
}

[ConditionalTheory(typeof(BuildTestBase), nameof(IsUsingWorkloads))]
Expand Down Expand Up @@ -107,7 +107,7 @@ public void NativeBuild_WithDeployOnBuild_UsedByVS(string config, bool nativeRel
}

// Check that we linked only for publish
string objBuildDir = Path.Combine(_projectDir!, "obj", config, "net6.0", "wasm", "for-build");
string objBuildDir = Path.Combine(_projectDir!, "obj", config, DefaultTargetFramework, "wasm", "for-build");
Assert.False(Directory.Exists(objBuildDir), $"Found unexpected {objBuildDir}, which gets creating when relinking during Build");

// double check!
Expand All @@ -130,14 +130,14 @@ public void NativeBuild_WithDeployOnBuild_UsedByVS(string config, bool nativeRel
//CreateBlazorWasmTemplateProject(id);

//// No relinking, no AOT
//BlazorBuild(id, config, NativeFilesType.FromRuntimePack);
//BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.FromRuntimePack);

//// AOT=true only for the publish command line, similar to what
//// would happen when setting it in Publish dialog for VS
//BlazorPublish(id, config, expectedFileType: NativeFilesType.AOT, "-p:RunAOTCompilation=true");
//BlazorPublish(new BlazorBuildOptions(id, config, expectedFileType: NativeFilesType.AOT, "-p:RunAOTCompilation=true");

//// publish again, no AOT
//BlazorPublish(id, config, NativeFilesType.Relinked);
//BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.Relinked);
//}

[ConditionalTheory(typeof(BuildTestBase), nameof(IsUsingWorkloads))]
Expand All @@ -149,12 +149,12 @@ public void WithNativeReference_AOTInProjectFile(string config)
string projectFile = CreateProjectWithNativeReference(id);
AddItemsPropertiesToProject(projectFile, extraProperties: "<RunAOTCompilation>true</RunAOTCompilation>");

BlazorBuild(id, config, expectedFileType: NativeFilesType.Relinked);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));

BlazorPublish(id, config, expectedFileType: NativeFilesType.AOT);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.AOT));

// will relink
BlazorBuild(id, config, expectedFileType: NativeFilesType.Relinked);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));
}

[ConditionalTheory(typeof(BuildTestBase), nameof(IsUsingWorkloads))]
Expand All @@ -165,12 +165,12 @@ public void WithNativeReference_AOTOnCommandLine(string config)
string id = $"blz_nativeref_aot_{config}";
CreateProjectWithNativeReference(id);

BlazorBuild(id, config, expectedFileType: NativeFilesType.Relinked);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));

BlazorPublish(id, config, expectedFileType: NativeFilesType.AOT, "-p:RunAOTCompilation=true");
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.AOT), "-p:RunAOTCompilation=true");

// no aot!
BlazorPublish(id, config, expectedFileType: NativeFilesType.Relinked);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));
}

[ConditionalTheory(typeof(BuildTestBase), nameof(IsUsingWorkloads))]
Expand Down Expand Up @@ -206,17 +206,17 @@ public static class MyDllImports

AddItemsPropertiesToProject(projectFile, extraItems: @"<NativeFileReference Include=""mylib.cpp"" />");

BlazorBuild(id, config, expectedFileType: NativeFilesType.Relinked);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));
CheckNativeFileLinked(forPublish: false);

BlazorPublish(id, config, expectedFileType: NativeFilesType.Relinked);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));
CheckNativeFileLinked(forPublish: true);

void CheckNativeFileLinked(bool forPublish)
{
// very crude way to check that the native file was linked in
// needed because we don't run the blazor app yet
string objBuildDir = Path.Combine(_projectDir!, "obj", config, "net6.0", "wasm", forPublish ? "for-publish" : "for-build");
string objBuildDir = Path.Combine(_projectDir!, "obj", config, DefaultTargetFramework, "wasm", forPublish ? "for-publish" : "for-build");
string pinvokeTableHPath = Path.Combine(objBuildDir, "pinvoke-table.h");
Assert.True(File.Exists(pinvokeTableHPath), $"Could not find {pinvokeTableHPath}");

Expand Down Expand Up @@ -257,10 +257,10 @@ public void BugRegression_60479_WithRazorClassLib()
_projectDir = wasmProjectDir;
string config = "Release";
// No relinking, no AOT
BlazorBuild(id, config, NativeFilesType.FromRuntimePack);
BlazorBuild(new BlazorBuildOptions(id, config, NativeFilesType.FromRuntimePack));

// will relink
BlazorPublish(id, config, NativeFilesType.Relinked);
BlazorPublish(new BlazorBuildOptions(id, config, NativeFilesType.Relinked));

// publish/wwwroot/_framework/blazor.boot.json
string frameworkDir = FindBlazorBinFrameworkDir(config, forPublish: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public BuildEnvironment()
EnvVars["DOTNET_INSTALL_DIR"] = sdkForWorkloadPath;
EnvVars["DOTNET_MULTILEVEL_LOOKUP"] = "0";
EnvVars["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "1";
EnvVars["_WasmStrictVersionMatch"] = "true";
EnvVars["MSBuildSDKsPath"] = string.Empty;
EnvVars["PATH"] = $"{sdkForWorkloadPath}{Path.PathSeparator}{Environment.GetEnvironmentVariable("PATH")}";

Expand Down
49 changes: 29 additions & 20 deletions src/tests/BuildWasmApps/Wasm.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ namespace Wasm.Build.Tests
{
public abstract class BuildTestBase : IClassFixture<SharedBuildPerTestClassFixture>, IDisposable
{
protected const string s_targetFramework = "net6.0";
public const string DefaultTargetFramework = "net7.0";
public static readonly string NuGetConfigFileNameForDefaultFramework = $"nuget7.config";
protected static readonly bool s_skipProjectCleanup;
protected static readonly string s_xharnessRunnerCommand;
protected string? _projectDir;
Expand Down Expand Up @@ -128,7 +129,7 @@ protected string RunAndTestWasmApp(BuildArgs buildArgs,
int expectedExitCode = 0,
string? args = null,
Dictionary<string, string>? envVars = null,
string targetFramework = "net6.0")
string targetFramework = DefaultTargetFramework)
{
buildDir ??= _projectDir;
envVars ??= new();
Expand Down Expand Up @@ -246,14 +247,14 @@ protected static void InitProjectDir(string dir)
File.WriteAllText(Path.Combine(dir, "Directory.Build.props"), s_buildEnv.DirectoryBuildPropsContents);
File.WriteAllText(Path.Combine(dir, "Directory.Build.targets"), s_buildEnv.DirectoryBuildTargetsContents);

File.Copy(Path.Combine(BuildEnvironment.TestDataPath, "nuget6.config"), Path.Combine(dir, "nuget.config"));
File.Copy(Path.Combine(BuildEnvironment.TestDataPath, NuGetConfigFileNameForDefaultFramework), Path.Combine(dir, "nuget.config"));
Directory.CreateDirectory(Path.Combine(dir, ".nuget"));
}

protected const string SimpleProjectTemplate =
@$"<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
<TargetFramework>{s_targetFramework}</TargetFramework>
<TargetFramework>{DefaultTargetFramework}</TargetFramework>
<OutputType>Exe</OutputType>
<WasmGenerateRunV8Script>true</WasmGenerateRunV8Script>
<WasmMainJSPath>test-main.js</WasmMainJSPath>
Expand Down Expand Up @@ -342,7 +343,7 @@ protected static BuildArgs ExpandBuildArgs(BuildArgs buildArgs, string extraProp

if (options.ExpectSuccess)
{
string bundleDir = Path.Combine(GetBinDir(config: buildArgs.Config, targetFramework: options.TargetFramework ?? "net6.0"), "AppBundle");
string bundleDir = Path.Combine(GetBinDir(config: buildArgs.Config, targetFramework: options.TargetFramework ?? DefaultTargetFramework), "AppBundle");
AssertBasicAppBundle(bundleDir, buildArgs.ProjectName, buildArgs.Config, options.MainJS ?? "test-main.js", options.HasV8Script, options.HasIcudt, options.DotnetWasmFromRuntimePack ?? !buildArgs.AOT);
}

Expand All @@ -367,7 +368,7 @@ public void InitBlazorWasmProjectDir(string id)
Directory.CreateDirectory(_projectDir);
Directory.CreateDirectory(Path.Combine(_projectDir, ".nuget"));

File.Copy(Path.Combine(BuildEnvironment.TestDataPath, "nuget6.config"), Path.Combine(_projectDir, "nuget.config"));
File.Copy(Path.Combine(BuildEnvironment.TestDataPath, NuGetConfigFileNameForDefaultFramework), Path.Combine(_projectDir, "nuget.config"));
File.Copy(Path.Combine(BuildEnvironment.TestDataPath, "Blazor.Directory.Build.props"), Path.Combine(_projectDir, "Directory.Build.props"));
File.Copy(Path.Combine(BuildEnvironment.TestDataPath, "Blazor.Directory.Build.targets"), Path.Combine(_projectDir, "Directory.Build.targets"));
}
Expand Down Expand Up @@ -395,22 +396,22 @@ public string CreateBlazorWasmTemplateProject(string id)
return Path.Combine(_projectDir!, $"{id}.csproj");
}

protected (CommandResult, string) BlazorBuild(string id, string config, NativeFilesType expectedFileType, params string[] extraArgs)
protected (CommandResult, string) BlazorBuild(BlazorBuildOptions options, params string[] extraArgs)
{
var res = BuildInternal(id, config, publish: false, extraArgs);
AssertDotNetNativeFiles(expectedFileType, config, forPublish: false);
AssertBlazorBundle(config, isPublish: false, dotnetWasmFromRuntimePack: expectedFileType == NativeFilesType.FromRuntimePack);
var res = BuildInternal(options.Id, options.Config, publish: false, extraArgs);
AssertDotNetNativeFiles(options.ExpectedFileType, options.Config, forPublish: false, targetFramework: options.TargetFramework);
AssertBlazorBundle(options.Config, isPublish: false, dotnetWasmFromRuntimePack: options.ExpectedFileType == NativeFilesType.FromRuntimePack);

return res;
}

protected (CommandResult, string) BlazorPublish(string id, string config, NativeFilesType expectedFileType, params string[] extraArgs)
protected (CommandResult, string) BlazorPublish(BlazorBuildOptions options, params string[] extraArgs)
{
var res = BuildInternal(id, config, publish: true, extraArgs);
AssertDotNetNativeFiles(expectedFileType, config, forPublish: true);
AssertBlazorBundle(config, isPublish: true, dotnetWasmFromRuntimePack: expectedFileType == NativeFilesType.FromRuntimePack);
var res = BuildInternal(options.Id, options.Config, publish: true, extraArgs);
AssertDotNetNativeFiles(options.ExpectedFileType, options.Config, forPublish: true, targetFramework: options.TargetFramework);
AssertBlazorBundle(options.Config, isPublish: true, dotnetWasmFromRuntimePack: options.ExpectedFileType == NativeFilesType.FromRuntimePack);

if (expectedFileType == NativeFilesType.AOT)
if (options.ExpectedFileType == NativeFilesType.AOT)
{
// check for this too, so we know the format is correct for the negative
// test for jsinterop.webassembly.dll
Expand Down Expand Up @@ -445,10 +446,10 @@ public string CreateBlazorWasmTemplateProject(string id)
return (res, logPath);
}

protected void AssertDotNetNativeFiles(NativeFilesType type, string config, bool forPublish)
protected void AssertDotNetNativeFiles(NativeFilesType type, string config, bool forPublish, string targetFramework = DefaultTargetFramework)
{
string label = forPublish ? "publish" : "build";
string objBuildDir = Path.Combine(_projectDir!, "obj", config, "net6.0", "wasm", forPublish ? "for-publish" : "for-build");
string objBuildDir = Path.Combine(_projectDir!, "obj", config, targetFramework, "wasm", forPublish ? "for-publish" : "for-build");
string binFrameworkDir = FindBlazorBinFrameworkDir(config, forPublish);

string srcDir = type switch
Expand Down Expand Up @@ -630,7 +631,7 @@ protected void AssertBlazorBootJson(string config, bool isPublish, string? binFr
$"{msgPrefix} Could not find dotnet.*js in {bootJson}");
}

protected string FindBlazorBinFrameworkDir(string config, bool forPublish, string framework="net6.0")
protected string FindBlazorBinFrameworkDir(string config, bool forPublish, string framework = DefaultTargetFramework)
{
string basePath = Path.Combine(_projectDir!, "bin", config, framework);
if (forPublish)
Expand All @@ -652,14 +653,14 @@ private string FindSubDirIgnoringCase(string parentDir, string dirName)
return first ?? Path.Combine(parentDir, dirName);
}

protected string GetBinDir(string config, string targetFramework=s_targetFramework, string? baseDir=null)
protected string GetBinDir(string config, string targetFramework=DefaultTargetFramework, string? baseDir=null)
{
var dir = baseDir ?? _projectDir;
Assert.NotNull(dir);
return Path.Combine(dir!, "bin", config, targetFramework, "browser-wasm");
}

protected string GetObjDir(string config, string targetFramework=s_targetFramework, string? baseDir=null)
protected string GetObjDir(string config, string targetFramework=DefaultTargetFramework, string? baseDir=null)
{
var dir = baseDir ?? _projectDir;
Assert.NotNull(dir);
Expand Down Expand Up @@ -885,4 +886,12 @@ public record BuildProjectOptions
string? TargetFramework = null,
string? MainJS = null
);

public record BlazorBuildOptions
(
string Id,
string Config,
NativeFilesType ExpectedFileType,
string TargetFramework = BuildTestBase.DefaultTargetFramework
);
}
Loading

0 comments on commit 1d60246

Please sign in to comment.