You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TrimmableTypeMap] Generate ProGuard for types in type map #10790
Once the list of types that survived trimming is known, we can generate ProGuard rules to specify which ACW/JCW Java classes we want to keep via the -keep class jni.class.Name { *; } rules.
The build task needs to run after ILLink or ILC and before we run Java trimming (r8).
This task should run incrementally only when ILLink or ILC produce different typemap.
This task should not run in Debug at all.
Getting the list of types that are in the typemap might not be trivial at the moment:
CoreCLR: we can scan the trimmed type map assembly and see which attributes were kept
Native AOT needs to give us the list of types it kept in the typemap: TypeMap API: For trimmed and nativeaot builds, provide a list of the types kept by the typemap runtime#120204. As a workaround, we can opt into ILC's existing diagnostic outputs ($(IlcGenerateMetadataLog) or $(IlcGenerateDgmlFile)) but these artifacts are quite large and writing them to disk, reading them from disk, and scanning them will add non-trivial time to the overall build.
Ideally, ILLink and ILC will produce some form of list of types which are included in the typemap, which would allow us to implement a unified build task to generate the proguard rules.
Implemented by #12822, #12824, #12825, #12827, and #12829. These PRs add shared ProGuard rule generators, extract retained typemap keys for CoreCLR and NativeAOT, wire the incremental MSBuild pipeline, and activate generated R8 keep rules for eligible builds. This fulfills the request to generate ProGuard rules from types that survive trimming; closing as implemented.
Activity
[-][TrimmableTypeMap][/-][+][TrimmableTypeMap] Generate ProGuard for types in type map[/+][TrimmableTypeMap] Generate NativeAOT ProGuard rules from DGML (#11449)
[TrimmableTypeMap][NativeAOT] Build plumbing fixes (#11989)
simonrozsival commentedon Oct 10, 2026
Implemented by #12822, #12824, #12825, #12827, and #12829. These PRs add shared ProGuard rule generators, extract retained typemap keys for CoreCLR and NativeAOT, wire the incremental MSBuild pipeline, and activate generated R8 keep rules for eligible builds. This fulfills the request to generate ProGuard rules from types that survive trimming; closing as implemented.