Skip to content

Commit

Permalink
[wasm] Allow assemblies to be skipped for AOTMode=AotInterp (#49446)
Browse files Browse the repository at this point in the history
* [wasm] reduce visibility of `[AOT] /foo/bar.dll`  messages

* [wasm] Quote assembly path when invoking mono-aot-cross

* [wasm] WasmApp.*: Use the msbuild equivalent of `Path.Combine` in

.. the targets/props .

* [wasm] WasmApp.targets: Simplify emcc invocations a bit

* [wasm] WasmApp.targets: quote paths correctly

* [wasm] Add `%(WasmAssembliesToBundle._InternalForceInterpret)`

.. to allow skipping AOT, per assembly.

* [wasm] don't copy dotnet.* to appbundle unnecessarily

This was added earlier to support blazor workload which only uses AOT.
But that has since been fixed to correctly use
`WasmBuildApp`+`@(WasmNativeAsset)`, so this can be removed.

* [wasm] Add new `$(WasmNativeDebugSymbols)` that to get symbols with

.. dotnet.wasm . It defaults to `true`.

* [wasm] Check that EMSDK_PATH is set when building native files

* [wasm] Rename `@(_WasmAssemblies)` -> `@(_WasmAssembliesInternal)`

* [wasm] Fix sample build

* [wasm] Fix tests on helix - typo

* Address review feedback

* fix a missing quote

Co-authored-by: Larry Ewing <lewing@microsoft.com>
  • Loading branch information
radical and lewing authored Mar 11, 2021
1 parent 1d12854 commit e47b9b5
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 77 deletions.
4 changes: 2 additions & 2 deletions src/mono/wasm/build/WasmApp.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Platform>AnyCPU</Platform>
<EnableTargetingPackDownload>false</EnableTargetingPackDownload>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<MicrosoftNetCoreAppRuntimePackRidDir>$(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(Configuration)\runtimes\browser-wasm\</MicrosoftNetCoreAppRuntimePackRidDir>
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(MonoProjectRoot)' != ''">$(MonoProjectRoot)wasm\emsdk</EMSDK_PATH>
<MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(Configuration), 'runtimes', 'browser-wasm'))</MicrosoftNetCoreAppRuntimePackRidDir>
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))</EMSDK_PATH>

<RunAOTCompilation Condition="'$(RunAOTCompilation)' == ''">false</RunAOTCompilation>
<PublishTrimmed>true</PublishTrimmed>
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/build/WasmApp.InTree.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<Target Name="TrickRuntimePackLocation" AfterTargets="ProcessFrameworkReferences" Condition="@(RuntimePack->Count()) != 0">
<ItemGroup>
<RuntimePack>
<PackageDirectory>$(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(Configuration)</PackageDirectory>
<PackageDirectory>$([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(Configuration)))</PackageDirectory>
</RuntimePack>
</ItemGroup>
<Message Text="Using RuntimePack.PackageDirectory: %(RuntimePack.PackageDirectory)" Importance="Low" />
</Target>

<Target Name="RebuildWasmAppBuilder">
<ItemGroup>
<WasmAppBuildProject Include="$(RepoTasksDir)WasmAppBuilder\WasmAppBuilder.csproj" />
<WasmAppBuildProject Include="$([MSBuild]::NormalizePath($(RepoTasksDir), 'WasmAppBuilder', 'WasmAppBuilder.csproj'))" />
</ItemGroup>

<MSBuild Projects="@(WasmAppBuildProject)"
Expand All @@ -37,9 +37,9 @@
<!-- Helix properties -->
<!-- AnyCPU as Platform-->
<OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig>
<HelixArchiveRoot>$(ArtifactsDir)helix/</HelixArchiveRoot>
<HelixArchiveRunOnlyRoot>$(HelixArchiveRoot)runonly/</HelixArchiveRunOnlyRoot>
<HelixArchiveRunOnlyAppsDir>$(HelixArchiveRunOnlyRoot)$(OSPlatformConfig)/$(WasmHelixTestAppRelativeDir)/</HelixArchiveRunOnlyAppsDir>
<HelixArchiveRoot>$([MSBuild]::NormalizeDirectory($(ArtifactsDir), 'helix'))</HelixArchiveRoot>
<HelixArchiveRunOnlyRoot>$([MSBuild]::NormalizeDirectory($(HelixArchiveRoot), 'runonly'))</HelixArchiveRunOnlyRoot>
<HelixArchiveRunOnlyAppsDir>$([MSBuild]::NormalizeDirectory($(HelixArchiveRunOnlyRoot), $(OSPlatformConfig), $(WasmHelixTestAppRelativeDir)))</HelixArchiveRunOnlyAppsDir>
<ZippedApp>$(OutputPath)$(AssemblyName).zip</ZippedApp>
</PropertyGroup>
<ZipDirectory SourceDirectory="$(WasmAppDir)" DestinationFile="$(ZippedApp)" />
Expand Down
15 changes: 8 additions & 7 deletions src/mono/wasm/build/WasmApp.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ArtifactsBinDir>$(RuntimeSrcDir)\artifacts\bin\</ArtifactsBinDir>
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == ''">$(RuntimeSrcDir)\src\mono\wasm\emsdk\</EMSDK_PATH>

<MicrosoftNetCoreAppRuntimePackLocationToUse>$(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(RuntimeConfig)\</MicrosoftNetCoreAppRuntimePackLocationToUse>
<MicrosoftNetCoreAppRuntimePackLocationToUse>$([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(RuntimeConfig)))</MicrosoftNetCoreAppRuntimePackLocationToUse>

<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish'))</WasmAppBuilderDir>
<WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish'))</WasmBuildTasksDir>
Expand All @@ -39,19 +39,20 @@
<PropertyGroup Condition="'$(RuntimeSrcDir)' == '' and '$(WasmBuildSupportDir)' != ''">
<BuildBaseDir>$(WasmBuildSupportDir)\</BuildBaseDir>

<MicrosoftNetCoreAppRuntimePackLocationToUse>$(BuildBaseDir)microsoft.netcore.app.runtime.browser-wasm\</MicrosoftNetCoreAppRuntimePackLocationToUse>
<MonoAOTCompilerDir>$(BuildBaseDir)\MonoAOTCompiler\</MonoAOTCompilerDir>
<WasmAppBuilderDir>$(BuildBaseDir)\WasmAppBuilder\</WasmAppBuilderDir>
<WasmBuildTasksDir>$(BuildBaseDir)\WasmBuildTasks\</WasmBuildTasksDir>
<MicrosoftNetCoreAppRuntimePackLocationToUse>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'microsoft.netcore.app.runtime.browser-wasm'))</MicrosoftNetCoreAppRuntimePackLocationToUse>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'MonoAOTCompiler'))</MonoAOTCompilerDir>
<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'WasmAppBuilder'))</WasmAppBuilderDir>
<WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'WasmBuildTasks'))</WasmBuildTasksDir>
</PropertyGroup>

<PropertyGroup>
<MicrosoftNetCoreAppRuntimePackRidDir>$(MicrosoftNetCoreAppRuntimePackLocationToUse)runtimes\browser-wasm\</MicrosoftNetCoreAppRuntimePackRidDir>
<MonoAotCrossCompilerPath>$(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\$(RuntimeIdentifier)\mono-aot-cross</MonoAotCrossCompilerPath>
<MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', 'browser-wasm'))</MicrosoftNetCoreAppRuntimePackRidDir>
<MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidDir), 'native', 'cross', $(RuntimeIdentifier), 'mono-aot-cross'))</MonoAotCrossCompilerPath>
<MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(MonoAotCrossCompilerPath).exe</MonoAotCrossCompilerPath>

<WasmAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))</WasmAppBuilderTasksAssemblyPath>
<WasmBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmBuildTasksDir)', 'WasmBuildTasks.dll'))</WasmBuildTasksAssemblyPath>
<MonoAOTCompilerTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))</MonoAOTCompilerTasksAssemblyPath>
</PropertyGroup>

</Project>
10 changes: 10 additions & 0 deletions src/mono/wasm/build/WasmApp.LocalBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@
<Error Condition="'$(RuntimeSrcDir)' != '' and '$(RuntimeConfig)' == ''"
Text="%24(RuntimeSrcDir) is set, but %24(RuntimeConfig) is not" />

<PropertyGroup>
<MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', 'browser-wasm'))</MicrosoftNetCoreAppRuntimePackRidDir>
<MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidDir), 'native', 'cross', $(RuntimeIdentifier), 'mono-aot-cross'))</MonoAotCrossCompilerPath>
<MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(MonoAotCrossCompilerPath).exe</MonoAotCrossCompilerPath>

<WasmAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))</WasmAppBuilderTasksAssemblyPath>
<WasmBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmBuildTasksDir)', 'WasmBuildTasks.dll'))</WasmBuildTasksAssemblyPath>
<MonoAOTCompilerTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))</MonoAOTCompilerTasksAssemblyPath>
</PropertyGroup>

<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')"
Text="Cannot find runtime pack at $(MicrosoftNetCoreAppRuntimePackRidDir). Make sure you have the correct %24(RuntimeConfig) set" />

Expand Down
Loading

0 comments on commit e47b9b5

Please sign in to comment.