Skip to content

[build] Clean up completed startup-data migration - #13200

Merged
simonrozsival merged 5 commits into
mainfrom
simonrozsival-audit-startup-leftovers
Oct 28, 2026
Merged

simonrozsival merged 5 commits into
mainfrom
simonrozsival-audit-startup-leftovers

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Why

The completed LLVM/binutils/startup-data migration left a CoreCLR correctness regression and obsolete implementation, package, resource, and documentation paths. CoreCLR still applied assembler escaping before writing raw XCFG strings: environment values and bundled system properties containing quotes/backslashes reached native consumers with extra escape characters. There is no compensating native unescape.

The first commit isolates the correction and red/green tests. The cleanup commit then removes the internal assembler mode after auditing both raw-string production consumers; it also removes the orphaned discrete-assembly packaging helper, unread bookkeeping, and two unselectable Legacy APK-description resources. BuildReleaseArm64 constructs only Simple/XForms + DotNet.CoreCLR + optional .R8 resource names; the Legacy files were merely wildcard-embedded, not selected.

Eight named CoreCLR support-archive declarations no longer serve an app-link consumer after static CoreCLR linking was retired. Remove their product pack/copy wiring and narrowly scrub old staged files, retaining the fixed host's CMake inputs/build archives, NativeAOT static hosts, and official NDK inputs. Local runtime manifests were explicitly regenerated for validation. The existing CreateLocalRuntimeLists input contract is unchanged; the extra project dependency was removed per review, leaving no net change to ConfigureLocalWorkload.targets.

Correct R8/typemap guidance, the moved remapping-task link, XA4327's obsolete LLVM example, comments and the test catalog; mark the original D8/R8 proposal as historical.

Public task contracts, binary layouts/versions, raw CoreCLR default/private compression opt-in, raw-only NativeAOT, Java registration/providers, bootstrap-versus-Java ownership, native initialization ordering, and intentional upgrade cleanup/rejection tests remain intact. No CreateAssemblyStore implementation, Java.Interop source, runtime redesign, new dependency, device harness or public option is included.

Validation

Full build/test snapshot: source tree 177fff609e9827585a4290187dc9d398612da7e3 at 5c5c731f98be31b9a2e32ead70a4699bdf06ea53. Initial and publication-time fetched/live main: 12c2d573cea4794d3e6920d26df9764bb21000de.

Review follow-up 07569c4232ca1e6e8494b9c733a44d9ebe114fde restores only the original local runtime-list Inputs line. On that scoped state, runtime-list generation succeeded, a second invocation skipped as up-to-date, all nine CoreCLR manifests exclude the retired support archives, XML parsing passed, and git diff --exit-code origin/main -- build-tools/create-packs/ConfigureLocalWorkload.targets passed. The 227-test run below preceded this one-line target restoration; it was not rerun afterward. No claim is made that this PR adds automatic invalidation when Runtime.proj asset declarations change.

PATH="$PWD/bin/Debug/dotnet:$PATH" make prepare
./dotnet-local.sh build Microsoft.Android.slnx -t:BuildExtraApiLevels -v:minimal
PATH="$PWD/bin/Debug/dotnet:$PATH" make all

Passed. Full local Debug SDK, including netstandard2.0 legacy and net11.0 modern task assemblies.

./dotnet-local.sh test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj -v:minimal -p:_NativeAotLlvmReadObjPath=/Users/simon/android-toolchain/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj --filter 'FullyQualifiedName~CoreClrBootstrapBlobTests|FullyQualifiedName~GenerateJniRemappingBinaryBlobsTests|FullyQualifiedName~JniRemappingBinaryBlobTests|FullyQualifiedName~NativeAotBootstrapTargetsTests|FullyQualifiedName~NativeAotSystemPropertiesTests|FullyQualifiedName~AssemblyStoreElfWriterTests|FullyQualifiedName~DlopenAssemblyStoreGeneratorTests|FullyQualifiedName~TypeMapProguardTargetsTests'

Passed: 200; failed/skipped: 0. Producer/payload/ELF, native property-reader, retained-key and incremental target coverage.

./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~GenerateNativeApplicationConfigSourcesTests|FullyQualifiedName~EnvironmentBuilderTests|FullyQualifiedName~GeneratePackageManagerJavaTests' --logger 'console;verbosity=minimal'

Passed: 18; failed/skipped: 0. The four existing configuration cases failed before the correction on literal paths/quoted JSON in both XCFG tables; they pass afterward along with UTF-8, empty values, counting and ordinary bootstrap behavior.

