Skip to content

Commit

Permalink
Move the Blazor workaround into WASM (#3082) (#3087)
Browse files Browse the repository at this point in the history
The workaround needed for WASM is not really Blazor specific
and if the project is not using the Blazor views, the fix will not
be applied to the build.

(cherry picked from commit 32fbf8d)

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
  • Loading branch information
github-actions[bot] and mattleibow authored Nov 27, 2024
1 parent ba36ede commit 2273b1e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,22 @@
<NativeFileReference Include="$(HarfBuzzSharpStaticLibraryPath)\3.1.56\$(_HarfBuzzSharpNativeBinaryType)\*.a" Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '9.0'))" />
</ItemGroup>

<!-- Workaround for https://github.com/dotnet/runtime/issues/109289 -->
<Target Name="RuntimeIssue109289_Workaround"
AfterTargets="_BrowserWasmWriteRspForLinking">
<ItemGroup>
<_WasmLinkStepArgs Remove="@(_EmccLinkStepArgs)" />
<_EmccLinkStepArgs Remove="&quot;%(_WasmNativeFileForLinking.Identity)&quot;" />
<_WasmLinkDependencies Remove="@(_WasmNativeFileForLinking)" />

<_SkiaSharpToReorder Include="@(_WasmNativeFileForLinking)" Condition="$([System.String]::Copy('%(FullPath)').Contains('libSkiaSharp.a'))" />
<_WasmNativeFileForLinking Remove="@(_SkiaSharpToReorder)" />
<_WasmNativeFileForLinking Include="@(_SkiaSharpToReorder)" />

<_EmccLinkStepArgs Include="&quot;%(_WasmNativeFileForLinking.Identity)&quot;" />
<_WasmLinkDependencies Include="@(_WasmNativeFileForLinking)" />
<_WasmLinkStepArgs Include="@(_EmccLinkStepArgs)" />
</ItemGroup>
</Target>

</Project>
19 changes: 18 additions & 1 deletion binding/IncludeNativeAssets.SkiaSharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,24 @@
<NativeFileReference Include="$(MSBuildThisFileDirectory)..\output\native\wasm\libSkiaSharp.a\3.1.12\$(_SkiaSharpNativeBinaryType)\*.a" Condition="$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0'))" />
<NativeFileReference Include="$(MSBuildThisFileDirectory)..\output\native\wasm\libSkiaSharp.a\3.1.34\$(_SkiaSharpNativeBinaryType)\*.a" Condition="$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0'))" />
<NativeFileReference Include="$(MSBuildThisFileDirectory)..\output\native\wasm\libSkiaSharp.a\3.1.56\$(_SkiaSharpNativeBinaryType)\*.a" Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '9.0'))" />

</ItemGroup>

<!-- Workaround for https://github.com/dotnet/runtime/issues/109289 -->
<Target Name="RuntimeIssue109289_Workaround"
AfterTargets="_BrowserWasmWriteRspForLinking">
<ItemGroup>
<_WasmLinkStepArgs Remove="@(_EmccLinkStepArgs)" />
<_EmccLinkStepArgs Remove="&quot;%(_WasmNativeFileForLinking.Identity)&quot;" />
<_WasmLinkDependencies Remove="@(_WasmNativeFileForLinking)" />

<_SkiaSharpToReorder Include="@(_WasmNativeFileForLinking)" Condition="$([System.String]::Copy('%(FullPath)').Contains('libSkiaSharp.a'))" />
<_WasmNativeFileForLinking Remove="@(_SkiaSharpToReorder)" />
<_WasmNativeFileForLinking Include="@(_SkiaSharpToReorder)" />

<_EmccLinkStepArgs Include="&quot;%(_WasmNativeFileForLinking.Identity)&quot;" />
<_WasmLinkDependencies Include="@(_WasmNativeFileForLinking)" />
<_WasmLinkStepArgs Include="@(_EmccLinkStepArgs)" />
</ItemGroup>
</Target>

</Project>

0 comments on commit 2273b1e

Please sign in to comment.