This target tries to use --add-modules and --add-exports to get access to internal classes from the jdk.compiler module. This works for Java code (unsupportedappusage-annotation-processor) but not for Kotlin code, as here. The kotlinc invocation fails. As a workaround for this issue, this change pins this to Java language level 8, so the JPMS doesn't apply. Test: EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true make staledataclass-annotation-processor Bug: 139342589 Change-Id: I5234bd3daf5f5347547ead50445ba989b38cbf6e
30 lines
929 B
Plaintext
30 lines
929 B
Plaintext
|
|
java_plugin {
|
|
name: "staledataclass-annotation-processor",
|
|
processor_class: "android.processor.staledataclass.StaleDataclassProcessor",
|
|
|
|
java_resources: [
|
|
"META-INF/**/*",
|
|
],
|
|
srcs: [
|
|
"src/**/*.java",
|
|
"src/**/*.kt",
|
|
],
|
|
static_libs: [
|
|
"codegen-version-info",
|
|
],
|
|
// The --add-modules/exports flags below don't work for kotlinc yet, so pin this module to Java language level 8 (see b/139342589):
|
|
java_version: "1.8",
|
|
openjdk9: {
|
|
javacflags: [
|
|
"--add-modules=jdk.compiler",
|
|
"--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
|
|
"--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
|
|
"--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
|
|
"--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
|
],
|
|
},
|
|
|
|
use_tools_jar: true,
|
|
}
|