./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'Name~UnchangedCoreClrBootstrapDoesNotRegenerateOnNextBuild|Name~CoreClrBootstrapInputsAreIndependentOfJavaResources|Name~JniRemappingCountsSurviveIncrementalBuild|Name~BuildCoreClrWithPrebuiltRuntime|Name~BuildNativeAotWithoutCPlusPlusArchives' --logger 'console;verbosity=minimal'

Passed: 9; failed/skipped: 0. Real app builds cover no-op/missing-output/stamp/failure/Clean contracts, multi-ABI remapping, NDK-free CoreCLR and NativeAOT links for arm, arm64 and x64.

./dotnet-local.sh pack build-tools/create-packs/Microsoft.Android.Runtime.proj -c Debug -p:AndroidRuntime=CoreCLR -p:AndroidRID=android-arm64 -p:AndroidApiLevel=37 -v:minimal
./dotnet-local.sh pack build-tools/create-packs/Microsoft.Android.Runtime.proj -c Debug -p:AndroidRuntime=NativeAOT -p:AndroidRID=android-arm64 -p:AndroidApiLevel=37 -v:minimal
./dotnet-local.sh build src/native/native-clr.csproj --no-restore -v:minimal
./dotnet-local.sh build build-tools/create-packs/Microsoft.Android.Sdk.proj -t:CreateLocalRuntimeLists -c Debug -v:normal
./dotnet-local.sh msbuild src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj -getItem:EmbeddedResource -verbosity:quiet

Passed (package invocations additionally set separate local PackageOutputPath directories). Controlled CoreCLR nupkg and symbols-package comparison removes exactly four present support archives and retains ten byte-identical native payloads. Four stale-only lz4/startup archives were seeded into staging; cleanup removes all eight known names. A deliberately missing fixed-host DSO rebuilds byte-identically with unchanged underlying archive hashes. NativeAOT packages retain both static host archives and NDK link inputs. Explicitly regenerated CoreCLR RuntimeList instances exclude the removed archives; unchanged generation skips, and missing-output recovery regenerated an identical manifest. These checks are distinct from automatic invalidation on asset-declaration changes, which is not changed here. All four selectable CoreCLR APK baselines remain embedded.

git diff --check, changed XML parsing, and changed relative Markdown-link resolution passed.

Limits and unsuccessful attempts

  • Host-only macOS validation; no device/emulator, benchmark or manual CI retry. Windows/Linux pack-target evaluation fails MSB4184 because their real NDK host toolchains are absent; execution on those hosts is not claimed.
  • Initial bare make prepare && make all failed because dotnet was absent from PATH; repo-local SDK PATH resolved preparation. The first default build compiled but workload setup failed for missing API 37.1 reference output; documented BuildExtraApiLevels resolved it. Complete builds passed at the full-validation snapshot.
  • An initial pack command without -c Debug selected Release and failed because only Debug prep tasks were built. Explicit Debug packaging passes.
  • One initial nine-app run overlapped my deliberate missing-manifest experiment: four NETSDK1109 failures and five passes. That agent-induced validation contamination is not a product regression or a pass. All nine passed on the settled SDK and again in the sequential full-validation run.

This audit traces concrete contracts and retired-file references; it does not claim that a grep proves the entire repository free of dead code.

simonrozsival and others added 2 commits October 19, 2026 17:34
CoreCLR writes XCFG strings directly, so assembler escaping changes\nquotes and backslashes before native environment and property lookup.\nSelect the existing raw EnvironmentBuilder mode, matching NativeAOT.\n\nExtend the existing pooled-bootstrap task cases to read both tables and\ncheck literal paths, quoted JSON, Unicode, and empty values.  The four\nregression cases fail before the producer change and pass afterward.

Co-authored-by: Copilot App <[email protected]>
Remove the internal assembler-escaping mode now that both bootstrap
producers write raw strings, the orphaned discrete-assembly packaging
helper, unread bookkeeping, and unselectable legacy APK size baselines.

Stop distributing CoreCLR static support archives after retiring app
runtime linking.  Keep fixed-host build inputs and NativeAOT archives;
remove only known stale pack assets and track the runtime pack project
when regenerating local RuntimeList metadata.

Correct current typemap/R8 documentation, task links, stale comments,
and the test catalog; label the original D8/R8 proposal as historical.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 16:00
Remove the extra runtime-pack project dependency per review.  Explicit
manifest regeneration handles this cleanup without permanently changing
the local workload target input contract.

Co-authored-by: Copilot App <[email protected]>

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.

🔵 Needs a closer look

Cross-platform runtime-pack cleanup warrants final human review because reported execution validation is limited to macOS.

No open issues 🎉

What changed in this PR

Fixes CoreCLR startup-string preservation and removes obsolete build, packaging, and documentation paths left by the startup-data migration.

Changes:

  • Preserve literal quotes and backslashes, with regression coverage for both startup tables.
  • Remove unused helpers, bookkeeping, legacy baselines, and CoreCLR support-archive packaging.
  • Refresh runtime manifests and update typemap, R8, and toolchain guidance.
File Description
src/​Xamarin.Android.Build.Tasks/​Utilities/​AssemblyPackagingHelper.cs Removes unused packaging helper.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.ProjectTools/​Resources/​Base/​BuildReleaseArm64XFormsLegacy.apkdesc Removes obsolete Forms baseline.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.ProjectTools/​Resources/​Base/​BuildReleaseArm64SimpleLegacy.apkdesc Removes obsolete simple-app baseline.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Utilities/​EnvironmentHelper.cs Reads bootstrap system properties for assertions.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​GenerateNativeApplicationConfigSourcesTests.cs Tests literal startup-string preservation.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​EnvironmentBuilderTests.cs Tests unescaped environment and property values.
src/​Xamarin.Android.Build.Tasks/​Tasks/​GenerateNativeApplicationConfigSources.cs Removes unread assembly bookkeeping.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.targets Clarifies incremental-build and hook comments.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Proguard.targets Corrects NativeAOT toolchain comments.
src/​native/​native.targets Excludes and cleans obsolete staged CoreCLR archives.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​Scanner/​JavaPeerScanner.cs Updates historical diagnostic comments.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​README.md Updates pipeline and incrementality documentation.
src/​Microsoft.Android.Build.Tasks/​Utilities/​EnvironmentBuilder.cs Removes assembler escaping; retains NUL rejection.
src/​Microsoft.Android.Build.Tasks/​Tasks/​GenerateNativeAotDataObject.cs Uses simplified environment-builder constructor.
src/​Microsoft.Android.Build.Tasks/​Tasks/​GenerateJniRemappingBinaryBlobs.cs Removes unused payload bookkeeping.
Documentation/​project-docs/​ApkSharedLibraries.md Distinguishes build archives from runtime-pack assets.
Documentation/​guides/​internals/​JavaJNI_Interop.md Corrects task link and NativeAOT guidance.
Documentation/​guides/​D8andR8.md Documents current pipelines and labels historical material.
Documentation/​docs-mobile/​messages/​xa4327.md Replaces obsolete LLVM typemap example.
build-tools/​create-packs/​Microsoft.Android.Runtime.proj Removes CoreCLR support-archive package entries.
build-tools/​create-packs/​ConfigureLocalWorkload.targets Tracks runtime project changes in manifest generation.
.github/​skills/​tests/​references/​test-catalog.md Removes obsolete marshal-method test entry.

Review effort: Balanced

@simonrozsival

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

❌ Android PR Reviewer failed. Please review the logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #13200

@github-actions github-actions Bot 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.

⚠️ Needs Changes — 0 errors, 0 warnings, 1 suggestion.

The cleanup is coherent: raw values now flow correctly into the binary CoreCLR and NativeAOT formats, obsolete package artifacts and staging inputs are consistently removed, and the CoreCLR regression coverage verifies backslashes, quotes, UTF-8, and empty values in both XCFG tables. I found no blocking correctness, safety, or performance defects.

One focused test-coverage suggestion is inline for the affected NativeAOT consumer. At review time, all completed CI checks were successful; Package Tests macOS > Tests > APKs 2 remained in progress and the aggregate dotnet-android check was queued, so the final CI result was not yet available.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #13200 · copilot · gpt56 · 415.5 AIC · ⌖ 7.07 AIC · ⊞ 28.4K
Comment /review to run again

Extend the existing mapped-object native probe to return environment
values as well as bundled system properties.  Exercise literal quotes,
backslashes, Unicode, duplicate replacement, empty and missing values
through GenerateNativeAotDataObject and the production native reader.

Keep the coverage in the existing fixture and run its ABI cases for
arm, arm64 and x64 data objects.  Both NativeAOT bootstrap test fixtures
pass locally: 24 tests, no failures or skips.

