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

Generate the Windows manifests as well #2704

Merged
merged 21 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c615baa
Generate the Windows manifests as well
mattleibow Sep 26, 2021
390b339
Make a new @(MauiAppIcon)
mattleibow Sep 27, 2021
d6ad433
comment
mattleibow Sep 27, 2021
57cded8
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Sep 27, 2021
244240f
MauiAppIcon -> MauiIcon
mattleibow Sep 27, 2021
03effc8
zuuup
mattleibow Sep 27, 2021
63c5cd2
Use targets instead
mattleibow Sep 27, 2021
bae7d6b
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Oct 7, 2021
8434788
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Jan 28, 2022
a571c72
Fix the tests
mattleibow Jan 29, 2022
8704176
extract
mattleibow Jan 30, 2022
120f887
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Jan 30, 2022
bf3ec44
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Jan 31, 2022
16af9e3
better errors
mattleibow Jan 31, 2022
4af2100
Update the templates
mattleibow Jan 31, 2022
861ad3e
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Feb 1, 2022
395dcaa
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Feb 2, 2022
626c544
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Feb 9, 2022
43a5c60
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Feb 11, 2022
15ea937
Merge remote-tracking branch 'origin/main' into dev/win-manifest
mattleibow Feb 23, 2022
96ff11f
make sure to really build windows
mattleibow Feb 23, 2022
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
11 changes: 11 additions & 0 deletions .nuspec/Microsoft.Maui.Resizetizer.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<PrepareMsixPackageDependsOn>
MauiGeneratePackageAppxManifest;
$(PrepareMsixPackageDependsOn);
</PrepareMsixPackageDependsOn>
</PropertyGroup>

</Project>
58 changes: 57 additions & 1 deletion .nuspec/Microsoft.Maui.Resizetizer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<ItemGroup>
<AvailableItemName Include="MauiAsset" />
<AvailableItemName Include="MauiImage" />
<AvailableItemName Include="MauiAppIcon" />
<AvailableItemName Include="MauiFont" />
<AvailableItemName Include="MauiSplashScreen" />
</ItemGroup>
Expand Down Expand Up @@ -40,6 +41,10 @@
AssemblyFile="$(_ResizetizerTaskAssemblyName)"
TaskName="Microsoft.Maui.Resizetizer.GetMauiAssetPath" />

<UsingTask
AssemblyFile="$(_ResizetizerTaskAssemblyName)"
TaskName="Microsoft.Maui.Resizetizer.GeneratePackageAppxManifest" />

<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
Expand All @@ -52,11 +57,13 @@
<_MauiFontStampFile>$(IntermediateOutputPath)mauifont.stamp</_MauiFontStampFile>
<_MauiSplashInputsFile>$(IntermediateOutputPath)mauisplash.inputs</_MauiSplashInputsFile>
<_MauiSplashStampFile>$(IntermediateOutputPath)mauisplash.stamp</_MauiSplashStampFile>
<_MauiManifestStampFile>$(IntermediateOutputPath)mauimanifest.stamp</_MauiManifestStampFile>

<_ResizetizerIntermediateOutputRoot>$(IntermediateOutputPath)resizetizer\</_ResizetizerIntermediateOutputRoot>
<_MauiIntermediateImages>$(_ResizetizerIntermediateOutputRoot)r\</_MauiIntermediateImages>
<_MauiIntermediateFonts>$(_ResizetizerIntermediateOutputRoot)f\</_MauiIntermediateFonts>
<_MauiIntermediateSplashScreen>$(_ResizetizerIntermediateOutputRoot)sp\</_MauiIntermediateSplashScreen>
<_MauiIntermediateManifest>$(_ResizetizerIntermediateOutputRoot)m\</_MauiIntermediateManifest>
<_MauiIntermediateColors>$(_MauiIntermediateSplashScreen)maui_colors.xml</_MauiIntermediateColors>
<_MauiIntermediateDrawable>$(_MauiIntermediateSplashScreen)maui_splash_image.xml</_MauiIntermediateDrawable>
<_MauiIntermediateStoryboard>$(_MauiIntermediateSplashScreen)MauiSplash.storyboard</_MauiIntermediateStoryboard>
Expand Down Expand Up @@ -108,7 +115,8 @@

<ResizetizeCollectItemsBeforeTargets>
$(ResizetizeCollectItemsBeforeTargets);
_CollectBundleResources;_BeforeCoreCompileImageAssets;
_CollectBundleResources;
_BeforeCoreCompileImageAssets;
</ResizetizeCollectItemsBeforeTargets>

<ResizetizeAfterTargets>
Expand Down Expand Up @@ -156,6 +164,11 @@
$(ProcessMauiFontsBeforeTargets);
AssignTargetPaths;
</ProcessMauiFontsBeforeTargets>

<MauiGeneratePackageAppxManifestDependsOnTargets>
$(MauiGeneratePackageAppxManifestDependsOnTargets);
ResizetizeCollectItems;
</MauiGeneratePackageAppxManifestDependsOnTargets>
</PropertyGroup>

<!-- WPF -->
Expand All @@ -180,6 +193,7 @@
<ItemGroup>
<MauiItem Include="@(MauiImage)" ItemGroupName="MauiImage" Condition="'%(MauiImage.ForegroundFile)' == ''" />
<MauiItem Include="@(MauiImage)" ItemGroupName="MauiImage" Condition="'%(MauiImage.ForegroundFile)' != ''" ForegroundFile="$([System.IO.Path]::GetFullPath('%(MauiImage.ForegroundFile)'))" />
<MauiItem Include="@(MauiAppIcon)" ItemGroupName="MauiAppIcon" Condition="'%(MauiAppIcon.ForegroundFile)' != ''" ForegroundFile="$([System.IO.Path]::GetFullPath('%(MauiAppIcon.ForegroundFile)'))" />
<MauiItem Include="@(MauiFont)" ItemGroupName="MauiFont" />
<MauiItem Include="@(MauiAsset)" ItemGroupName="MauiAsset" ProjectDirectory="$(MSBuildProjectDirectory)" />
<MauiItem Include="@(MauiSplashScreen)" ItemGroupName="MauiSplashScreen" />
Expand Down Expand Up @@ -223,6 +237,9 @@
<MauiImage
Include="@(ImportedMauiItem)"
Condition="'%(ImportedMauiItem.ItemGroupName)' == 'MauiImage'" />
<MauiAppIcon
Include="@(ImportedMauiItem)"
Condition="'%(ImportedMauiItem.ItemGroupName)' == 'MauiAppIcon'" />
<MauiFont
Include="@(ImportedMauiItem)"
Condition="'%(ImportedMauiItem.ItemGroupName)' == 'MauiFont'" />
Expand All @@ -234,6 +251,11 @@
Condition="'%(ImportedMauiItem.ItemGroupName)' == 'MauiSplashScreen'" />
</ItemGroup>

<!-- Map @(MauiAppIcon) to @(MauiImage IsAppIcon=true) -->
<ItemGroup>
<MauiImage Include="@(MauiAppIcon)" IsAppIcon="True" />
</ItemGroup>

<!-- Write out item spec and metadata to a file we can use as an inputs for the resize target -->
<!-- This allows us to invalidate the build based on not just input image files changing but project item metadata as well -->
<WriteLinesToFile
Expand Down Expand Up @@ -533,7 +555,41 @@
</ItemGroup>
</Target>

<Target Name="_ValidatePresenceOfAppxManifestItemsBeforeTarget"
BeforeTargets="_ValidatePresenceOfAppxManifestItems"
DependsOnTargets="MauiGeneratePackageAppxManifest" />

<Target Name="MauiGeneratePackageAppxManifest"
DependsOnTargets="$(MauiGeneratePackageAppxManifestDependsOnTargets)"
Inputs="$(MSBuildThisFileFullPath);$(_ResizetizerTaskAssemblyName);$(_ResizetizerInputsFile);$(_MauiSplashInputsFile);@(AppxManifest)"
Outputs="$(_MauiManifestStampFile);$(_MauiIntermediateManifest)Package.appxmanifest">

<GeneratePackageAppxManifest
IntermediateOutputPath="$(_MauiIntermediateManifest)"
AppxManifest="@(AppxManifest)"
GeneratedFilename="Package.appxmanifest"
ApplicationId="$(ApplicationId)"
ApplicationDisplayVersion="$(ApplicationDisplayVersion)"
ApplicationVersion="$(ApplicationVersion)"
ApplicationTitle="$(ApplicationTitle)"
AppIcon="@(MauiImage->WithMetadataValue('IsAppIcon', 'true'))"
SplashScreen="@(MauiSplashScreen)" />

<!-- replace user manifest -->
<ItemGroup>
<AppxManifest Remove="@(AppxManifest)" />
<AppxManifest Include="$(_MauiIntermediateManifest)Package.appxmanifest" />
</ItemGroup>

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

<Target Name="_CleanResizetizer">
<RemoveDir Directories="$(_ResizetizerIntermediateOutputRoot)" Condition="Exists ('$(_ResizetizerIntermediateOutputRoot)' )" />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Core.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.DefaultItems.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.props" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Core.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.DefaultItems.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.props"/>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</ItemGroup>

<ItemGroup>
<MauiImage Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" IsAppIcon="true" Color="#512BD4" />
<MauiAppIcon Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\AppIcons\appicon_foreground.svg" Color="#512BD4" />
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<WindowsPackageType>MSIX</WindowsPackageType>
<ApplicationTitle>.NET MAUI Controls</ApplicationTitle>
<ApplicationId>com.microsoft.maui.sample</ApplicationId>
<ApplicationId Condition="$(TargetFramework.Contains('-windows'))">f9e4fa3e-3505-4742-9b2b-d1acdaff4ec8</ApplicationId>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows uses a GUID for this, so we unfortunately need to condition. Maybe we can have an $(ApplicationGuid)? Then we don't need this and we can potentially use that GUID in other OS. Not sure what Tizen uses? @rookiejava

<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<_FastDeploymentDiagnosticLogging>True</_FastDeploymentDiagnosticLogging>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity
Name="f9e4fa3e-3505-4742-9b2b-d1acdaff4ec8"
Publisher="CN=.NET Foundation"
Version="1.0.0.0" />

<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity Publisher="CN=.NET Foundation" />
<Properties>
<DisplayName>.NET MAUI Controls</DisplayName>
<PublisherDisplayName>.NET Foundation</PublisherDisplayName>
<Logo>Assets\appiconStoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
<Resource Language="x-generate" />
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName=".NET MAUI Controls"
Description=".NET MAUI Controls sample application"
BackgroundColor="transparent"
Square150x150Logo="Assets\appiconMediumTile.png"
Square44x44Logo="Assets\appiconLogo.png">
<uap:DefaultTile
Wide310x150Logo="Assets\appiconWideTile.png"
Square71x71Logo="Assets\appiconSmallTile.png"
Square310x310Logo="Assets\appiconLargeTile.png"
ShortName="Single Project">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo"/>
<uap:ShowOn Tile="wide310x150Logo"/>
</uap:ShowNameOnTiles>
</uap:DefaultTile >
<uap:SplashScreen Image="Assets\dotnet_botSplashScreen.png" />
</uap:VisualElements>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
<uap:VisualElements />
</Application>
</Applications>

<Capabilities>
<rescap:Capability Name="runFullTrust" />
<DeviceCapability Name="location"/>
<DeviceCapability Name="location" />
</Capabilities>
</Package>
</Package>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\*.gif" Resize="false" />
<MauiImage Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" IsAppIcon="true" />
<MauiAppIcon Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" />
<MauiFont Include="Resources\Fonts\*" />
<MauiSplashScreen Include="Resources\Images\dotnet_bot.svg" Color="#FFFFFF" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\*.gif" Resize="false" />
<MauiImage Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" IsAppIcon="true" />
<MauiAppIcon Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" />
<MauiFont Include="Resources\Fonts\*" />
<MauiSplashScreen Include="Resources\Images\dotnet_bot.svg" Color="#FFFFFF" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Controls/samples/Maui.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Core.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.DefaultItems.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.props"/>
</Project>
2 changes: 1 addition & 1 deletion src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<ItemGroup>
<MauiImage Include="Resources\Images\*" />
<MauiImage Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" IsAppIcon="true" Color="#512BD4" />
<MauiAppIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Core/tests/DeviceTests/Core.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup>
<MauiImage Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" IsAppIcon="true" Color="#512BD4" />
<MauiAppIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" />
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
Expand Down
1 change: 1 addition & 0 deletions src/Essentials/samples/Maui.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Core.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.DefaultItems.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.props"/>
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.props"/>
</Project>
2 changes: 1 addition & 1 deletion src/Essentials/samples/Samples/Essentials.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<ItemGroup>
<MauiImage Include="Resources\Images\*" />
<MauiImage Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appiconfg.svg" IsAppIcon="true" Color="#512BD4" />
<MauiAppIcon Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\AppIcons\appiconfg.svg" Color="#512BD4" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</PropertyGroup>

<ItemGroup>
<MauiImage Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" IsAppIcon="true" Color="#512BD4" />
<MauiAppIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" />
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public AppleIconAssetsGenerator(ResizeImageInfo info, string appIconName, string

public IEnumerable<ResizedImageInfo> Generate()
{
var outputAppIconSetDir = Path.Combine(IntermediateOutputPath, DpiPath.IosAppIconPath.Replace("{name}", AppIconName));
var outputAppIconSetDir = Path.Combine(IntermediateOutputPath, DpiPath.Ios.AppIconPath.Replace("{name}", AppIconName));
var outputAssetsDir = Path.Combine(outputAppIconSetDir, "..");

Logger.Log("iOS App Icon Set Directory: " + outputAppIconSetDir);
Expand Down
Loading