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
4 changes: 1 addition & 3 deletions src/mono/browser/build/WasmApp.InTree.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project>
<!-- This depends on the root Directory.Build.props imported this file -->
<PropertyGroup>
<UsingMicrosoftNETSdkWebAssembly>true</UsingMicrosoftNETSdkWebAssembly>

<WasmCommonTargetsPath Condition="Exists('$(MSBuildThisFileDirectory)WasmApp.Common.props')">$(MSBuildThisFileDirectory)</WasmCommonTargetsPath>
<WasmCommonTargetsPath Condition="'$(WasmCommonTargetsPath)' == ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'build'))</WasmCommonTargetsPath>

Expand All @@ -11,7 +9,7 @@
<_WebAssemblySdkToolsDirectory Condition="'$(_WebAssemblySdkToolsDirectory)' == ''">$(ArtifactsBinDir)\Microsoft.NET.Sdk.WebAssembly.Pack.Tasks\$(RuntimeConfiguration)\</_WebAssemblySdkToolsDirectory>
</PropertyGroup>

<Import Sdk="Microsoft.NET.Sdk.WebAssembly" Project="Sdk.props" Condition="'$(UsingNativeAOT)' != 'true' and '$(UsingMicrosoftNETSdkWebAssembly)' == 'true'" />
<Import Sdk="Microsoft.NET.Sdk.WebAssembly" Project="Sdk.props" Condition="'$(UsingNativeAOT)' != 'true' and '$(UsingMicrosoftNETSdkWebAssembly)' != 'true'" />
<Import Project="$(MSBuildThisFileDirectory)BrowserWasmApp.props" Condition="'$(UsingNativeAOT)' != 'true'" />

<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsOutputTypeLibrary)' == 'true'">
Expand Down
2 changes: 1 addition & 1 deletion src/mono/browser/build/WasmApp.InTree.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<UsingTask TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" TaskFactory="TaskHostFactory" />
<UsingTask TaskName="ILStrip" AssemblyFile="$(MonoTargetsTasksAssemblyPath)" TaskFactory="TaskHostFactory" />

<Import Sdk="Microsoft.NET.Sdk.WebAssembly" Project="Sdk.targets" Condition="'$(UsingNativeAOT)' != 'true' and '$(UsingMicrosoftNETSdkWebAssembly)' == 'true'" />
<Import Sdk="Microsoft.NET.Sdk.WebAssembly" Project="Sdk.targets" Condition="'$(UsingNativeAOT)' != 'true' and '$(UsingMicrosoftNETSdkWebAssembly)' != 'true'" />

<!-- TODO: this breaks runtime tests on Helix due to the file not being there for some reason. Once this is fixed we can remove the UpdateRuntimePack target here -->
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" Condition="'$(TargetingpacksTargetsImported)' != 'true' and '$(ImportTargetingPacksTargetsInWasmAppTargets)' == 'true'"/>
Expand Down
23 changes: 13 additions & 10 deletions src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,20 @@ protected void InitProjectDir(string dir, bool addNuGetSourceForLocalPackages =
if (UseWBTOverridePackTargets)
File.Copy(BuildEnvironment.WasmOverridePacksTargetsPath, Path.Combine(dir, Path.GetFileName(BuildEnvironment.WasmOverridePacksTargetsPath)), overwrite: true);

string targetNuGetConfigPath = Path.Combine(dir, "nuget.config");
if (addNuGetSourceForLocalPackages)
if (!EnvironmentVariables.UseInTree)
{
File.WriteAllText(targetNuGetConfigPath,
GetNuGetConfigWithLocalPackagesPath(
GetNuGetConfigPath(),
s_buildEnv.BuiltNuGetsPath));
}
else
{
File.Copy(GetNuGetConfigPath(), targetNuGetConfigPath);
string targetNuGetConfigPath = Path.Combine(dir, "nuget.config");
if (addNuGetSourceForLocalPackages)
{
File.WriteAllText(targetNuGetConfigPath,
GetNuGetConfigWithLocalPackagesPath(
GetNuGetConfigPath(),
s_buildEnv.BuiltNuGetsPath));
}
else
{
File.Copy(GetNuGetConfigPath(), targetNuGetConfigPath);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ internal static class EnvironmentVariables
internal static readonly string? SdkDirName = Environment.GetEnvironmentVariable("SDK_DIR_NAME");
internal static readonly string? WasiSdkPath = Environment.GetEnvironmentVariable("WASI_SDK_PATH");
internal static readonly bool WorkloadsTestPreviousVersions = Environment.GetEnvironmentVariable("WORKLOADS_TEST_PREVIOUS_VERSIONS") is "true";
internal static readonly bool UseInTree = Environment.GetEnvironmentVariable("TEST_USING_IN_TREE") == "true";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,29 @@
""";
}

if (EnvironmentVariables.UseInTree)
{
s_buildEnv.EnvVars["WBTImportInTree"] = "true";
}

UpdateProjectFile(projectFilePath, runAnalyzers, extraProperties, extraItems, insertAtEnd);
return new ProjectInfo(asset.Name, projectFilePath, logPath, nugetDir);
}

protected void CopyTestOutputToProject(TestAsset targetAsset)
{
TestAsset sourceAsset = TestAsset.WasmBasicTestApp;
var testOutputFilePath = Path.Combine(BuildEnvironment.TestAssetsPath, sourceAsset.Name, sourceAsset.RunnableProjectSubPath, "Common", "TestOutput.cs");

var destinationFilePath = _projectDir;
if (!string.IsNullOrEmpty(targetAsset.RunnableProjectSubPath))
destinationFilePath = Path.Combine(destinationFilePath, targetAsset.RunnableProjectSubPath);

destinationFilePath = Path.Combine(destinationFilePath, "TestOutput.cs");

File.Copy(testOutputFilePath, destinationFilePath, overwrite: true);
}

private void UpdateProjectFile(string projectFilePath, bool runAnalyzers, string extraProperties, string extraItems, string insertAtEnd)
{
extraProperties += "<TreatWarningsAsErrors>true</TreatWarningsAsErrors>";
Expand Down Expand Up @@ -328,7 +347,7 @@
RunHost.WebServer =>
await BrowserRunTest($"{s_xharnessRunnerCommand} wasm webserver --app=. --web-server-use-default-files",
string.IsNullOrEmpty(runOptions.CustomBundleDir) ?
Path.GetFullPath(Path.Combine(GetBinFrameworkDir(runOptions.Configuration, forPublish: true), "..")) :
Path.GetFullPath(Path.Combine(GetBinFrameworkDir(runOptions.Configuration, forPublish: true, _provider.DefaultTargetFramework), "..")) :

Check failure on line 350 in src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTestsBase.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release SingleThreaded_BuildOnly)

src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTestsBase.cs#L350

src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTestsBase.cs(350,132): error CS1061: (NETCORE_ENGINEERING_TELEMETRY=Build) 'WasmSdkBasedProjectProvider' does not contain a definition for 'DefaultTargetFramework' and no accessible extension method 'DefaultTargetFramework' accepting a first argument of type 'WasmSdkBasedProjectProvider' could be found (are you missing a using directive or an assembly reference?)
runOptions.CustomBundleDir,
runOptions),

Expand Down
9 changes: 8 additions & 1 deletion src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- This project should not build against the live built .NETCoreApp targeting pack as it contributes to the build itself. -->
<UseLocalTargetingRuntimePack>false</UseLocalTargetingRuntimePack>

<TestUsingWorkloads Condition="'$(TestUsingWorkloads)' == ''">true</TestUsingWorkloads>
<TestUsingWorkloads Condition="'$(TestUsingWorkloads)' == '' and '$(TestUsingInTree)' == ''">true</TestUsingWorkloads>
<!-- these are imported in this project instead -->
<SkipWorkloadsTestingTargetsImport>false</SkipWorkloadsTestingTargetsImport>
<InstallWorkloadForTesting>true</InstallWorkloadForTesting>
Expand Down Expand Up @@ -109,6 +109,9 @@
<RunScriptCommands Condition="'$(OS)' != 'Windows_NT'" Include="export TEST_USING_WORKLOADS=$(TestUsingWorkloads)" />
<RunScriptCommands Condition="'$(OS)' == 'Windows_NT'" Include="set TEST_USING_WORKLOADS=$(TestUsingWorkloads)" />

<RunScriptCommands Condition="'$(OS)' != 'Windows_NT'" Include="export TEST_USING_IN_TREE=$(TestUsingInTree)" />
<RunScriptCommands Condition="'$(OS)' == 'Windows_NT'" Include="set TEST_USING_IN_TREE=$(TestUsingInTree)" />

<RunScriptCommands Condition="'$(OS)' != 'Windows_NT'" Include="export SDK_DIR_NAME=$(_SdkPathForLocalTesting)" />
<RunScriptCommands Condition="'$(OS)' == 'Windows_NT'" Include="set SDK_DIR_NAME=$(_SdkPathForLocalTesting)" />

Expand Down Expand Up @@ -136,6 +139,10 @@
<RunScriptCommands Condition="'$(OS)' != 'Windows_NT'" Include="export BUILT_NUGETS_PATH=$(LibrariesShippingPackagesDir)/" />
<RunScriptCommands Condition="'$(OS)' == 'Windows_NT'" Include="set BUILT_NUGETS_PATH=$(LibrariesShippingPackagesDir)" />
</ItemGroup>
<ItemGroup Condition="'$(TestUsingInTree)' == 'true'">
<RunScriptCommands Condition="'$(OS)' != 'Windows_NT'" Include="export SDK_FOR_WORKLOAD_TESTING_PATH=$(NetCoreRoot)" />
<RunScriptCommands Condition="'$(OS)' == 'Windows_NT'" Include="set SDK_FOR_WORKLOAD_TESTING_PATH=$(NetCoreRoot)" />
</ItemGroup>

<PropertyGroup>
<!-- Wasm.Build.Tests are not a shipping project, PackageVersion will have a version suffix even for release branch, where actual runtime pack version doesn't have version suffix. Copy & paste to Wasi.Build.Tests -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
<Project />
<Project>

<Import Project="..\..\..\..\..\..\..\..\Directory.Build.props" Condition="'$(WBTImportInTree)' == 'true'" />

<PropertyGroup Condition="'$(WBTImportInTree)' == 'true'">
<OutputPath>bin\$(Configuration)</OutputPath>
</PropertyGroup>

<Import Project="$(BrowserProjectRoot)build\WasmApp.InTree.props" Condition="'$(WBTImportInTree)' == 'true'" />

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<Project>

<Target Name="PrintRuntimePackPath" BeforeTargets="Build">
<Message Text="** MicrosoftNetCoreAppRuntimePackDir : '@(ResolvedRuntimePack -> '%(PackageDirectory)')'" Importance="High" Condition="@(ResolvedRuntimePack->Count()) > 0" />
</Target>

<ImportGroup Condition="'$(WBTImportInTree)' == 'true'">
<Import Project="..\..\..\..\..\..\..\..\Directory.Build.targets" />
<Import Project="$(BrowserProjectRoot)build\WasmApp.InTree.targets" />
</ImportGroup>

</Project>
16 changes: 9 additions & 7 deletions src/mono/wasm/Wasm.Build.Tests/data/RunScriptTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ if [%WASM_BUNDLER_FRIENDLY_BOOT_CONFIG%] == [true] (
set USE_JAVASCRIPT_BUNDLER_FOR_TESTS=false
)

if [%HELIX_CORRELATION_PAYLOAD%] NEQ [] (
robocopy /mt /np /nfl /NDL /nc /e %BASE_DIR%\%SDK_DIR_NAME% %EXECUTION_DIR%\%SDK_DIR_NAME%
set _SDK_DIR=%EXECUTION_DIR%\%SDK_DIR_NAME%
) else (
set _SDK_DIR=%BASE_DIR%\%SDK_DIR_NAME%
)
if [%SDK_FOR_WORKLOAD_TESTING_PATH%] == [] (
if [%HELIX_CORRELATION_PAYLOAD%] NEQ [] (
robocopy /mt /np /nfl /NDL /nc /e %BASE_DIR%\%SDK_DIR_NAME% %EXECUTION_DIR%\%SDK_DIR_NAME%
set _SDK_DIR=%EXECUTION_DIR%\%SDK_DIR_NAME%
) else (
set _SDK_DIR=%BASE_DIR%\%SDK_DIR_NAME%
)

set "SDK_FOR_WORKLOAD_TESTING_PATH=%_SDK_DIR%"
set "SDK_FOR_WORKLOAD_TESTING_PATH=%_SDK_DIR%"
)
EXIT /b 0
18 changes: 10 additions & 8 deletions src/mono/wasm/Wasm.Build.Tests/data/RunScriptTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ function set_env_vars()
export USE_JAVASCRIPT_BUNDLER_FOR_TESTS=false
fi

local _SDK_DIR=
if [[ -n "$HELIX_WORKITEM_UPLOAD_ROOT" ]]; then
cp -r $BASE_DIR/$SDK_DIR_NAME $EXECUTION_DIR
_SDK_DIR=$EXECUTION_DIR/$SDK_DIR_NAME
else
_SDK_DIR=$BASE_DIR/$SDK_DIR_NAME
if [ "x$SDK_FOR_WORKLOAD_TESTING_PATH" = "x" ]; then
local _SDK_DIR=
if [[ -n "$HELIX_WORKITEM_UPLOAD_ROOT" ]]; then
cp -r $BASE_DIR/$SDK_DIR_NAME $EXECUTION_DIR
_SDK_DIR=$EXECUTION_DIR/$SDK_DIR_NAME
else
_SDK_DIR=$BASE_DIR/$SDK_DIR_NAME
fi

export SDK_FOR_WORKLOAD_TESTING_PATH=$_SDK_DIR
fi

export SDK_FOR_WORKLOAD_TESTING_PATH=$_SDK_DIR
}

export TEST_LOG_PATH=${XHARNESS_OUT}/logs
Expand Down
Loading