Repository navigation
[build] Move GenerateNativeApplicationConfigSources to Microsoft.Android.Build.Tasks - #13199
Conversation
…oid.Build.Tasks Move GenerateNativeApplicationConfigSources, CoreClrBootstrapBuilder, RuntimePropertiesParser, and BundleConfigSplitConfigsChecker from Xamarin.Android.Build.Tasks (netstandard2.0) to Microsoft.Android.Build.Tasks (net11.0), and invoke the task with MSBuildRuntime="NET" from _AndroidGenerateCoreClrBootstrap. Compute the DSO cache CRC-32 directly via System.IO.Hashing.Crc32 in CoreClrBootstrapBuilder and remove TypeMapHelper.HashNameForCLR so Xamarin.Android.Build.Tasks no longer needs Crc32 for CoreCLR bootstrap generation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nal Runtime="NET" UsingTask Match the pattern in #13195 by registering Microsoft.Android.Tasks.GenerateNativeApplicationConfigSources with the conditional Full/Core Runtime="NET" <UsingTask> declarations and removing the redundant MSBuildRuntime="NET" attribute on the task invocation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ootstrapBuilder Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The relocated helper introduces a nullable compilation error in the legacy netstandard2.0 task project.
1 open issue
What changed in this PR
Moves CoreCLR bootstrap generation into the modern .NET task assembly, removing its CRC-32 dependency from the legacy implementation.
Changes:
- Relocates the task and supporting utilities.
- Updates task registration and incremental-build tracking.
- Migrates tests and adds registration checks.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | Registers the moved task and tracks its assembly. |
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj | Removes obsolete source links. |
| src/Xamarin.Android.Build.Tasks/Utilities/TypeMapHelper.cs | Removes the CRC-32 helper. |
| src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs | Relocates shared helpers. |
| src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs | Removes relocated and unused ELF helpers. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GeneratePackageManagerJavaTests.cs | Removes migrated bootstrap tests. |
| src/Microsoft.Android.Build.Tasks/Utilities/RuntimePropertiesParser.cs | Moves parser namespace. |
| src/Microsoft.Android.Build.Tasks/Utilities/MonoAndroidHelper.Assemblies.cs | Hosts shared assembly and runtime helpers. |
| src/Microsoft.Android.Build.Tasks/Utilities/CoreClrBootstrapBuilder.cs | Implements hashing and JNI-library detection locally. |
| src/Microsoft.Android.Build.Tasks/Utilities/BundleConfigSplitConfigsChecker.cs | Moves checker namespace. |
| src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Tasks/RuntimePropertiesParserTests.cs | Updates parser imports. |
| src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Tasks/GenerateNativeApplicationConfigSourcesTests.cs | Migrates coverage and generates ELF fixtures. |
| src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Tasks/EnvironmentBuilderTests.cs | Relocates environment tests. |
| src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/NativeAotBootstrapTargetsTests.cs | Checks task registration and assembly tracking. |
| src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj | Links the bootstrap test helper. |
| src/Microsoft.Android.Build.Tasks/Tasks/GenerateNativeApplicationConfigSources.cs | Moves task namespace and resource references. |
| src/Microsoft.Android.Build.Tasks/Microsoft.Android.Build.Tasks.csproj | Adds hashing dependency and shared runtime enum. |
Review effort: Balanced
…blies.cs on netstandard2.0 Use the .IsNullOrEmpty() extension method (annotated with [NotNullWhen(false)]) in GetAssemblyCulture and GetNormalizedNativeLibraryName so that MonoAndroidHelper.Assemblies.cs compiles without CS8602 when linked into Xamarin.Android.Build.Tasks (netstandard2.0). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…g-sources Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
No blocking code findings — 0 ❌ errors, 0
Reviewed all 16 changed files in full, checked callers and shared-source links, and compared the relocated JNI detection and naming-policy values with their previous implementations. The migration keeps the bootstrap generation self-contained in the modern task assembly, updates the incremental task-assembly input, and preserves environment-update and excluded-assembly coverage while removing the native fixture dependency. The inline suggestion concerns the synthetic ELF fixture's hard-coded byte offset.
CI: All 41 head-commit GitHub checks report success, including the aggregate dotnet-android check for Azure build 1646682. Direct Azure build/timeline verification could not be completed because az devops invoke requires authentication in this environment; the CI assessment is therefore limited to the GitHub-reported results. No local build or tests were run during this review.
Generated by Android PR Reviewer for #13199 · copilot · gpt61 · 55.6 AIC · ⌖ 7.9 AIC · ⊞ 19.1K
Comment /review to run again
… in GenerateNativeApplicationConfigSourcesTests Derive the .dynsym section offset and symbol entry size from the ELF section header in WriteTestJniLibrary (handling both Elf64_Sym and Elf32_Sym st_info offsets), and include a 32-bit ARM (AndroidTargetArch.Arm) JNI library in the test fixture. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
Code assessment: no blocking findings. 0 ❌ errors, 0
The task/helper relocation preserves the existing bootstrap construction, JNI symbol check, runtime-property parsing, and shared helper behavior. The new package-naming enum matches the original numeric values, the task registrations follow the existing Full/Core pattern, and the incremental input now tracks the relocated task assembly. The self-contained 32-/64-bit ELF fixtures are a useful improvement over depending on a prebuilt JNI test library.
dotnet-android check for Azure build 1650429. Direct Azure build/timeline verification could not be completed because the Azure CLI required authentication. No unconditional CI-green verdict is asserted.
Generated by Android PR Reviewer for #13199 · copilot · gpt61 · 52.1 AIC · ⌖ 7.25 AIC · ⊞ 19.3K
Comment /review to run again

Context: bf732908d0250966278042dc63a5f6f7ec2ca614
Context: 12c2d57
Context: 9e66448
Context: fa7d557
Context: a3c24de
Xamarin.Android.Build.Tasks.dlltargetsnetstandard2.0so that MSBuild tasks can load in both .NET Framework (MSBuild.exein Visual Studio) and .NET (dotnet build). Becausenetstandard2.0does not includeSystem.IO.Hashingin the shared framework, referencingSystem.IO.HashingfromXamarin.Android.Build.Tasks.csprojdeposits thenetstandard2.0flavor ofSystem.IO.Hashing.dll(whoseSpan<T>overloads bind toSystem.Memory) into the SDK'stools/directory. As noted in bf73290,net11.0tasks had to be placed intools/net/Microsoft.Android.Build.Tasks.dllso they would not resolve thenetstandard2.0System.IO.Hashing.dlland fail withMissingMethodException.After commits 9e66448 (#13197) and a3c24de (#13198) removed unused hashing helpers and moved
<CreateAssemblyStore/>toMicrosoft.Android.Build.Tasks.dll,<GenerateNativeApplicationConfigSources/>(viaCoreClrBootstrapBuilder) was the last remaining consumer ofSystem.IO.Hashing.Crc32inXamarin.Android.Build.Tasks.dll.Move
<GenerateNativeApplicationConfigSources/>and its supporting types fromsrc/Xamarin.Android.Build.Tasks(netstandard2.0) tosrc/Microsoft.Android.Build.Tasks(net11.0) soXamarin.Android.Build.Tasks.dllno longer needsSystem.IO.Hashing:GenerateNativeApplicationConfigSources,CoreClrBootstrapBuilder,RuntimePropertiesParser, andBundleConfigSplitConfigsCheckertosrc/Microsoft.Android.Build.Tasks/undernamespace Microsoft.Android.Tasks.CoreClrBootstrapBuilder.Write()directly viaSystem.IO.Hashing.Crc32.HashToUInt32(), and add an explicitSystem.IO.Hashing<PackageReference/>toMicrosoft.Android.Build.Tasks.csproj.CoreClrBootstrapBlob.csandEnvironmentBuilder.cssource links fromXamarin.Android.Build.Tasks.csproj, as all callers now reside inMicrosoft.Android.Build.Tasks.dll.MonoAndroidHelper.GetAssemblyCulture(),ParseAndroidRuntime(), andGetNormalizedNativeLibraryName()into the sharedMonoAndroidHelper.Assemblies.csfile (using.IsNullOrEmpty()so#nullable enablecompiles cleanly onnetstandard2.0as well asnet11.0), and moveELFHelper.IsJniLibrary()intoCoreClrBootstrapBuilderwhile removing unused symbol-lookup helpers fromELFHelper.PackageNamingPolicyinMicrosoft.Android.TaskssoMicrosoft.Android.Build.Tasks.csprojremains self-contained without referencingJava.Interop.Tools.TypeNameMappings.Xamarin.Android.Common.targetsto registerMicrosoft.Android.Tasks.GenerateNativeApplicationConfigSourcesfrom$(_MicrosoftAndroidBuildTasksAssembly)using the conditionalFull(TaskHostFactory) /CoreRuntime="NET"<UsingTask/>pattern from fa7d557 ([Microsoft.Android.Build.Tasks] Register all net11.0 tasks with conditional Runtime="NET" UsingTask #13195), and update$(_AndroidCoreClrBootstrapTaskAssembly)in the_AndroidGenerateCoreClrBootstrapInputstarget to track$(_MicrosoftAndroidBuildTasksAssembly).GenerateNativeApplicationConfigSourcesTests,RuntimePropertiesParserTests, andEnvironmentBuilderTeststoMicrosoft.Android.Build.Tasks.Tests, generating synthetic 32-bit (AndroidTargetArch.Arm) and 64-bit (AndroidTargetArch.Arm64) ELF JNI libraries viaAssemblyStoreElfWriterandELFReaderso the tests run standalone without requiring a native build oflibtest-jni-library.so.Validation
./dotnet-local.sh build build-tools/xa-prep-tasks/xa-prep-tasks.csproj— passed./dotnet-local.sh build src/Microsoft.Android.Build.Tasks/Microsoft.Android.Build.Tasks.csproj— passed./dotnet-local.sh build src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj -p:BuildProjectReferences=false -t:Compile— passed./dotnet-local.sh test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --filter "FullyQualifiedName~GenerateNativeApplicationConfigSourcesTests|FullyQualifiedName~RuntimePropertiesParserTests|FullyQualifiedName~EnvironmentBuilderTests|FullyQualifiedName~NativeAotBootstrapTargetsTests"— passed (28/28)Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: