Skip to content

[Build] Separate Resizetizer image processing from platform injection and add extensibility targets#34226

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

[Build] Separate Resizetizer image processing from platform injection and add extensibility targets#34226
Redth wants to merge 1 commit intomainfrom
dev/redth/fix-34222

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

Fixes #34222
Part of #34099

This PR separates the Resizetizer's ResizetizeImages target into two distinct concerns and adds official extensibility points for custom platform backends.

Changes

1. Split ResizetizeImages into processing + injection targets

  • ResizetizeImages now only handles platform-agnostic image processing (validate, resize, convert, collect results, stamp file)
  • _ResizetizeInjectPlatformItems is a new target (AfterTargets="ResizetizeImages") that handles platform-specific output injection (BundleResource, LibraryResourceDirectories, ContentWithTargetPath, etc.)

2. Add extensibility hook targets with DependsOnTargets properties

Target Property Runs After
_ResizetizerAfterImageProcessing ResizetizerAfterImageProcessingTargets ResizetizeImages, before _ResizetizeInjectPlatformItems
_ResizetizerAfterFontProcessing ResizetizerAfterFontProcessingTargets ProcessMauiFonts
_ResizetizerAfterAllProcessing ResizetizerAfterAllProcessingTargets ResizetizeImages, ProcessMauiFonts, ProcessMauiAssets
_ResizetizeInjectPlatformItems ResizetizeInjectPlatformItemsTargets ResizetizeImages

Custom backends can register their targets via properties:

<PropertyGroup>
    <ResizetizerAfterImageProcessingTargets>
        $(ResizetizerAfterImageProcessingTargets);
        _MyCustomPlatformBundleImages
    </ResizetizerAfterImageProcessingTargets>
</PropertyGroup>

3. Optional custom platform targets import

Backends can set ResizetizerCustomPlatformTargets to import a custom targets file:

<PropertyGroup>
    <ResizetizerCustomPlatformTargets>$(MSBuildThisFileDirectory)Resizetizer.MyPlatform.targets</ResizetizerCustomPlatformTargets>
</PropertyGroup>

Impact

  • Zero breaking changes — pure refactor; built-in platforms behave identically
  • Official extension points — custom backends can reliably hook in without depending on internals
  • All 587 Resizetizer unit tests pass

… extensibility targets

Split the ResizetizeImages target into two targets:
- ResizetizeImages: platform-agnostic image processing (validate, resize, convert)
- _ResizetizeInjectPlatformItems: platform-specific output injection (BundleResource, LibraryResourceDirectories, ContentWithTargetPath, etc.)

Add extensibility hook targets with DependsOnTargets properties:
- _ResizetizerAfterImageProcessing (ResizetizerAfterImageProcessingTargets)
- _ResizetizerAfterFontProcessing (ResizetizerAfterFontProcessingTargets)
- _ResizetizerAfterAllProcessing (ResizetizerAfterAllProcessingTargets)
- _ResizetizeInjectPlatformItems (ResizetizeInjectPlatformItemsTargets)

Add optional custom platform targets import via ResizetizerCustomPlatformTargets property.

Fixes #34222

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 refactors the Resizetizer build pipeline to separate platform-agnostic image processing from platform-specific item injection, and introduces new MSBuild hook targets/properties intended to make custom platform backends extensible without patching internal targets.

Changes:

  • Adds hook targets for “after font processing”, “after image processing (before injection)”, and “after all processing”.
  • Splits platform-specific output injection into a new _ResizetizeInjectPlatformItems target that runs after ResizetizeImages.
  • Adds an optional ResizetizerCustomPlatformTargets import for backend-provided targets.

Comment on lines +931 to +935
<!-- Extensibility target: runs after all resource processing is complete.
Custom backends can register targets via the ResizetizerAfterAllProcessingTargets property. -->
<Target Name="_ResizetizerAfterAllProcessing"
AfterTargets="ResizetizeImages;ProcessMauiFonts;ProcessMauiAssets"
DependsOnTargets="$(ResizetizerAfterAllProcessingTargets)" />
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.

_ResizetizerAfterAllProcessing is intended to run after all resource processing, but AfterTargets="ResizetizeImages;ProcessMauiFonts;ProcessMauiAssets" will schedule it after whichever of those targets runs first (the target will only execute once). Consider introducing an aggregate target that DependsOnTargets="ResizetizeImages;ProcessMauiFonts;ProcessMauiAssets" and then run _ResizetizerAfterAllProcessing after that aggregate, so the hook reliably runs after the full pipeline.

Suggested change
<!-- Extensibility target: runs after all resource processing is complete.
Custom backends can register targets via the ResizetizerAfterAllProcessingTargets property. -->
<Target Name="_ResizetizerAfterAllProcessing"
AfterTargets="ResizetizeImages;ProcessMauiFonts;ProcessMauiAssets"
DependsOnTargets="$(ResizetizerAfterAllProcessingTargets)" />
<!-- Aggregate target to ensure all resource processing has completed. -->
<Target Name="_ResizetizerAllResourceProcessing"
DependsOnTargets="ResizetizeImages;ProcessMauiFonts;ProcessMauiAssets" />
<!-- Extensibility target: runs after all resource processing is complete.
Custom backends can register targets via the ResizetizerAfterAllProcessingTargets property. -->
<Target Name="_ResizetizerAfterAllProcessing"
AfterTargets="_ResizetizerAllResourceProcessing"
DependsOnTargets="$(ResizetizerAfterAllProcessingTargets)" />

Copilot uses AI. Check for mistakes.
Or '$(_ResizetizerIsWindowsAppSdk)' == 'True'
Or '$(_ResizetizerIsWPFApp)' == 'True'
Or '$(_ResizetizerIsTizenApp)' == 'True')"
DependsOnTargets="$(ResizetizeInjectPlatformItemsTargets)">
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.

The new extensibility properties use the Resizetizer...Targets prefix (e.g., ResizetizerAfterImageProcessingTargets), but this target uses ResizetizeInjectPlatformItemsTargets (missing the 'r'). For a new public extension point, please align the property name with the other extensibility properties to avoid confusing custom backends and to match the target’s purpose.

Suggested change
DependsOnTargets="$(ResizetizeInjectPlatformItemsTargets)">
DependsOnTargets="$(ResizetizerInjectPlatformItemsTargets)">

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: Separate image processing from platform output injection and add extensibility targets

2 participants