Skip to content

[TrimmableTypeMap] Generate NativeAOT bootstrap Java sources in trimmable path #11210

@sbomer

Description

@sbomer

Summary

The trimmable typemap generator handles runtime provider, application registration, and JCW Java source generation — replacing GenerateAdditionalProviderSources for the CoreCLR path. However, it does not generate the two NativeAOT-specific bootstrap Java files:

  • JavaInteropRuntime.java — .NET runtime initialization entry point (template with @MAIN_ASSEMBLY_NAME@)
  • NativeAotEnvironmentVars.java — baked-in environment variable names/values for the native runtime

These files are currently only generated by GenerateAdditionalProviderSources (in TypeMap.LlvmIr.targets), which is not called from the trimmable path. Without them, NativeAotRuntimeProvider.java fails to compile because it references JavaInteropRuntime and NativeAotEnvironmentVars.

Proposed fix

Add JavaInteropRuntime.java and NativeAotEnvironmentVars.java generation to the trimmable typemap generator, conditioned on _AndroidRuntime == NativeAOT. This is consistent with the existing pattern where the trimmable generator took over the CoreCLR pieces from GenerateAdditionalProviderSources.

Context

This content was created with assistance from AI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions