[tests] Share + shrink api-24.xml.in fixture (~56 MiB → 393 KB)#1484
Merged
Conversation
The two `api-24.xml.in` files were ~28 MiB each (56 MiB total) and nearly identical: only 5 `annotated-visibility="TESTS"` markers (used by `JavaTypeModelsTests.AnnotatedVisibility`) differed. Consolidate them into a single shared file under `tests/TestData/` and strip it down to ~390 KB while keeping all 30 tests (17 in `Java.Interop.Tools.JavaTypeSystem-Tests` + 13 in `Xamarin.Android.Tools.ApiXmlAdjuster-Tests`) passing. Changes: * Move `Java.Interop.Tools.JavaTypeSystem-Tests/api-24.xml.in` to `tests/TestData/api-24.xml.in` (preserves the TESTS annotations). * Delete the duplicate copy under `Xamarin.Android.Tools.ApiXmlAdjuster-Tests`. * Point both `JavaApiTestHelper.cs` files at the shared path. * `Xamarin.Android.Tools.ApiXmlAdjuster`'s loader does not recognize `annotated-visibility`; strip the attribute in-memory before parsing in that test project's helper. * Trim the shared XML to the transitive type-resolution closure needed by the test assertions (685 types out of 3823), and additionally strip method/field/constructor bodies from types whose bodies aren't inspected by any test, keeping bodies only on a small allowlist (`ContentObservable`, `Observable`, `ConcurrentHashMap`, `Activity`, `StateListAnimator`, `DrmStore.ConstraintsColumns`). Net repo size reduction: ~55.6 MiB. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Consolidates and significantly shrinks the api-24.xml.in test fixture so multiple test projects can share a single, much smaller API surface while preserving the few annotated-visibility="TESTS" markers needed by JavaTypeModelsTests.AnnotatedVisibility.
Changes:
- Move to a shared fixture at
tests/TestData/api-24.xml.inand trim it to the minimal transitive closure needed by assertions. - Remove the duplicate
api-24.xml.infromtests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/. - Update both test helpers to load the shared fixture; ApiXmlAdjuster tests strip
annotated-visibilitybefore parsing.
Reviewed changes
Copilot reviewed 2 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/TestData/api-24.xml.in | New shared, trimmed api-24 fixture (keeps a small number of annotated-visibility="TESTS" markers). |
| tests/Java.Interop.Tools.JavaTypeSystem-Tests/JavaApiTestHelper.cs | Points JavaTypeSystem tests at the shared fixture path. |
| tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/JavaApiTestHelper.cs | Points ApiXmlAdjuster tests at the shared fixture and strips annotated-visibility before loading. |
| tests/Java.Interop.Tools.JavaTypeSystem-Tests/api-24.xml.in | Removed/moved in favor of the shared tests/TestData fixture. |
| tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/api-24.xml.in | Removed duplicate fixture now replaced by shared tests/TestData copy. |
Comment on lines
+22
to
26
| // The shared api-24.xml.in contains a handful of `annotated-visibility="TESTS"` | ||
| // markers used by Java.Interop.Tools.JavaTypeSystem-Tests. ApiXmlAdjuster's loader | ||
| // does not understand that attribute, so strip it before parsing. | ||
| var text = File.ReadAllText (ApiPath).Replace (" annotated-visibility=\"TESTS\"", ""); | ||
| var api = new JavaApi (); |
Member
Author
There was a problem hiding this comment.
I was going to fix this, but the GitHub app is freezing up because the diff is so large.
I think this is "good enough" and we can fix in the future if needed.
I mainly want to get this in, to improve the diff size at:
simonrozsival
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two
api-24.xml.infiles undertests/were each ~28 MiB (56 MiB total in the repo) and nearly identical — only 5annotated-visibility="TESTS"markers (used byJavaTypeModelsTests.AnnotatedVisibility) differed.This PR consolidates them into a single shared file under
tests/TestData/and trims it down to ~393 KB (685 of the original 3,823 types). All 30 tests still pass:Java.Interop.Tools.JavaTypeSystem-Tests: 17/17Xamarin.Android.Tools.ApiXmlAdjuster-Tests: 13/13Changes
tests/Java.Interop.Tools.JavaTypeSystem-Tests/api-24.xml.in→tests/TestData/api-24.xml.in(preserves theTESTSannotations).tests/Xamarin.Android.Tools.ApiXmlAdjuster-Tests/.JavaApiTestHelper.csfiles at the shared path.Xamarin.Android.Tools.ApiXmlAdjuster's loader does not recognizeannotated-visibility, so its helper strips that attribute in-memory before parsing.<method>,<field>, and<constructor>bodies from types whose bodies no test inspects. Bodies are kept only on a small allowlist:android.database.ContentObservable+android.database.Observable— generic registerObserver mappingjava.util.concurrent.ConcurrentHashMap—searchEntriesgeneric resolutionandroid.app.Activity—addContentViewBaseMethod lookupandroid.animation.StateListAnimator,android.drm.DrmStore.ConstraintsColumns—AnnotatedVisibilityResult
Net diff:
5 files changed, 2637 insertions(+), 2087250 deletions(-).