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.
Summary
The trimmable typemap generator handles runtime provider, application registration, and JCW Java source generation — replacing
GenerateAdditionalProviderSourcesfor 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 runtimeThese files are currently only generated by
GenerateAdditionalProviderSources(inTypeMap.LlvmIr.targets), which is not called from the trimmable path. Without them,NativeAotRuntimeProvider.javafails to compile because it referencesJavaInteropRuntimeandNativeAotEnvironmentVars.Proposed fix
Add
JavaInteropRuntime.javaandNativeAotEnvironmentVars.javageneration 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 fromGenerateAdditionalProviderSources.Context
This content was created with assistance from AI.