Skip to content

[Xamarin.Android.Build.Tasks] Remove orphaned Cecil helpers - #13095

Merged
simonrozsival merged 1 commit into
mainfrom
simonrozsival-orphaned-cecil-helper-cleanup
Oct 13, 2026
Merged

simonrozsival merged 1 commit into
mainfrom
simonrozsival-orphaned-cecil-helper-cleanup

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

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

Why

Remove the already-orphaned internal Xamarin.Android.Tasks.CecilExtensions type in src/Xamarin.Android.Build.Tasks/Utilities/CecilExtensions.cs. Its registration adapters and source lookup have no remaining product or test callers on the current main branch. Keeping this unused duplicate obscures which Cecil helpers are still needed by the tooling.

The containing type is internal despite its public members. Whole-repository source/member/name searches and C# reference lookup found no consumers, linked-source imports, reflection/configuration references, or generated-name references to this task-side type. The three friend-test assemblies have no callers either. This SDK-style project includes the file implicitly, so no explicit compile item needs removal.

This is a one-file, 187-line deletion, not the retirement of all Cecil helpers. No public API, shared naming/CRC code, Cecil package, metadata scanner, or runtime behavior changes. No new absence tests or unrelated cleanup. No issue is being closed.

Remaining prerequisites

The distinct internal Java.Interop.Tools.JavaCallableWrappers.Utilities.CecilExtensions stays unchanged. Its method/export/source helper chains are still called by CecilImporter on main and must wait until #13080 merges. Its type-registration chain remains live through JavaTypeScanner and must wait for the separate scanner-removal change to merge. This PR is independently based on main; no pending PR trees were applied or stacked.

Local validation

Validated code is committed as cf0fff06adb02fbab9719498c7fdb0adb33d010c, based on 290a2824be3e1cff18675587c4432c0e944c1f0f. All SDK builds and tests used this worktree's own Debug SDK, not sibling/stale binaries. No device install/run was performed: this only removes an unreachable host-tool type.

Builds ran with MSBUILDDISABLENODEREUSE=1, DOTNET_CLI_USE_MSBUILD_SERVER=0, and DOTNET_PROCESSOR_COUNT=2. MSBuild was bounded to -m:2. The session-only Ninja wrapper was verified to execute /Users/simon/android-toolchain/sdk/cmake/4.1.2/bin/ninja -j2 "$@"; native build logs confirm its use. There were no shared build-server kills or global configuration changes.

For the command records below, N expands to /Users/simon/.copilot/session-state/36bfc8ae-8b3f-45aa-84bc-3c98929dca49/files/ninja-j2, B expands to /Users/simon/.copilot/session-state/36bfc8ae-8b3f-45aa-84bc-3c98929dca49/files/baseline.targets, and F expands to /Users/simon/.copilot/session-state/36bfc8ae-8b3f-45aa-84bc-3c98929dca49/files. These are the literal session paths used in the executed commands, abbreviated only for readability.

Baseline

Baseline compilation restored the exact main-commit helper as a compile input, without undoing the working-tree deletion: git show HEAD:src/Xamarin.Android.Build.Tasks/Utilities/CecilExtensions.cs exported the tracked source to session storage (SHA-256 d9fdb36c50e143b0b190bc9d87192a972e039414e2511874bcd74e21d9cb7be4). The session-only $B adds that source only to Xamarin.Android.Build.Tasks via CustomBeforeMicrosoftCommonTargets. Compiler output confirms this input. Changed builds omit the import entirely.

