Skip to content

[Build] Expose processed fonts and assets for custom platform backends#34227

Open
Redth wants to merge 1 commit intomainfrom
dev/redth/fix-34221
Open

[Build] Expose processed fonts and assets for custom platform backends#34227
Redth wants to merge 1 commit intomainfrom
dev/redth/fix-34221

Conversation

@Redth
Copy link
Member

@Redth Redth commented Feb 25, 2026

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

The Resizetizer's ProcessMauiFonts and ProcessMauiAssets targets perform fundamentally platform-agnostic work (copying font files, resolving asset paths) but don't expose their results for consumption by custom platform backends.

This PR makes three small changes to Microsoft.Maui.Resizetizer.After.targets:

1. MauiProcessedFont public item group

After ProcessMauiFonts copies fonts to the intermediate directory, the copied files are exposed as MauiProcessedFont items. Custom backends can consume via AfterTargets="ProcessMauiFonts":

<Target Name="_MyPlatformBundleFonts" AfterTargets="ProcessMauiFonts">
    <ItemGroup>
        <BundleResource Include="@(MauiProcessedFont)">
            <LogicalName>%(Filename)%(Extension)</LogicalName>
        </BundleResource>
    </ItemGroup>
</Target>

2. MauiProcessedAsset public item group

After ProcessMauiAssets runs GetMauiAssetPath, the resolved assets are exposed as MauiProcessedAsset items.

3. Default _MauiAssetItemMetadata fallback

When no known platform matches (Android, iOS, Windows, Tizen), _MauiAssetItemMetadata now defaults to Link instead of being empty, which would cause GetMauiAssetPath to fail or produce no useful output.

Impact

  • Zero breaking changes — existing platforms are unaffected
  • ~11 lines of code total
  • Fonts and assets "just work" for any backend that references the Resizetizer NuGet

Fixes #34221
Part of #34099

Add MauiProcessedFont and MauiProcessedAsset public item groups so
custom platform backends can consume processed resources via
AfterTargets without re-implementing font/asset copy logic.

Add a default _MauiAssetItemMetadata fallback to 'Link' for platforms
not explicitly listed (Android, iOS, Windows, Tizen).

Fixes #34221

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 25, 2026 01:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Resizetizer build targets to expose the results of font and asset processing so custom platform backends can consume the resolved/copied items without re-implementing that logic.

Changes:

  • Adds a default fallback for _MauiAssetItemMetadata to Link when no known platform match is detected.
  • Exposes resolved assets as a public @(MauiProcessedAsset) item group after GetMauiAssetPath runs.
  • Exposes copied fonts as a public @(MauiProcessedFont) item group after the font copy step.

Comment on lines +543 to +546
<!-- Expose processed fonts for custom platform backends -->
<ItemGroup>
<MauiProcessedFont Include="@(_MauiFontCopied)" />
</ItemGroup>
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

MauiProcessedFont is populated from @(_MauiFontCopied), which is created via the wildcard $(_MauiIntermediateFonts)*. Since this directory also contains non-font outputs (e.g., MauiInfo.plist is generated into the same folder on iOS), incremental builds can leave extra files there and the wildcard will include them. That means custom backends consuming @(MauiProcessedFont) may end up bundling non-font files. Consider populating MauiProcessedFont from the Copy task's CopiedFiles output (or otherwise filtering @(_MauiFontCopied) to only .ttf/.otf etc.) so only actual font files are exposed.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resizetizer: Decouple font and asset processing from platform-specific gates

2 participants