[Resizetizer] Invalidate image outputs when platform type changes - #36984
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ac6265fe-09a0-473c-b3f9-9ec6d6dd97cd
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36984Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36984" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR improves Resizetizer incremental correctness for external backends by ensuring platform-only changes (via ResizetizerPlatformType) invalidate the image-processing target, and adds an integration test that exercises the platform switch scenario end-to-end.
Changes:
- Persist
ResizetizerPlatformTypeinto the Resizetizer image inputs manifest so a platform-type-only change updates the manifest and forcesResizetizeImagesto rerun. - Add an integration test that switches an external backend from
generictoandroid, verifies stale generic outputs are removed, and verifies the following unchanged rebuild is a true no-op.
Show a summary per file
| File | Description |
|---|---|
| src/TestUtils/src/Microsoft.Maui.IntegrationTests/ResizetizerTests.cs | Adds an integration test covering platform-type invalidation, stale output removal, and no-op rebuild behavior. |
| src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets | Writes platform type into the persisted image inputs list so manifest changes when only ResizetizerPlatformType changes. |
Copilot's findings
Suppressed comments (1)
src/TestUtils/src/Microsoft.Maui.IntegrationTests/ResizetizerTests.cs:164
- Same as above: a 1-minute future sentinel can be overtaken by a slow incremental build, making this no-op rebuild assertion flaky. Use a larger margin (e.g., 1 hour) consistent with other tests in this file.
File.SetLastWriteTimeUtc(stampFile, DateTime.UtcNow.AddMinutes(1));
- Files reviewed: 2/2 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
This comment has been minimized.
This comment has been minimized.
AI Review Summary
🗂️ Review Sessions — click to expand📋 Pre-Flight — Context & ValidationIssue: Related #34099 - Improve Extensibility 3rd Party Platform Backends; #35022 - Resizetizer: extensibility for external backends; follow-up to #36653 - [Extensibility] Resizetizer: Enable external backend processing Key Findings
Code Review SummaryVerdict: NEEDS_DISCUSSION Key code review findings:
Fix Candidates
🔬 Code Review — Deep AnalysisCode Review — PR #36984Independent AssessmentWhat this changes: Adds Inferred motivation: Prevent stale platform-specific Resizetizer outputs from being reused after an external backend changes output shape. Reconciliation with PR NarrativeAuthor claims: Platform-only changes previously left Agreement/disagreement: Agrees. The code makes the semantic platform value affect the input-file timestamp without putting a raw property value directly in MSBuild Prior Review Reconciliation
External Output Contract
Blast Radius Assessment
CI Status
FindingsNo ❌ Error, Failure-Mode Probing
Verdict: NEEDS_DISCUSSIONConfidence: low (CI is pending/undetermined and this is build infrastructure.) Summary: I found no code-level correctness issues in the diff. However, CI has not completed and required-check status could not be authenticated via 🛠️ Fix — Analysis & ComparisonFix Candidates
Cross-Pollination
Exhausted: Yes try-fix-1 — Separate platform input filetry-fix-1 — Separate platform input fileApproachCreate a dedicated This differs from PR #36984 by keeping platform invalidation outside Diffdiff --git a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
index d3fd5474e8..debc85d256 100644
--- a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
+++ b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
@@ -72,6 +72,7 @@
<_ResizetizerIntermediateOutputPath Condition=" '$(_ResizetizerIntermediateOutputPath)' == '' " >$(IntermediateOutputPath)</_ResizetizerIntermediateOutputPath>
<_ResizetizerInputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.inputs</_ResizetizerInputsFile>
+ <_ResizetizerPlatformInputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.platform.inputs</_ResizetizerPlatformInputsFile>
<_ResizetizerOutputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.outputs</_ResizetizerOutputsFile>
<_ResizetizerStampFile>$(_ResizetizerIntermediateOutputPath)mauiimage.stamp</_ResizetizerStampFile>
<_MauiFontInputsFile>$(_ResizetizerIntermediateOutputPath)mauifont.inputs</_MauiFontInputsFile>
@@ -126,6 +127,7 @@
ResizetizeCollectItems;
ProcessMauiSplashScreens;
_ReadResizetizeImagesOutputs;
+ _WriteResizetizeImagePlatformInputs;
</ResizetizeDependsOnTargets>
<!-- Ensures project-reference MauiAsset items are collected before ProcessMauiAssets
for backends that opt in at evaluation time (ResizetizerPlatformType set in props
@@ -341,7 +343,7 @@
<!-- This allows us to invalidate the build based on not just input image files changing but project item metadata as well -->
<WriteLinesToFile
File="$(_ResizetizerInputsFile)"
- Lines="PlatformType=$(ResizetizerPlatformType);@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
+ Lines="@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
@@ -391,7 +393,7 @@
<Target Name="_PrepareExternalMauiImages"
BeforeTargets="ResizetizeImages"
- DependsOnTargets="ResizetizeCollectItems;ProcessMauiSplashScreens;_ReadResizetizeImagesOutputs"
+ DependsOnTargets="ResizetizeCollectItems;ProcessMauiSplashScreens;_ReadResizetizeImagesOutputs;_WriteResizetizeImagePlatformInputs"
Condition="'$(_ResizetizerIsCompatibleApp)' != 'True' And '$(ResizetizerPlatformType)' != ''" />
<Target Name="ProcessMauiAssets"
@@ -683,9 +685,22 @@
</ReadLinesFromFile>
</Target>
+ <Target Name="_WriteResizetizeImagePlatformInputs"
+ Condition="'$(EnableMauiImageProcessing)' == 'true'">
+ <WriteLinesToFile
+ File="$(_ResizetizerPlatformInputsFile)"
+ Lines="PlatformType=$(ResizetizerPlatformType)"
+ Overwrite="true"
+ WriteOnlyWhenDifferent="true" />
+
+ <ItemGroup>
+ <FileWrites Include="$(_ResizetizerPlatformInputsFile)" />
+ </ItemGroup>
+ </Target>
+
<Target Name="ResizetizeImages"
Condition="'$(EnableMauiImageProcessing)' == 'true'"
- Inputs="$(MSBuildThisFileFullPath);$(_ResizetizerTaskAssemblyName);$(_ResizetizerInputsFile);@(MauiImage)"
+ Inputs="$(MSBuildThisFileFullPath);$(_ResizetizerTaskAssemblyName);$(_ResizetizerInputsFile);$(_ResizetizerPlatformInputsFile);@(MauiImage)"
Outputs="$(_ResizetizerStampFile);$(_ResizetizerOutputsFile);@(_ResizetizerOutputs)"
AfterTargets="$(ResizetizeAfterTargets)"
BeforeTargets="$(ResizetizeBeforeTargets)"Test Results❌ BLOCKED — focused integration runner exited before running tests because local MAUI SDK packs are missing: Command attempted: pwsh .github/skills/run-integration-tests/scripts/Run-IntegrationTests.ps1 -TestFilter "FullyQualifiedName~ChangingExternalBackendPlatformTypeInvalidatesImages" -SkipBuild -SkipInstall -ResultsDirectory "artifacts/integration-tests/try-fix-1"Failure AnalysisThe candidate was not empirically evaluated because the environment is missing provisioned local MAUI packs. The patch is conceptually plausible, but it is more complex than the PR's one-line persisted-manifest fix and has a subtle risk: the resizer task itself still receives only try-fix-2 — Delete incremental state when platform changestry-fix-2 — Delete incremental state when platform changesApproachTrack the previous This differs from PR #36984 by invalidating target state directly instead of changing the existing inputs manifest. It also differs from try-fix-1 by not adding a platform file to the target Diffdiff --git a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
index d3fd5474e8..b038bc0aef 100644
--- a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
+++ b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
@@ -74,6 +74,7 @@
<_ResizetizerInputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.inputs</_ResizetizerInputsFile>
<_ResizetizerOutputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.outputs</_ResizetizerOutputsFile>
<_ResizetizerStampFile>$(_ResizetizerIntermediateOutputPath)mauiimage.stamp</_ResizetizerStampFile>
+ <_ResizetizerPlatformStateFile>$(_ResizetizerIntermediateOutputPath)mauiimage.platform</_ResizetizerPlatformStateFile>
<_MauiFontInputsFile>$(_ResizetizerIntermediateOutputPath)mauifont.inputs</_MauiFontInputsFile>
<_MauiFontStampFile>$(_ResizetizerIntermediateOutputPath)mauifont.stamp</_MauiFontStampFile>
<_MauiSplashInputsFile>$(_ResizetizerIntermediateOutputPath)mauisplash.inputs</_MauiSplashInputsFile>
@@ -125,6 +126,7 @@
$(ResizetizeDependsOnTargets);
ResizetizeCollectItems;
ProcessMauiSplashScreens;
+ _InvalidateResizetizeImagesOnPlatformChange;
_ReadResizetizeImagesOutputs;
</ResizetizeDependsOnTargets>
<!-- Ensures project-reference MauiAsset items are collected before ProcessMauiAssets
@@ -341,7 +343,7 @@
<!-- This allows us to invalidate the build based on not just input image files changing but project item metadata as well -->
<WriteLinesToFile
File="$(_ResizetizerInputsFile)"
- Lines="PlatformType=$(ResizetizerPlatformType);@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
+ Lines="@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
@@ -677,6 +679,36 @@
DependsOnTargets="$(ResizetizerAfterFontProcessingTargets)"
Condition="'$(EnableMauiFontProcessing)' == 'true' And '$(ResizetizerAfterFontProcessingTargets)' != ''" />
+ <Target Name="_InvalidateResizetizeImagesOnPlatformChange"
+ Condition="'$(EnableMauiImageProcessing)' == 'true'">
+ <ReadLinesFromFile File="$(_ResizetizerPlatformStateFile)" Condition="Exists('$(_ResizetizerPlatformStateFile)')">
+ <Output TaskParameter="Lines" ItemName="_PreviousResizetizerPlatformTypeLine" />
+ </ReadLinesFromFile>
+
+ <PropertyGroup>
+ <_PreviousResizetizerPlatformType>@(_PreviousResizetizerPlatformTypeLine)</_PreviousResizetizerPlatformType>
+ <_ResizetizerImagePlatformChanged Condition="'$(_PreviousResizetizerPlatformType)' != '' And '$(_PreviousResizetizerPlatformType)' != '$(ResizetizerPlatformType)'">True</_ResizetizerImagePlatformChanged>
+ <_ResizetizerImagePlatformChanged Condition="'$(_PreviousResizetizerPlatformType)' == '' And !Exists('$(_ResizetizerPlatformStateFile)') And (Exists('$(_ResizetizerStampFile)') Or Exists('$(_ResizetizerOutputsFile)'))">True</_ResizetizerImagePlatformChanged>
+ </PropertyGroup>
+
+ <ItemGroup Condition="'$(_ResizetizerImagePlatformChanged)' == 'True'">
+ <_ResizetizerImageIncrementalState Include="$(_ResizetizerStampFile)" />
+ <_ResizetizerImageIncrementalState Include="$(_ResizetizerOutputsFile)" />
+ </ItemGroup>
+
+ <Delete Files="@(_ResizetizerImageIncrementalState)" Condition="'@(_ResizetizerImageIncrementalState)' != ''" />
+
+ <WriteLinesToFile
+ File="$(_ResizetizerPlatformStateFile)"
+ Lines="$(ResizetizerPlatformType)"
+ Overwrite="true"
+ WriteOnlyWhenDifferent="true" />
+
+ <ItemGroup>
+ <FileWrites Include="$(_ResizetizerPlatformStateFile)" />
+ </ItemGroup>
+ </Target>
+
<Target Name="_ReadResizetizeImagesOutputs">
<ReadLinesFromFile File="$(_ResizetizerOutputsFile)" Condition="Exists ('$(_ResizetizerOutputsFile)')">
<Output TaskParameter="Lines" ItemName="_ResizetizerOutputs" />Test Results❌ BLOCKED — same environment blocker as try-fix-1; focused integration runner exited before running tests because local MAUI SDK packs are missing: Command attempted: pwsh .github/skills/run-integration-tests/scripts/Run-IntegrationTests.ps1 -TestFilter "FullyQualifiedName~ChangingExternalBackendPlatformTypeInvalidatesImages" -SkipBuild -SkipInstall -ResultsDirectory "artifacts/integration-tests/try-fix-2"Failure AnalysisThe candidate could not be empirically evaluated. It is intentionally different, but it is more invasive than the PR fix and adds active deletion of incremental state, including a one-time rebuild for existing try-fix-3 — Platform-scoped output listtry-fix-3 — Platform-scoped output listApproachResolve a platform-specific output-list file such as This differs from PR #36984 by changing output-list identity rather than input manifest content. It differs from try-fix-1 and try-fix-2 by not adding a platform input and not deleting incremental state based on comparison. Diffdiff --git a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
index d3fd5474e8..c483734182 100644
--- a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
+++ b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
@@ -73,6 +73,7 @@
<_ResizetizerInputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.inputs</_ResizetizerInputsFile>
<_ResizetizerOutputsFile>$(_ResizetizerIntermediateOutputPath)mauiimage.outputs</_ResizetizerOutputsFile>
+ <_ResizetizerCurrentPlatformOutputsFile>$(_ResizetizerOutputsFile)</_ResizetizerCurrentPlatformOutputsFile>
<_ResizetizerStampFile>$(_ResizetizerIntermediateOutputPath)mauiimage.stamp</_ResizetizerStampFile>
<_MauiFontInputsFile>$(_ResizetizerIntermediateOutputPath)mauifont.inputs</_MauiFontInputsFile>
<_MauiFontStampFile>$(_ResizetizerIntermediateOutputPath)mauifont.stamp</_MauiFontStampFile>
@@ -341,7 +342,7 @@
<!-- This allows us to invalidate the build based on not just input image files changing but project item metadata as well -->
<WriteLinesToFile
File="$(_ResizetizerInputsFile)"
- Lines="PlatformType=$(ResizetizerPlatformType);@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
+ Lines="@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
@@ -677,8 +678,17 @@
DependsOnTargets="$(ResizetizerAfterFontProcessingTargets)"
Condition="'$(EnableMauiFontProcessing)' == 'true' And '$(ResizetizerAfterFontProcessingTargets)' != ''" />
- <Target Name="_ReadResizetizeImagesOutputs">
- <ReadLinesFromFile File="$(_ResizetizerOutputsFile)" Condition="Exists ('$(_ResizetizerOutputsFile)')">
+ <Target Name="_ResolveResizetizerImageOutputListFile">
+ <PropertyGroup>
+ <_ResizetizerImageOutputListPlatform Condition="'$(ResizetizerPlatformType)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('$(ResizetizerPlatformType)', '[^A-Za-z0-9_.-]', '_').ToLowerInvariant())</_ResizetizerImageOutputListPlatform>
+ <_ResizetizerCurrentPlatformOutputsFile Condition="'$(_ResizetizerImageOutputListPlatform)' != ''">$(_ResizetizerIntermediateOutputPath)mauiimage.$(_ResizetizerImageOutputListPlatform).outputs</_ResizetizerCurrentPlatformOutputsFile>
+ <_ResizetizerCurrentPlatformOutputsFile Condition="'$(_ResizetizerCurrentPlatformOutputsFile)' == ''">$(_ResizetizerOutputsFile)</_ResizetizerCurrentPlatformOutputsFile>
+ </PropertyGroup>
+ </Target>
+
+ <Target Name="_ReadResizetizeImagesOutputs"
+ DependsOnTargets="_ResolveResizetizerImageOutputListFile">
+ <ReadLinesFromFile File="$(_ResizetizerCurrentPlatformOutputsFile)" Condition="Exists ('$(_ResizetizerCurrentPlatformOutputsFile)')">
<Output TaskParameter="Lines" ItemName="_ResizetizerOutputs" />
</ReadLinesFromFile>
</Target>
@@ -686,7 +696,7 @@
<Target Name="ResizetizeImages"
Condition="'$(EnableMauiImageProcessing)' == 'true'"
Inputs="$(MSBuildThisFileFullPath);$(_ResizetizerTaskAssemblyName);$(_ResizetizerInputsFile);@(MauiImage)"
- Outputs="$(_ResizetizerStampFile);$(_ResizetizerOutputsFile);@(_ResizetizerOutputs)"
+ Outputs="$(_ResizetizerStampFile);$(_ResizetizerOutputsFile);$(_ResizetizerCurrentPlatformOutputsFile);@(_ResizetizerOutputs)"
AfterTargets="$(ResizetizeAfterTargets)"
BeforeTargets="$(ResizetizeBeforeTargets)"
DependsOnTargets="$(ResizetizeDependsOnTargets)">
@@ -748,6 +758,12 @@
target runs; the Exists() recovery path (line ~663) still forces a rebuild if the
file is deleted. -->
<WriteLinesToFile
+ File="$(_ResizetizerCurrentPlatformOutputsFile)"
+ Lines="@(_ResizetizerCollectedImages->'%(Identity)')"
+ Overwrite="true"
+ />
+ <WriteLinesToFile
+ Condition="'$(_ResizetizerCurrentPlatformOutputsFile)' != '$(_ResizetizerOutputsFile)'"
File="$(_ResizetizerOutputsFile)"
Lines="@(_ResizetizerCollectedImages->'%(Identity)')"
Overwrite="true"
@@ -757,6 +773,7 @@
<ItemGroup>
<FileWrites Include="@(_ResizetizerCollectedImages)" />
<FileWrites Include="$(_ResizetizerStampFile)" />
+ <FileWrites Include="$(_ResizetizerCurrentPlatformOutputsFile)" />
<FileWrites Include="$(_ResizetizerOutputsFile)" />
</ItemGroup>
</Target>Test Results❌ BLOCKED — focused integration runner exited before running tests because local MAUI SDK packs are missing: Command attempted: pwsh .github/skills/run-integration-tests/scripts/Run-IntegrationTests.ps1 -TestFilter "FullyQualifiedName~ChangingExternalBackendPlatformTypeInvalidatesImages" -SkipBuild -SkipInstall -ResultsDirectory "artifacts/integration-tests/try-fix-3"Failure AnalysisThe candidate could not be empirically evaluated. It is distinct and avoids fake try-fix-4 — Platform-specific stamp outputtry-fix-4 — Platform-specific stamp outputApproachResolve a platform-specific stamp such as This differs from PR #36984 by changing stamp outputs rather than persisted input content. It differs from try-fix-1 through try-fix-3 by not adding a platform input, not deleting the primary stamp/output list based on state comparison, and not platform-scoping the output list. Diffdiff --git a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
index d3fd5474e8..0883d507fc 100644
--- a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
+++ b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
@@ -341,7 +341,7 @@
<!-- This allows us to invalidate the build based on not just input image files changing but project item metadata as well -->
<WriteLinesToFile
File="$(_ResizetizerInputsFile)"
- Lines="PlatformType=$(ResizetizerPlatformType);@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
+ Lines="@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile);MonochromeFile=%(MonochromeFile)')"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
@@ -677,7 +677,16 @@
DependsOnTargets="$(ResizetizerAfterFontProcessingTargets)"
Condition="'$(EnableMauiFontProcessing)' == 'true' And '$(ResizetizerAfterFontProcessingTargets)' != ''" />
- <Target Name="_ReadResizetizeImagesOutputs">
+ <Target Name="_ResolveResizetizerPlatformStampFile">
+ <PropertyGroup>
+ <_ResizetizerPlatformStampName Condition="'$(ResizetizerPlatformType)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('$(ResizetizerPlatformType)', '[^A-Za-z0-9_.-]', '_').ToLowerInvariant())</_ResizetizerPlatformStampName>
+ <_ResizetizerPlatformStampFile Condition="'$(_ResizetizerPlatformStampName)' != ''">$(_ResizetizerIntermediateOutputPath)mauiimage.$(_ResizetizerPlatformStampName).stamp</_ResizetizerPlatformStampFile>
+ <_ResizetizerPlatformStampFile Condition="'$(_ResizetizerPlatformStampFile)' == ''">$(_ResizetizerStampFile)</_ResizetizerPlatformStampFile>
+ </PropertyGroup>
+ </Target>
+
+ <Target Name="_ReadResizetizeImagesOutputs"
+ DependsOnTargets="_ResolveResizetizerPlatformStampFile">
<ReadLinesFromFile File="$(_ResizetizerOutputsFile)" Condition="Exists ('$(_ResizetizerOutputsFile)')">
<Output TaskParameter="Lines" ItemName="_ResizetizerOutputs" />
</ReadLinesFromFile>
@@ -686,7 +695,7 @@
<Target Name="ResizetizeImages"
Condition="'$(EnableMauiImageProcessing)' == 'true'"
Inputs="$(MSBuildThisFileFullPath);$(_ResizetizerTaskAssemblyName);$(_ResizetizerInputsFile);@(MauiImage)"
- Outputs="$(_ResizetizerStampFile);$(_ResizetizerOutputsFile);@(_ResizetizerOutputs)"
+ Outputs="$(_ResizetizerStampFile);$(_ResizetizerPlatformStampFile);$(_ResizetizerOutputsFile);@(_ResizetizerOutputs)"
AfterTargets="$(ResizetizeAfterTargets)"
BeforeTargets="$(ResizetizeBeforeTargets)"
DependsOnTargets="$(ResizetizeDependsOnTargets)">
@@ -723,6 +732,9 @@
<_ResizetizerExistingImages Include="$(_MauiIntermediateImages)\**\*" />
<_ResizetizerImagesToDelete Include="@(_ResizetizerExistingImages->'%(FullPath)')" />
<_ResizetizerImagesToDelete Remove="@(_ResizetizerCollectedImages)" />
+ <_ResizetizerExistingPlatformStampFiles Include="$(_ResizetizerIntermediateOutputPath)mauiimage.*.stamp" Condition="'$(_ResizetizerPlatformStampFile)' != '$(_ResizetizerStampFile)'" />
+ <_ResizetizerPlatformStampFilesToDelete Include="@(_ResizetizerExistingPlatformStampFiles)" />
+ <_ResizetizerPlatformStampFilesToDelete Remove="$(_ResizetizerPlatformStampFile)" />
</ItemGroup>
<!-- Remove files which are no longer needed -->
@@ -731,12 +743,18 @@
Files="@(_ResizetizerImagesToDelete)"
/>
+ <Delete
+ Condition="'@(_ResizetizerPlatformStampFilesToDelete->Count())' != '0'"
+ Files="@(_ResizetizerPlatformStampFilesToDelete)"
+ />
+
<ItemGroup>
<MauiProcessedImage Include="@(_ResizetizerCollectedImages)" />
</ItemGroup>
<!-- Touch/create our stamp file for outputs -->
<Touch Files="$(_ResizetizerStampFile)" AlwaysCreate="True" />
+ <Touch Files="$(_ResizetizerPlatformStampFile)" AlwaysCreate="True" Condition="'$(_ResizetizerPlatformStampFile)' != ''" />
<!-- NOTE: do NOT set WriteOnlyWhenDifferent="true" here. This file is listed in the
target's Outputs (line ~671), so its mtime is the target's up-to-date signal.
The file's content is only the SET of output filenames, so editing an existing
@@ -757,6 +775,7 @@
<ItemGroup>
<FileWrites Include="@(_ResizetizerCollectedImages)" />
<FileWrites Include="$(_ResizetizerStampFile)" />
+ <FileWrites Include="$(_ResizetizerPlatformStampFile)" Condition="'$(_ResizetizerPlatformStampFile)' != ''" />
<FileWrites Include="$(_ResizetizerOutputsFile)" />
</ItemGroup>
</Target>Test Results❌ BLOCKED — focused integration runner exited before running tests because local MAUI SDK packs are missing: Command attempted: pwsh .github/skills/run-integration-tests/scripts/Run-IntegrationTests.ps1 -TestFilter "FullyQualifiedName~ChangingExternalBackendPlatformTypeInvalidatesImages" -SkipBuild -SkipInstall -ResultsDirectory "artifacts/integration-tests/try-fix-4"Failure AnalysisThe candidate could not be empirically evaluated. It is a plausible target-level invalidation mechanism and avoids fake file paths, but it adds per-platform stamp files, cleanup complexity, and another resolved property that must be available before 🏁 Report — Final RecommendationComparative Report — PR #36984Candidates Compared
No candidate failed regression tests. All Winning CandidateWinner: The raw PR fix is the winning candidate. It is the smallest complete fix, updates the persisted semantic input state that already drives incremental image processing, and preserves the existing target/output-list model without introducing additional files, deletion heuristics, or property-resolution timing dependencies. 🧭 Next Steps — review latest findingsNo alternative fix was selected for this run. Review the session findings and CI results before merging. |
|
@Redth @jfversluis — final approval handoff for head |
…eview The AnalyzeCopilotTokenUsage stage is pure telemetry, but it could mark the whole build failed when a run produced no token-usage data: on a SKIPPED-gate run the Copilot agent consumed no tokens, so no copilot-token-usage directory was created, and PublishPipelineArtifact failed with "Path does not exist" — reddening a build whose review had already posted its summary fine. (build 14834473, PR #36984.) - Always create the output dir up front so the publish never hits a missing path. - Mark both the Aggregate step and the Publish task continueOnError:true so a missing artifact or transient publish error can't fail the build. The review stages (ReviewPR / RunDeepUITests / UpdateAISummaryComment) remain the real signal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 15d2af20-e4ab-4e88-9011-cfbd83513bc0
…eview The AnalyzeCopilotTokenUsage stage is pure telemetry, but it could mark the whole build failed when a run produced no token-usage data: on a SKIPPED-gate run the Copilot agent consumed no tokens, so no copilot-token-usage directory was created, and PublishPipelineArtifact failed with "Path does not exist" — reddening a build whose review had already posted its summary fine. (build 14834473, PR #36984.) - Always create the output dir up front so the publish never hits a missing path. - Mark both the Aggregate step and the Publish task continueOnError:true so a missing artifact or transient publish error can't fail the build. The review stages (ReviewPR / RunDeepUITests / UpdateAISummaryComment) remain the real signal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 15d2af20-e4ab-4e88-9011-cfbd83513bc0
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!
Summary
ResizetizerPlatformTypeinmauiimage.inputsso platform-only changes invalidateResizetizeImages.Root cause
The external-backend support merged in #36653 passes
ResizetizerPlatformTypeto the image task, but the value was not part of the persisted inputs manifest. Changing only that property therefore left$(_ResizetizerInputsFile)unchanged, allowing MSBuild to skipResizetizeImagesand preserve the previous platform's output shape.The platform value belongs in the persisted manifest because
WriteOnlyWhenDifferentturns a semantic property change into an input-file timestamp change. Putting the raw property directly in the target'sInputs=list would make MSBuild interpret the platform name as a file path rather than as input state.Behavior
Before this change, switching only
ResizetizerPlatformTypefromgenerictoandroidkept the two generic outputs and skipped image processing. After this change, image processing reruns, produces five Androiddrawable-*outputs, removes the stale generic files, and then skips on the next unchanged build.Validation
pwsh .github/skills/run-integration-tests/scripts/Run-IntegrationTests.ps1 -TestFilter "FullyQualifiedName~ChangingExternalBackendPlatformTypeInvalidatesImages" -SkipBuild -SkipInstall -ResultsDirectory "artifacts/integration-tests/platform-invalidation-restored-fix"— passed: 1/1.ResizetizeImages should rerun when only ResizetizerPlatformType changes.Restoring the line and repacking returned the test to green..dotnet/dotnet pack src/SingleProject/Resizetizer/src/Resizetizer.csproj -c Debug --no-restore -p:WarnAsError=false— passed..dotnet/dotnet format src/TestUtils/src/Microsoft.Maui.IntegrationTests/Microsoft.Maui.IntegrationTests.csproj --no-restore --include src/TestUtils/src/Microsoft.Maui.IntegrationTests/ResizetizerTests.cs --exclude-diagnostics CA1822 --verbosity quiet— passed.The full integration skill build/pack lane was attempted first but was blocked locally by
NETSDK1147requesting theiosworkload fornet11.0-ios26.5, even though the workload installation step reported success. The focused test still ran through the skill script against the freshly packedMicrosoft.Maui.Resizetizer.11.0.0-dev.nupkg.Related to #34099 and #35022. Follow-up to merged #36653.