Skip to content

Commit

Permalink
Merge pull request #138 from unoplatform/pj/improve-build-task-for-un…
Browse files Browse the repository at this point in the history
…osplash

Improved UnoSplashScreen Target
  • Loading branch information
dansiegel authored May 18, 2023
2 parents 4ee99cb + 956b023 commit 0c05d22
Showing 1 changed file with 59 additions and 29 deletions.
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

0 comments on commit 0c05d22

Please sign in to comment.