-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #512 from AndreasReitberger/511-improve-maui-packa…
…ging-for-nuget Create PackMauiAssets.targets
- Loading branch information
Showing
6 changed files
with
215 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<PackMauiItems Condition="'$(PackMauiItems)' == ''">true</PackMauiItems> | ||
<!-- Defaults to '$(PackageId).targets' if no path was specified --> | ||
<PackMauiItemsTargetsFileName Condition="'$(PackMauiItemsTargetsFileName)' == ''"></PackMauiItemsTargetsFileName> | ||
<PackMauiItemsExcludes>**\.DS_Store</PackMauiItemsExcludes> | ||
</PropertyGroup> | ||
|
||
<!-- Collect all .NET MAUI items --> | ||
<ItemGroup Condition="'$(TargetFramework)' == '' and '$(PackMauiItems)' == 'true'"> | ||
|
||
<_SafeMauiImage Include="@(MauiImage)" Exclude="$(PackMauiItemsExcludes)" /> | ||
<_SafeMauiIcon Include="@(MauiIcon)" Exclude="$(PackMauiItemsExcludes)" /> | ||
<_SafeMauiSplashScreen Include="@(MauiSplashScreen)" Exclude="$(PackMauiItemsExcludes)" /> | ||
<_SafeMauiAsset Include="@(MauiAsset)" Exclude="$(PackMauiItemsExcludes)" /> | ||
<_SafeMauiFont Include="@(MauiFont)" Exclude="$(PackMauiItemsExcludes)" /> | ||
|
||
<!-- MauiImage --> | ||
<_PackageFiles Include="@(_SafeMauiImage)" Pack="True" PackagePath="buildTransitive\_MauiItems\Images\%(Filename)%(Extension)" /> | ||
<_MauiImageForegroundProxy Include="@(_SafeMauiImage->HasMetadata('ForegroundFile'))" BackgroundFile="%(Filename)%(Extension)" /> | ||
<_PackageFiles Include="@(_MauiImageForegroundProxy->'%(ForegroundFile)')" Pack="True" PackagePath="buildTransitive\_MauiItems\Images\Foreground\%(BackgroundFile)" /> | ||
<!-- MauiIcon --> | ||
<_PackageFiles Include="@(_SafeMauiIcon)" Pack="True" PackagePath="buildTransitive\_MauiItems\AppIcon\%(Filename)%(Extension)" /> | ||
<_MauiIconForegroundProxy Include="@(_SafeMauiIcon->HasMetadata('ForegroundFile'))" BackgroundFile="%(Filename)%(Extension)" /> | ||
<_PackageFiles Include="@(_MauiIconForegroundProxy->'%(ForegroundFile)')" Pack="True" PackagePath="buildTransitive\_MauiItems\AppIcon\Foreground\%(BackgroundFile)" /> | ||
<!-- MauiSplashScreen --> | ||
<_PackageFiles Include="@(_SafeMauiSplashScreen)" Pack="True" PackagePath="buildTransitive\_MauiItems\Splash\%(Filename)%(Extension)" /> | ||
<!-- MauiFont --> | ||
<_PackageFiles Include="@(_SafeMauiFont)" Pack="True" PackagePath="buildTransitive\_MauiItems\Fonts\%(Filename)%(Extension)" /> | ||
<!-- MauiAsset --> | ||
<_PackageFiles Include="@(_SafeMauiAsset)" Pack="True" PackagePath="buildTransitive\_MauiItems\Raw\%(RecursiveDir)%(Filename)%(Extension)" /> | ||
</ItemGroup> | ||
|
||
<Target Name="GenerateIncludeMauiItemsTargets" BeforeTargets="GenerateNuspec" Condition="'$(PackMauiItems)' == 'true'"> | ||
|
||
<PropertyGroup> | ||
<_IncludeMauiItemsTargetsBoilerplate> | ||
<![CDATA[ | ||
<Project> | ||
<ItemGroup> | ||
{{MauiItems}} | ||
</ItemGroup> | ||
</Project> | ||
]]> | ||
</_IncludeMauiItemsTargetsBoilerplate> | ||
</PropertyGroup> | ||
|
||
<!-- Add all items to the generated targets file --> | ||
<ItemGroup> | ||
<!-- MauiImage --> | ||
<_IncludeMauiItems Include="@(_SafeMauiImage->'<MauiImage | ||
Include="%24(MSBuildThisFileDirectory)_MauiItems\Images\%(Filename)%(Extension)" | ||
Link="%(Link)" | ||
BaseSize="%(BaseSize)" | ||
Resize="%(Resize)" | ||
TintColor="%(TintColor)" | ||
Color="%(Color)" | ||
Visible="False" | ||
/>')" /> | ||
<!-- MauiIcon --> | ||
<_IncludeMauiItems Include="@(_SafeMauiIcon->'<MauiIcon | ||
Include="%24(MSBuildThisFileDirectory)_MauiItems\AppIcon\%(Filename)%(Extension)" | ||
ForegroundFile="%24(MSBuildThisFileDirectory)_MauiItems\AppIcon\Foreground\%(Filename)%(Extension)" | ||
Link="%(Link)" | ||
BaseSize="%(BaseSize)" | ||
Resize="%(Resize)" | ||
TintColor="%(TintColor)" | ||
Color="%(Color)" | ||
ForegroundScale="%(ForegroundScale)" | ||
Visible="False" | ||
/>')" /> | ||
<!-- MauiSplashScreen --> | ||
<_IncludeMauiItems Include="@(_SafeMauiSplashScreen->'<MauiSplashScreen | ||
Include="%24(MSBuildThisFileDirectory)_MauiItems\Splash\%(Filename)%(Extension)" | ||
Link="%(Link)" | ||
BaseSize="%(BaseSize)" | ||
Resize="%(Resize)" | ||
TintColor="%(TintColor)" | ||
Color="%(Color)" | ||
Visible="False" | ||
/>')" /> | ||
<!-- MauiFont --> | ||
<_IncludeMauiItems Include="@(_SafeMauiFont->'<MauiFont | ||
Include="%24(MSBuildThisFileDirectory)_MauiItems\Fonts\%(Filename)%(Extension)" | ||
Link="%(Link)" | ||
Visible="False" | ||
/>')" /> | ||
<!-- MauiAsset --> | ||
<_IncludeMauiItems Include="@(_SafeMauiAsset->'<MauiAsset | ||
Include="%24(MSBuildThisFileDirectory)_MauiItems\Raw\%(RecursiveDir)%(Filename)%(Extension)" | ||
Link="%(Link)" | ||
LogicalName="%(LogicalName)" | ||
Visible="False" | ||
/>')" /> | ||
</ItemGroup> | ||
|
||
<!-- Generate the targets file --> | ||
<PropertyGroup> | ||
<_IncludeMauiItem>@(_IncludeMauiItems, '%0A ')</_IncludeMauiItem> | ||
<_IncludeMauiItemsTargetsBoilerplate>$(_IncludeMauiItemsTargetsBoilerplate.Replace('{{MauiItems}}', '$(_IncludeMauiItem)'))</_IncludeMauiItemsTargetsBoilerplate> | ||
<_FinalPackMauiItemsTargetsFileName>$(PackageId).targets</_FinalPackMauiItemsTargetsFileName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<_IncludeMauiItemsTargetsLines Include="$(_IncludeMauiItemsTargetsBoilerplate)" /> | ||
</ItemGroup> | ||
<WriteLinesToFile File="$(IntermediateOutputPath)_IncludeMauiAssets.g.targets" | ||
Lines="@(_IncludeMauiItemsTargetsLines)" | ||
Overwrite="true" | ||
WriteOnlyWhenDifferent="true" /> | ||
<ItemGroup> | ||
<FileWrites Include="$(IntermediateOutputPath)_IncludeMauiAssets.g.targets" /> | ||
<_PackageFiles Include="$(IntermediateOutputPath)_IncludeMauiAssets.g.targets" Pack="True" PackagePath="buildTransitive\$(_FinalPackMauiItemsTargetsFileName)" /> | ||
</ItemGroup> | ||
|
||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters