Skip to content

[Android] InvariantGlobalization support for CoreCLR Android builds #117542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

davidnguyen-tech
Copy link
Member

Description

Forward the InvariantGlobalization MSBuild property to the CoreCLR runtime for Android applications by connecting the existing infrastructure.

Related issues

Issue #117270

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables passing the InvariantGlobalization MSBuild property through the Android build pipeline so that Android apps can opt into invariant globalization mode at runtime.

  • Forwards the InvariantGlobalization property in test builds, Android build targets, and app tasks
  • Exposes a new InvariantGlobalization property on AndroidAppBuilderTask and propagates it into ApkBuilder
  • Removes the exclusion of the invariant globalization tests so they run against Android CoreCLR

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/tests/build.proj Adds InvariantGlobalization to the test project invocation parameters
src/tasks/AndroidAppBuilder/ApkBuilder.cs Injects DOTNET_SYSTEM_GLOBALIZATION_INVARIANT when InvariantGlobalization is true
src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs Declares InvariantGlobalization on the task and forwards it to ApkBuilder
src/mono/msbuild/android/build/AndroidBuild.targets Passes the MSBuild InvariantGlobalization property to the Android build targets
src/libraries/tests.proj Removes the exclusion for the invariant globalization tests
Comments suppressed due to low confidence (2)

src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs:149

  • There are no tests verifying that InvariantGlobalization flows through the task to the APK and sets the correct environment variable. Consider adding a unit or integration test to validate this behavior.
        apkBuilder.InvariantGlobalization = InvariantGlobalization;

src/tasks/AndroidAppBuilder/ApkBuilder.cs:427

  • The InvariantGlobalization property is referenced here but the ApkBuilder class does not define it. Add a public bool InvariantGlobalization { get; set; } property to ApkBuilder to ensure this compiles.
        if (InvariantGlobalization)

@davidnguyen-tech davidnguyen-tech changed the title [Android] Enable InvariantGlobalization support for Android builds [Android] Enable InvariantGlobalization support for CoreCLR Android builds Jul 11, 2025
@davidnguyen-tech davidnguyen-tech changed the title [Android] Enable InvariantGlobalization support for CoreCLR Android builds [Android] InvariantGlobalization support for CoreCLR Android builds Jul 11, 2025
@davidnguyen-tech
Copy link
Member Author

@dotnet-policy-service agree company="Microsoft"

Copy link
Contributor

Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

/// <summary>
/// Indicates whether we want to use invariant globalization mode.
/// </summary>
public bool InvariantGlobalization { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Just curious - why not pass this through EnvironmentVariables?
Personally, I probably like this solution a little better, but I don't have many arguments either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants