Skip to content

Commit

Permalink
fix: Adjust skiasharp loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Sep 10, 2024
1 parent dce3eab commit 03c9b17
Show file tree
Hide file tree
Showing 2 changed files with 278 additions and 233 deletions.
63 changes: 3 additions & 60 deletions src/.nuspec/Uno.Resizetizer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
</ItemGroup>

<PropertyGroup>
<_UnoResizetizerTaskAssemblyName>$(MSBuildThisFileDirectory)netstandard2.0\Uno.Resizetizer_v0.dll</_UnoResizetizerTaskAssemblyName>
<_UnoResizetizerTaskAssemblyName Condition=" '$(MSBuildRuntimeType)' != 'Core' ">$(MSBuildThisFileDirectory)netstandard2.0\Uno.Resizetizer_v0.dll</_UnoResizetizerTaskAssemblyName>
<_UnoResizetizerTaskAssemblyName Condition=" '$(MSBuildRuntimeType)' == 'Core' ">$(MSBuildThisFileDirectory)net6.0\Uno.Resizetizer_v0.dll</_UnoResizetizerTaskAssemblyName>
</PropertyGroup>

<UsingTask
Expand Down Expand Up @@ -273,8 +274,7 @@


<Target Name="ValidateAvailableItems"
BeforeTargets="UnoResizetizeCollectItems"
DependsOnTargets="_ResizetizerInitialize">
BeforeTargets="UnoResizetizeCollectItems">

<Warning
Condition="'%(UnoIcon.Link)' != ''"
Expand Down Expand Up @@ -619,61 +619,4 @@
</ItemGroup>
</Target>

<!--
This is used to get and copy the native runtime assets. This is a workaround as the assets aren't properly loading
Executed before UnoResizetizeImages for TargetFrameworks=='' and TargetFramework!=''
Executed before _SetBuildInnerTarget;_ComputeTargetFrameworkItems for TargetFrameworks!='' and TargetFramework==''
-->
<Target Name="_ResizetizerInitialize"
BeforeTargets="UnoResizetizeImages;_SetBuildInnerTarget;_ComputeTargetFrameworkItems">
<PropertyGroup>
<_ResizetizerRuntimeIdentifier>$(NETCoreSdkPortableRuntimeIdentifier)</_ResizetizerRuntimeIdentifier>
<!-- NOTE: We may need to adjust this in the future if we end up with assets compiled for osx-arm64 and osx-x64 -->
<_ResizetizerRuntimeIdentifier Condition=" $(_ResizetizerRuntimeIdentifier.Contains('osx')) ">osx</_ResizetizerRuntimeIdentifier>
<_ResizetizerRuntimeIdentifierDirectory>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', 'netstandard2.0', 'runtimes', '$(_ResizetizerRuntimeIdentifier)'))</_ResizetizerRuntimeIdentifierDirectory>
<_ResizetizerRuntimeAssetsOutput>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', 'netstandard2.0'))</_ResizetizerRuntimeAssetsOutput>
</PropertyGroup>

<ItemGroup>
<_ResiztizerRuntimeAssets Include="$(_ResizetizerRuntimeIdentifierDirectory)\**\*"
OutputDirectory="$(_ResizetizerRuntimeAssetsOutput)" />
</ItemGroup>

<Error Text="No Runtime was found."
Condition="$(_ResizetizerRuntimeIdentifier) == ''" />

<Error Text="The selected runtime directory does not exist"
Condition="!Exists('$(_ResizetizerRuntimeIdentifierDirectory)')" />

<!--
Try to copy files with one retry, fail fast and ignore the error if this happens, then retry
copying the files in a second time. This is present to avoid a race condition during
cross-targeted builds when this current target is executed concurrently.
When running, the Copy task may detect that files are not present for two
threads/processes, then assume it's safe to copy, while only one of them can do
so. Later on, the copied files may be locked by dotnet/msbuild and the other copy
instance never finishes sucessfully, regardless of SkipUnchangedFiles.
-->
<Copy SourceFiles="@(_ResiztizerRuntimeAssets)"
DestinationFiles="@(_ResiztizerRuntimeAssets->'%(OutputDirectory)\%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
OverwriteReadOnlyFiles="true"
Condition="Exists('$(_ResizetizerRuntimeIdentifierDirectory)')"
UseHardlinksIfPossible="true"
ContinueOnError="true"
Retries="1"
UseSymboliclinksIfPossible="true" />

<Copy SourceFiles="@(_ResiztizerRuntimeAssets)"
DestinationFiles="@(_ResiztizerRuntimeAssets->'%(OutputDirectory)\%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
OverwriteReadOnlyFiles="true"
Condition="Exists('$(_ResizetizerRuntimeIdentifierDirectory)')"
UseHardlinksIfPossible="true"
UseSymboliclinksIfPossible="true" />

</Target>

</Project>
Loading

0 comments on commit 03c9b17

Please sign in to comment.