Command Result
make prepare CONFIGURATION=Debug MSBUILD_ARGS="-m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N" Passed; own SDK/bootstrap/tooling prepared.
make all CONFIGURATION=Debug MSBUILD_ARGS="-m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -p:CustomBeforeMicrosoftCommonTargets=$B" Initial solution build passed; workload setup failed because the API 37.1 ref/Mono.Android.dll had not yet been generated.
./dotnet-local.sh build build-tools/scripts/Prepare.proj -t:BuildExtraApiLevels -c Debug -m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -p:CustomBeforeMicrosoftCommonTargets=$B -bl:$F/baseline-extra-api.binlog Passed; generated API 37.1/37.2 through the existing target, without fabricated/copied references or pin changes.
make all CONFIGURATION=Debug MSBUILD_ARGS="-m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -p:CustomBeforeMicrosoftCommonTargets=$B" Retry passed, including local workload setup.
./dotnet-local.sh build src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj -c Debug -m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -p:CustomBeforeMicrosoftCommonTargets=$B -bl:$F/baseline-tasks.binlog Passed; netstandard2.0, zero errors.
./dotnet-local.sh build src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj -c Debug -m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -p:CustomBeforeMicrosoftCommonTargets=$B -bl:$F/baseline-illink.binlog Passed; net11.0, zero errors.
./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~LinkerTests.LinkAssembliesNoShrink|FullyQualifiedName~LinkerTests.PostTrimmingSkipsLegacyAbstractFixups|FullyQualifiedName~LinkerTests.FixAbstractMethodsStep_|FullyQualifiedName~LinkerTests.PreTrimmingFixLegacyBindings|FullyQualifiedName~GeneratePackageManagerJavaTests|FullyQualifiedName~BindingBuildTest.DotNetBuildBinding' --logger 'trx;LogFileName=baseline-host-focused.trx' --results-directory $F Passed: 14 passed, zero failed/skipped.
./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~LinkerTests.LinkDescription' --logger 'trx;LogFileName=baseline-linker-integration.trx' --results-directory $F Passed: one passed, one skipped.

Changed tree

Command Result
make all CONFIGURATION=Debug MSBUILD_ARGS="-m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N" Passed, including rebuilt SDK and local workload setup.
./dotnet-local.sh build src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj -c Debug -m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -bl:$F/changed-tasks.binlog Passed; netstandard2.0, zero errors.
./dotnet-local.sh build src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj -c Debug -m:2 -p:UseSharedCompilation=false -p:NinjaPath=$N -bl:$F/changed-illink.binlog Passed; net11.0, zero errors.
./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~LinkerTests.LinkAssembliesNoShrink|FullyQualifiedName~LinkerTests.PostTrimmingSkipsLegacyAbstractFixups|FullyQualifiedName~LinkerTests.FixAbstractMethodsStep_|FullyQualifiedName~LinkerTests.PreTrimmingFixLegacyBindings|FullyQualifiedName~GeneratePackageManagerJavaTests|FullyQualifiedName~BindingBuildTest.DotNetBuildBinding|FullyQualifiedName~LinkerTests.LinkDescription' --logger 'trx;LogFileName=changed-host.trx' --results-directory $F Passed: 15 passed, zero failed, one skipped.
git diff --check HEAD^ HEAD Passed.

TRX comparison confirms identical outcomes for every one of the 16 baseline/changed cases. Coverage includes CoreCLR/NativeAOT binding builds, no-shrink/pre-trimming/post-trimming task paths, package-manager generation, and CoreCLR ILLink integration. LinkDescription(False,CoreCLR) is skipped in both runs because CoreCLR does not support builds without assembly stores. Existing generated-binding and duplicate nullable-source warnings remain; there are no build errors.

Remove the internal Xamarin.Android.Tasks.CecilExtensions type, whose
registration adapters and source lookup have no remaining callers.
The SDK project includes this file implicitly, so no compile item needs
removal.  Product, friend-test, shared-source, and name-based reference
checks find no consumers of this task-side type.

Retain the separate JavaCallableWrappers CecilExtensions type: its
CecilImporter and JavaTypeScanner callers are still live on main.
Their pending removals must merge before that cleanup is safe.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 21:42

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

Repository searches show no remaining consumers, and the focused validation covers the affected tooling paths.

0 open findings

What changed in this PR

Removes an unused, internal Cecil helper duplicate from the build-task assembly.

Changes:

  • Deletes orphaned registration adapters and source-lookup helpers.
  • Retains the separate, actively used Java.Interop implementation.
File Description
src/​Xamarin.Android.Build.Tasks/​Utilities/​CecilExtensions.cs Removes the unused helper type.

🧠 Review effort: Balanced

@simonrozsival
simonrozsival merged commit 9c3aa65 into main Oct 13, 2026
43 checks passed
@simonrozsival
simonrozsival deleted the simonrozsival-orphaned-cecil-helper-cleanup branch October 13, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants