Skip to content

Commit da98eb3

Browse files
committed
Fix CheckNothingIsDeletedByIncrementalClean by moving _RemoveRegisterFlag to stamp directory
The _RemoveRegisterAttribute target's stamp file (shrunk.flag) was located at $(MonoAndroidIntermediateAssemblyDir)shrunk/shrunk.flag, inside the tree globbed by <FileWrites Include="$(MonoAndroidIntermediateAssemblyDir)**" />. Since _RemoveRegisterAttribute runs during SignAndroidPackage (after IncrementalClean), the glob didn't capture the stamp on build 1 but did on build 2, causing FileListAbsolute.txt to grow. Fix by: - Moving the stamp to $(_AndroidStampDirectory)_RemoveRegisterAttribute.stamp, following the existing naming convention for stamp files - Adding _RemoveRegisterAttribute to IncrementalCleanDependsOn so it runs before _AddFilesToFileWrites, ensuring the stamp exists when the $(_AndroidStampDirectory)*.stamp glob captures it - Removing the now-unnecessary MakeDir for the old shrunk directory (it was only needed for the flag file, not for shrunk assemblies which go to the publish directory)
1 parent 9f693f3 commit da98eb3

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ properties that determine build ordering.
5454
</BuildDependsOn>
5555
<IncrementalCleanDependsOn>
5656
_PrepareAssemblies;
57+
_RemoveRegisterAttribute;
5758
_CompileDex;
5859
$(_AfterCompileDex);
5960
_AddFilesToFileWrites;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<UsingTask TaskName="Xamarin.Android.Tasks.GenerateProguardConfiguration" AssemblyFile="$(_XamarinAndroidBuildTasksAssembly)" />
1010

1111
<PropertyGroup>
12-
<_RemoveRegisterFlag>$(MonoAndroidIntermediateAssemblyDir)shrunk\shrunk.flag</_RemoveRegisterFlag>
12+
<_RemoveRegisterFlag>$(_AndroidStampDirectory)_RemoveRegisterAttribute.stamp</_RemoveRegisterFlag>
1313
<!-- Inject typemap-specific targets into build dependency chains -->
1414
<_BeforeAddStaticResources>$(_BeforeAddStaticResources);_GetMonoPlatformJarPath</_BeforeAddStaticResources>
1515
<_BeforeCompileJava>$(_BeforeCompileJava);_GetMonoPlatformJarPath</_BeforeCompileJava>
@@ -325,7 +325,6 @@
325325
<RemoveRegisterAttribute
326326
Condition=" '$(_AndroidRuntime)' != 'NativeAOT' and '$(PublishReadyToRun)' != 'true' "
327327
ShrunkFrameworkAssemblies="@(_ShrunkAssemblies)" />
328-
<MakeDir Directories="$(MonoAndroidIntermediateAssemblyDir)shrunk" />
329328
<Touch Files="$(_RemoveRegisterFlag)" AlwaysCreate="true" />
330329
</Target>
331330

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ public void CheckNothingIsDeletedByIncrementalClean ([Values] bool enableMultiDe
143143
FileAssert.Exists (file);
144144
File.SetLastWriteTimeUtc (file, DateTime.UtcNow);
145145
}
146-
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "Second should have succeeded");
147-
b.Output.AssertTargetIsNotSkipped ("_CleanMonoAndroidIntermediateDir");
148-
var stampFiles = Path.Combine (intermediate, "stamp", "_ResolveLibraryProjectImports.stamp");
149-
FileAssert.Exists (stampFiles, $"{stampFiles} should exist!");
150-
var libraryProjectImports = Path.Combine (intermediate, "libraryprojectimports.cache");
151-
FileAssert.Exists (libraryProjectImports, $"{libraryProjectImports} should exist!");
146+
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "Second should have succeeded");
147+
b.Output.AssertTargetIsNotSkipped ("_CleanMonoAndroidIntermediateDir");
148+
var stampFiles = Path.Combine (intermediate, "stamp", "_ResolveLibraryProjectImports.stamp");
149+
FileAssert.Exists (stampFiles, $"{stampFiles} should exist!");
150+
var libraryProjectImports = Path.Combine (intermediate, "libraryprojectimports.cache");
151+
FileAssert.Exists (libraryProjectImports, $"{libraryProjectImports} should exist!");
152152

153153
//No changes
154154
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "Third should have succeeded");

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,6 @@ because xbuild doesn't support framework reference assemblies.
19171917
<CopyIfChanged
19181918
SourceFiles="@(_ResolvedAssemblies->'%(Identity).config')"
19191919
DestinationFiles="@(_ShrunkAssemblies->'%(Identity).config')" />
1920-
<MakeDir Directories="$(MonoAndroidIntermediateAssemblyDir)shrunk" />
19211920
</Target>
19221921

19231922
<Target Name="_ResolveSatellitePaths"

0 commit comments

Comments
 (0)