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

Refactoring the MSBuild tasks #158

Merged
merged 9 commits into from
Jul 28, 2023
41 changes: 41 additions & 0 deletions src/.nuspec/Uno.Resizetizer.android.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project>
<Target
Name="GenerateUnoSplashAndroid"
AfterTargets="GenerateUnoSplashScreens"
DependsOnTargets="GenerateUnoSplashScreens"
Condition="'$(DesignTimeBuild)' != 'True'">
<!-- Android -->
<GenerateSplashAndroidResources_v0
IntermediateOutputPath="$(_UnoIntermediateSplashScreen)"
UnoSplashScreen="@(UnoSplashScreen)"
/>
</Target>

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

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

<Target
Name="ProcessResizedImagesAndroid_v0"
AfterTargets="ProcessResizedImages_v0"
DependsOnTargets="ProcessResizedImages_v0"
Condition="'$(DesignTimeBuild)' != 'true'">

<!-- Android -->
<ItemGroup>
<AndroidResource Include="@(_UnoResizetizerCollectedAppIcons)"
Link="%(_UnoResizetizerCollectedAppIcons.RecursiveDir)%(_UnoResizetizerCollectedAppIcons.Filename)%(_UnoResizetizerCollectedAppIcons.Extension)" >
</AndroidResource>
</ItemGroup>
</Target>
</Project>
84 changes: 84 additions & 0 deletions src/.nuspec/Uno.Resizetizer.apple.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<Project>
<Target
Name="GenerateUnoSplashApple"
AfterTargets="GenerateUnoSplashScreens"
DependsOnTargets="GenerateUnoSplashScreens"
Condition="'$(DesignTimeBuild)' != 'True'">
<!-- iOS, but not Catalyst -->
<GenerateSplashStoryboard_v0
Condition="'$(_UnoResizetizerIsiOSApp)' == 'True' and '$(TargetPlatformIdentifier)' != 'maccatalyst'"
pictos marked this conversation as resolved.
Show resolved Hide resolved
OutputFile="$(_UnoIntermediateStoryboard)"
UnoSplashScreen="@(UnoSplashScreen)"
pictos marked this conversation as resolved.
Show resolved Hide resolved
/>
<PropertyGroup Condition="'$(_UnoResizetizerIsiOSApp)' == 'True' and '$(TargetPlatformIdentifier)' != 'maccatalyst'">
<_UnoIntermediateSplashScreenFile>$(_UnoIntermediateStoryboard)</_UnoIntermediateSplashScreenFile>
</PropertyGroup>
<ItemGroup Condition="'$(_UnoResizetizerIsiOSApp)' == 'True' and '$(TargetPlatformIdentifier)' != 'maccatalyst'">
<InterfaceDefinition Include="$(_UnoIntermediateStoryboard)" Link="$([System.IO.Path]::GetFileName($(_UnoIntermediateStoryboard)))" />
<FileWrites Include="$(_UnoIntermediateStoryboard)" />
</ItemGroup>

<!-- Create a partial info.plist for iOS -->
<CreatePartialInfoPlistTask_v0
Condition="'$(_UnoResizetizerIsiOSApp)' == 'True' And '$(_UnoIntermediateSplashScreenFile)' != ''"
IntermediateOutputPath="$(_UnoIntermediateSplashScreen)"
PlistName="UnoInfo.plist"
Storyboard="$(_UnoIntermediateSplashScreenFile)" />
</Target>

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

<!-- iOS, but not Catalyst -->
<ItemGroup Condition="'$(_UnoResizetizerIsiOSApp)' == 'True' ">
<_UnoSplashPListFiles Include="$(_UnoIntermediateSplashScreen)UnoInfo.plist" Condition="Exists('$(_UnoIntermediateSplashScreen)UnoInfo.plist')" />
<PartialAppManifest Include="@(_UnoSplashPListFiles)" Condition="'@(_UnoSplashPListFiles)' != ''" />
<FileWrites Include="@(_UnoSplashPListFiles)" Condition="'@(_UnoSplashPListFiles)' != ''" />
</ItemGroup>

<ItemGroup Condition="'$(BuildSessionId)' != '' And '$(_UnoResizetizerIsiOSApp)' == 'True' And '$(IsMacEnabled)'=='true'">
<_UnoAssetsToCopyToBuildServer Include="@(_UnoSplashPListFiles)">
<TargetPath>%(Identity)</TargetPath>
</_UnoAssetsToCopyToBuildServer>
</ItemGroup>
<CopyFilesToBuildServer
Condition="'$(BuildSessionId)' != '' And '$(_UnoResizetizerIsiOSApp)' == 'True' And '$(IsMacEnabled)'=='true'"
SessionId="$(BuildSessionId)"
Files="@(_UnoAssetsToCopyToBuildServer)" />
</Target>

<Target
Name="ProcessResizedImagesApple_v0"
AfterTargets="ProcessResizedImages_v0"
DependsOnTargets="ProcessResizedImages_v0"
Condition="'$(DesignTimeBuild)' != 'true'">
<ItemGroup Condition="'$(_UnoResizetizerIsiOSApp)' == 'True'">
<_UnoResizetizerCollectedBundleResourceImages Include="@(_UnoResizetizerCollectedImages->'%(FullPath)')">
<LogicalName>%(_UnoResizetizerCollectedImages.Filename)%(_UnoResizetizerCollectedImages.Extension)</LogicalName>
<TargetPath>%(_UnoResizetizerCollectedImages.Filename)%(_UnoResizetizerCollectedImages.Extension)</TargetPath>
</_UnoResizetizerCollectedBundleResourceImages>

<ImageAsset
Include="@(_UnoResizetizerCollectedBundleResourceImages)"
Condition="'@(_UnoResizetizerCollectedBundleResourceImages->Contains('Assets.xcassets'))' == 'True' and '%(_UnoResizetizerCollectedBundleResourceImages.Identity)' != ''">
<LogicalName>Assets.xcassets\$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName(%(_UnoResizetizerCollectedBundleResourceImages.Identity)))))\%(_UnoResizetizerCollectedBundleResourceImages.Filename)%(_UnoResizetizerCollectedBundleResourceImages.Extension)</LogicalName>
<TargetPath>Assets.xcassets\$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName(%(_UnoResizetizerCollectedBundleResourceImages.Identity)))))\%(_UnoResizetizerCollectedBundleResourceImages.Filename)%(_UnoResizetizerCollectedBundleResourceImages.Extension)</TargetPath>
<Link>Assets.xcassets\$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName(%(_UnoResizetizerCollectedBundleResourceImages.Identity)))))\%(_UnoResizetizerCollectedBundleResourceImages.Filename)%(_UnoResizetizerCollectedBundleResourceImages.Extension)</Link>
</ImageAsset>
</ItemGroup>

<!-- iOS Only -->
<!-- If on Windows, using build host, copy the files over to build server host too -->
<ItemGroup Condition="'$(BuildSessionId)' != '' And '$(_UnoResizetizerIsiOSApp)' == 'True' And '$(IsMacEnabled)'=='true'">
<_UnoImagesToCopyToBuildServer Include="@(_UnoResizetizerCollectedBundleResourceImages)">
<TargetPath>%(Identity)</TargetPath>
</_UnoImagesToCopyToBuildServer>
</ItemGroup>
<CopyFilesToBuildServer
Condition="'$(BuildSessionId)' != '' And '$(_UnoResizetizerIsiOSApp)' == 'True' And '$(IsMacEnabled)'=='true'"
SessionId="$(BuildSessionId)"
Files="@(_UnoImagesToCopyToBuildServer)" />
</Target>
</Project>
Loading
Loading