Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved UnoSplashScreen Target #138

Merged
merged 2 commits into from
May 18, 2023
Merged
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
88 changes: 59 additions & 29 deletions src/.nuspec/Uno.Resizetizer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,11 @@
</GetUnoAssetPath_v0>
</Target>

<Target Name="ProcessUnoSplashScreens"
Condition="'@(UnoSplashScreen)' != '' And '$(DesignTimeBuild)' != 'true'">
<Target Name="GenerateUnoSplashScreens"
BeforeTargets="ProcessUnoSplashScreens"
Condition="'@(UnoSplashScreen)' != '' And '$(DesignTimeBuild)' != 'true'"
Inputs="$(_UnoSplashInputsFile);@(UnoSplashScreen)"
Outputs="$(_UnoSplashStampFile)">

<Warning
Condition="'@(UnoSplashScreen->Count())' &gt; '1'"
Expand All @@ -385,7 +388,6 @@
</ItemGroup>

<!--Wasm-->

<GenerateWasmSplashAssets_v0
Condition="$(_ResizetizerIsWasmApp) == 'True'"
IntermediateOutputPath="$(_UnoIntermediateSplashScreen)"
Expand All @@ -398,34 +400,32 @@

</GenerateWasmSplashAssets_v0>

<ItemGroup Condition="$(_ResizetizerIsWasmApp) == 'True' And $(UserAppManifest) != ''">
<EmbeddedResource Remove="$(UserAppManifest)" />
<EmbeddedResource Include="$(_UnoIntermediateAppManifestWasm)"
Link="$(UserAppManifest)"/>
</ItemGroup>
<!-- Cache the $(UserAppManifest) value to be used on incremental builds-->
<WriteLinesToFile
Condition="$(_ResizetizerIsWasmApp) == 'True'"
File="$(_UnoManifestStampFile)"
Lines="$(UserAppManifest)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />

<!-- Android -->
<GenerateSplashAndroidResources_v0
Condition="'$(_ResizetizerIsAndroidApp)' == 'True'"
IntermediateOutputPath="$(_UnoIntermediateSplashScreen)"
UnoSplashScreen="@(UnoSplashScreen)"
/>
<ItemGroup Condition="'$(_ResizetizerIsAndroidApp)' == 'True'">
<LibraryResourceDirectories Condition="Exists('$(_UnoIntermediateSplashScreen)')" Include="$(_UnoIntermediateSplashScreen)">
<StampFile>$(_ResizetizerStampFile)</StampFile>
</LibraryResourceDirectories>
<FileWrites Include="$(_UnoIntermediateSplashScreen)**\*" />
</ItemGroup>

<!-- iOS, but not Catalyst -->
<GenerateSplashStoryboard_v0
Condition="'$(_ResizetizerIsiOSApp)' == 'True' and '$(TargetPlatformIdentifier)' != 'maccatalyst'"
OutputFile="$(_UnoIntermediateStoryboard)"
UnoSplashScreen="@(UnoSplashScreen)"
/>

<PropertyGroup Condition="'$(_ResizetizerIsiOSApp)' == 'True' and '$(TargetPlatformIdentifier)' != 'maccatalyst'">
<_UnoIntermediateSplashScreenFile>$(_UnoIntermediateStoryboard)</_UnoIntermediateSplashScreenFile>
</PropertyGroup>

<ItemGroup Condition="'$(_ResizetizerIsiOSApp)' == 'True' and '$(TargetPlatformIdentifier)' != 'maccatalyst'">
<InterfaceDefinition Include="$(_UnoIntermediateStoryboard)" Link="$([System.IO.Path]::GetFileName($(_UnoIntermediateStoryboard)))" />
<FileWrites Include="$(_UnoIntermediateStoryboard)" />
Expand All @@ -438,6 +438,51 @@
PlistName="UnoInfo.plist"
Storyboard="$(_UnoIntermediateSplashScreenFile)" />