Co-authored-by: Copilot App <[email protected]>
Preserve the bootstrap task and test relocations from main while
retaining raw environment values, payload coverage and package cleanup.

Validation: full local SDK build passed; 220 focused modern task tests
and 9 real app/incremental build tests passed with no skips.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #13200

@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 28, 2026

@github-actions github-actions Bot 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.

✅ LGTM — no blocking code findings

Findings: 0 errors, 0 warnings, 1 optional testing suggestion posted inline.

The raw-string correction matches the binary contract: CoreCLR writes UTF-8 strings directly into XCFG, and its native environment/property consumers do not unescape them. Removing assembler escaping fixes the extra quotes/backslashes without changing the layout. NativeAOT already used raw values; the expanded production-reader probe now covers both tables, duplicate replacement, UTF-8, and empty/missing values across its three supported object ABIs, addressing the previous review feedback.

The CoreCLR archive exclusions are scoped to the retired filenames and runtime flavor, while the fixed-host build inputs and NativeAOT static-host packaging remain intact. The deleted packaging helper has no remaining callers, and BuildReleaseArm64 selects only the retained DotNet.CoreCLR resource names. Documentation changes align with the current binary-data and trimmable-typemap paths.

CI: All 41 head-commit GitHub checks report success, including the aggregate dotnet-android check for Azure build 1650938. Direct Azure build/timeline verification was unavailable because az devops invoke required authentication. This was a static review; local builds/tests were not run.

Generated by Android PR Reviewer for #13200 · copilot · gpt61 · 66.9 AIC · ⌖ 4.76 AIC · ⊞ 20K
Comment /review to run again

Comment thread src/native/native.targets
<_ObsoleteCoreClrArchive Include="@(_ObsoleteRuntimePackDirectory->'%(Identity)\libxamarin-startup-release.a')" />
<_ObsoleteCoreClrArchive Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\Debug\libxamarin-app.so')" />
<_ObsoleteCoreClrArchive Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\Release\libxamarin-app.so')" />
<_RuntimePackFiles Remove="@(_ObsoleteCoreClrArchive)" MatchOnMetadata="Filename;Extension" MatchOnMetadataOptions="CaseInsensitive" />

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.

🤖 💡 Testing — Consider preserving the seeded-staging checks described in the PR as an automated regression test for _CopyToPackDirs. Seed the eight retired support archives in both the native output and staged CoreCLR pack, then assert that the staged copies disappear, the source build archives remain, and the fixed-host DSOs are still copied. A NativeAOT case should retain its static host archives. The existing app-build tests exercise runtime consumption, but would not detect obsolete archives silently reappearing in a pack.

Rule: Test edge cases and regression coverage

@simonrozsival
simonrozsival merged commit b6f5b1d into main Oct 28, 2026
41 checks passed
@simonrozsival
simonrozsival deleted the simonrozsival-audit-startup-leftovers branch October 28, 2026 20:06
simonrozsival added a commit that referenced this pull request Nov 4, 2026
Context: #13200

The completed LLVM/binutils retirement left four PoliCheck suppressions for GNU-binutils GPLv3 license text that is no longer in `THIRD-PARTY-NOTICES.TXT`. Public Linux/macOS setup also still installs p7zip, although the only executable `7z` consumer left in the tree is the unused `Xamarin.ProjectTools.SevenZipHelper` test helper.

Remove those four suppressions, delete `SevenZipHelper`, and stop installing p7zip. The helper has no callers or explicit project-file inclusion; SDK compile globs need no corresponding change. Keep the other Linux build dependencies: `cmake`, `ninja-build`, and `ccache`.

Current extraction paths do not need a replacement: Android SDK setup uses `unzip`/managed ZIP APIs, workload extraction uses MSBuild `Unzip`, and the Unix .NET installer uses `tar`. Inspection of the exact pinned `apkdiff` 0.0.17 and `dotnet-test-slicer` 0.1.0-alpha7 source commits found no 7-Zip dependency.

Remove the remaining historical release-bundle download and extraction instructions from `Documentation/workflow/DevelopmentTips.md` as well. Keep the instructions for obtaining debug symbols from a custom local build and loading them in LLDB. No 7-Zip references remain in tracked source or documentation; broader substring matches are only an unrelated timestamp and encoded Alpine public-key data.

The shipped notices already contain no GNU-binutils or p7zip entry. Leave them unchanged, including the Android documentation GPLv2/Classpath material. All unrelated suppressions remain intact.
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