Skip to content

Commit

Permalink
WasmAppBuilder: Use $(CopyLocalLockFileAssemblies) instead of
Browse files Browse the repository at this point in the history
.. explcitly invoking `Publish`.

Based on @ericstj's suggestion
#58816 (comment) .

Fixes #58816 .
  • Loading branch information
radical committed Sep 15, 2021
1 parent c705b70 commit 4d2eab4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)'))</AppleAppBuilderDir>
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</AndroidAppBuilderDir>
<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</WasmAppBuilderDir>
<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)'))</WasmAppBuilderDir>
<WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</WasmBuildTasksDir>
<WorkloadBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WorkloadBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</WorkloadBuildTasksDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/build/WasmApp.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

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

<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish'))</WasmAppBuilderDir>
<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)'))</WasmAppBuilderDir>
<WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish'))</WasmBuildTasksDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(_NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
<RuntimeConfigParserDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'RuntimeConfigParser', 'Debug', '$(_NetCoreAppToolCurrent)'))</RuntimeConfigParserDir>
Expand Down
19 changes: 3 additions & 16 deletions src/tasks/WasmAppBuilder/WasmAppBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- Ignore nullable warnings on net4* -->
<NoWarn Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">$(NoWarn),CS8604,CS8602</NoWarn>
<EnableSingleFileAnalyzer>false</EnableSingleFileAnalyzer>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand All @@ -23,30 +24,16 @@
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="4.7.1" />
</ItemGroup>

<Target Name="PublishBuilder"
AfterTargets="Build"
Condition="'$(_RunningForPublishBuilder)' != 'true'">

<!-- needed for publishing with multi-targeting. We are publishing essentially to get the SR.MetadataLoadContext.dll :/ -->
<ItemGroup>
<_PublishFramework Include="$(TargetFrameworks)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Publish" Properties="TargetFramework=%(_PublishFramework.Identity);_RunningForPublishBuilder=true" />
</Target>

<Target Name="GetFilesToPackage" Returns="@(FilesToPackage)">
<ItemGroup>
<_PublishFramework Remove="@(_PublishFramework)" />
<_PublishFramework Include="$(TargetFrameworks)" />

<!-- non-net4* -->
<FilesToPackage Include="$(OutputPath)$(TargetFrameworkForNETCoreTasks)\$(MSBuildProjectName)*"
TargetPath="tasks\$(TargetFrameworkForNETCoreTasks)" />
<FilesToPackage Include="$(OutputPath)$(TargetFrameworkForNETCoreTasks)\publish\System.Reflection.MetadataLoadContext.dll"
<FilesToPackage Include="$(OutputPath)$(TargetFrameworkForNETCoreTasks)\System.Reflection.MetadataLoadContext.dll"
TargetPath="tasks\$(TargetFrameworkForNETCoreTasks)" />

<!-- for net472 we need all the dependent assemblies too, so copy from the publish folder -->
<FilesToPackage Include="$(OutputPath)$(TargetFrameworkForNETFrameworkTasks)\publish\*"
<FilesToPackage Include="$(OutputPath)$(TargetFrameworkForNETFrameworkTasks)\*"
TargetPath="tasks\$(TargetFrameworkForNETFrameworkTasks)" />
</ItemGroup>
</Target>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/Common/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

<!-- Wasm App Builder always builds in Debug -->
<RunTimeDependencyCopyLocal
Include="$(ArtifactsBinDir)\WasmAppBuilder\Debug\$(NetCoreAppToolCurrent)\publish\**"
Include="$(ArtifactsBinDir)\WasmAppBuilder\Debug\$(NetCoreAppToolCurrent)\**"
TargetDir="WasmAppBuilder/"/>

<RunTimeDependencyCopyLocal
Expand Down
2 changes: 1 addition & 1 deletion src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@

<!-- Wasm App Builder always builds in Debug -->
<RunTimeDependencyCopyLocal
Include="$(ArtifactsBinDir)\WasmAppBuilder\Debug\$(NetCoreAppToolCurrent)\publish\**"
Include="$(ArtifactsBinDir)\WasmAppBuilder\Debug\$(NetCoreAppToolCurrent)\**"
TargetDir="WasmAppBuilder/"/>

<!-- MonoAOTCompiler always builds in Debug -->
Expand Down

0 comments on commit 4d2eab4

Please sign in to comment.