<!-- UWP / WinUI -->
<ItemGroup Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'">
<UnoWindowsSplash Include="@(UnoSplashScreen)" Link=""/>
</ItemGroup>
<GenerateSplashAssets_v0
Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'"
IntermediateOutputPath="$(_UnoIntermediateSplashScreen)"
UnoSplashScreen="@(UnoWindowsSplash)"
/>

<MakeDir Directories="$(IntermediateOutputPath)"/>
<!-- Stamp file for Outputs -->
<Touch Files="$(_UnoSplashStampFile)" AlwaysCreate="True" />
<ItemGroup>
<FileWrites Include="$(_UnoSplashStampFile)" />
</ItemGroup>
</Target>

<Target Name="ProcessUnoSplashScreens"
Condition="'@(UnoSplashScreen)' != '' And '$(DesignTimeBuild)' != 'true'">

<!-- Wasm -->
<ReadLinesFromFile
File="$(_UnoManifestStampFile)"
Condition="$(_ResizetizerIsWasmApp) == 'True' And '$(UserAppManifest)' == ''">
<Output TaskParameter="Lines" PropertyName="UserAppManifest" />
</ReadLinesFromFile>

<ItemGroup Condition="$(_ResizetizerIsWasmApp) == 'True' And $(UserAppManifest) != ''">
<EmbeddedResource Remove="$(UserAppManifest)" />
<EmbeddedResource Include="$(_UnoIntermediateAppManifestWasm)"
Link="$(UserAppManifest)"/>
</ItemGroup>

<!-- Android -->
<ItemGroup Condition="'$(_ResizetizerIsAndroidApp)' == 'True'">
<LibraryResourceDirectories Condition="Exists('$(_UnoIntermediateSplashScreen)')" Include="$(_UnoIntermediateSplashScreen)">
<StampFile>$(_ResizetizerStampFile)</StampFile>
</LibraryResourceDirectories>
<FileWrites Include="$(_UnoIntermediateSplashScreen)**\*" />
</ItemGroup>


<!-- iOS, but not Catalyst -->
<ItemGroup Condition="'$(_ResizetizerIsiOSApp)' == 'True' ">
<_UnoSplashPListFiles Include="$(_UnoIntermediateSplashScreen)UnoInfo.plist" Condition="Exists('$(_UnoIntermediateSplashScreen)UnoInfo.plist')" />
<PartialAppManifest Include="@(_UnoSplashPListFiles)" Condition="'@(_UnoSplashPListFiles)' != ''" />
Expand All @@ -455,28 +500,13 @@
Files="@(_UnoAssetsToCopyToBuildServer)" />

<!-- UWP / WinUI -->
<ItemGroup Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'">
<UnoWindowsSplash Include="@(UnoSplashScreen)" Link=""/>
</ItemGroup>
<GenerateSplashAssets_v0
Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'"
IntermediateOutputPath="$(_UnoIntermediateSplashScreen)"
UnoSplashScreen="@(UnoWindowsSplash)"
/>
<ItemGroup Condition="'$(_ResizetizerIsUWPApp)' == 'True' Or '$(_ResizetizerIsWindowsAppSdk)' == 'True' Or '$(_ResizetizerIsSkiaApp)' == 'True'">
<_UnoSplashAssets Include="$(_UnoIntermediateSplashScreen)**\*" />
<ContentWithTargetPath Include="@(_UnoSplashAssets)">
<TargetPath>%(_UnoSplashAssets.Filename)%(_UnoSplashAssets.Extension)</TargetPath>
</ContentWithTargetPath>
<FileWrites Include="@(_UnoSplashAssets)" />
</ItemGroup>

<MakeDir Directories="$(IntermediateOutputPath)"/>
<!-- Stamp file for Outputs -->
<Touch Files="$(_UnoSplashStampFile)" AlwaysCreate="True" />
<ItemGroup>
<FileWrites Include="$(_UnoSplashStampFile)" />
</ItemGroup>
</Target>

<Target Name="ResizetizeImages_v0"
Expand Down