Skip to content

Commit f19c1fc

Browse files
authored
[xabt] Fix _TouchAndroidLinkFlag target skipping on NativeAOT incremental builds (#10849)
Add '$(RunILLink)' != 'false' to the Condition of _TouchAndroidLinkFlag so it Condition-skips in lockstep with the ILLink target it hooks via AfterTargets. This works around an MSBuild behavior (dotnet/msbuild#13274) where AfterTargets hooks may fire before the target actually executes, leading to a stale flag. Without this fix, _TouchAndroidLinkFlag's Inputs/Outputs check sees stale timestamps on the first (skipped) ILLink invocation and skips itself, then never runs again when ILLink actually executes. This can sometimes cause link.flag to go stale, which can cause _RemoveRegisterAttribute and the AssemblyModifierPipeline to skip on incremental builds.
1 parent a040a1d commit f19c1fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243

244244
<Target Name="_TouchAndroidLinkFlag"
245245
AfterTargets="ILLink"
246-
Condition=" '$(PublishTrimmed)' == 'true' and Exists('$(_LinkSemaphore)') "
246+
Condition=" '$(PublishTrimmed)' == 'true' and '$(RunILLink)' != 'false' and Exists('$(_LinkSemaphore)') "
247247
Inputs="$(_LinkSemaphore)"
248248
Outputs="$(_AndroidLinkFlag)">
249249
<!-- This file is an input for _RemoveRegisterAttribute -->

0 commit comments

Comments
 (0)