Skip to content

[Xamarin.Android.Build.Tasks] Remove unused assembly codegen state - #13055

Merged
simonrozsival merged 2 commits into
mainfrom
simonrozsival-assembly-codegen-cleanup
Oct 10, 2026
Merged

simonrozsival merged 2 commits into
mainfrom
simonrozsival-assembly-codegen-cleanup

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Follow-up to #13030.

Xamarin.Android.Tasks.AssemblyModifierPipeline still parses a codegen
target and copies it into StepContext.CodeGenerationTarget, but no
assembly-rewriting step reads that value after JavaInterop1 retirement.
Remove the unused field, context property, parser, and task-argument
propagation. Also remove $(_AndroidJcwCodegenTarget) from the build
properties cache, since it no longer affects assembly rewriting.

Keep the CodeGenerationTarget task input as a no-op so explicit external
MSBuild task invocations remain compatible. Keep JavaPeerStyle, codegen
defaults, and the XA4232/XA4240 retired-value diagnostics unchanged.
Assembly-copy/rewrite logic and all other cache entries are untouched.

Only four production files change, with 19 deletions and no additions.
No tests are added or modified, as requested.

Local validation

All builds and tests use this branch's locally built SDK.

Command Result
make prepare && make all Preparation and solution compilation passed. Initial workload configuration failed because the extra API 37.1 reference assembly had not been built; resolved by the existing targets below.
./dotnet-local.sh build Microsoft.Android.slnx -t:BuildExtraApiLevels -c Debug -v quiet Passed: 0 errors.
./dotnet-local.sh build build-tools/create-packs/Microsoft.Android.Sdk.proj -t:ConfigureLocalWorkload -c Debug -v quiet Passed: 0 warnings, 0 errors.
./dotnet-local.sh build src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj -c Debug --no-restore -v quiet Passed: 38 existing warnings, 0 errors.
./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~LinkerTests|Name~UnsupportedCodegenTargetIsRejected|Name~UnsupportedJcwCodegenTargetIsRejected' Passed: 43 passed, 4 skipped, 0 failed.
git diff --check Passed.

The four skipped cases are existing intentional Assert.Ignore cases,
not missing prerequisites:

  • LinkDescription(False,CoreCLR): CoreCLR does not support builds without assembly stores.
  • RemoveDesigner(False,CoreCLR): CoreCLR supports only assembly stores.
  • WarnAboutAppDomains((True, CoreCLR)): Release-case trimmer-warning issue dotnet/linker#2982.
  • WarnAboutAppDomains((True, NativeAOT)): The same existing Release-case trimmer-warning issue.

Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

simonrozsival and others added 2 commits October 9, 2026 23:46
Remove unused target parsing and pipeline context state after JavaInterop1 retirement. Stop passing the target to assembly rewriting and caching the unused JCW target, while retaining the task input as a documented no-op for compatibility. Keep codegen defaults and retired-value diagnostics unchanged.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 21:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused cleanup preserves compatibility inputs and existing validation while removing only verified unused state.

0 open findings

What changed in this PR

Removes obsolete code-generation state from the assembly-rewriting pipeline while retaining the task input for compatibility.

Changes:

  • Removes unused parsing and pipeline state.
  • Stops propagating codegen targets into assembly rewriting.
  • Removes the irrelevant property-cache entry.
File Description
Xamarin.Android.Common.targets Removes obsolete task propagation and cache input.
MonoAndroidHelper.cs Removes the unused parser.
AssemblyPipeline.cs Removes codegen state from StepContext.
AssemblyModifierPipeline.cs Removes parsing and context assignment.

🧠 Review effort: Balanced

@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Oct 9, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete four-file correctness and integration review confirms that only unused codegen state and an irrelevant cache entry were removed. The no-op task input, retired-value diagnostics, and assembly rewrite/copy behavior remain intact. The previously failed APK leg and its exact JNI-reference tests now pass on the existing retry, resolving the CI deferral.

@simonrozsival
simonrozsival merged commit deb116b into main Oct 10, 2026
43 checks passed
@simonrozsival
simonrozsival deleted the simonrozsival-assembly-codegen-cleanup branch October 10, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants