Initial support for converting jars to java9 system modules

Adds a java_system_modules module type that (when
EXPERIMENTAL_USE_OPENJDK9 is set to true) converts a list of
java library modules and prebuilt jars into system modules,
and plumbs the system modules through to the javac command
line.

Also exports the location of the system modules to make
variables, as well as the name of the default system module.

Test: TestClasspath in java_test.go, runs automatically as part of the build
Bug: 63986449
Change-Id: I27bd5d2010092422a27b69c91568e49010e02f40
This commit is contained in:
Colin Cross
2017-09-29 17:58:17 -07:00
parent 070879e69e
commit 1369cdb280
9 changed files with 421 additions and 69 deletions

View File

@@ -27,8 +27,13 @@ func init() {
func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("TARGET_DEFAULT_JAVA_LIBRARIES", strings.Join(DefaultLibraries, " "))
ctx.Strict("TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES", strings.Join(DefaultBootclasspathLibraries, " "))
ctx.Strict("DEFAULT_SYSTEM_MODULES", DefaultSystemModules)
ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "${DefaultJavaVersion}")
if ctx.Config().TargetOpenJDK9() {
ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "1.9")
} else {
ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "1.8")
}
ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}")
ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}")
@@ -47,7 +52,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("HOST_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
}
if ctx.Config().IsEnvTrue("EXPERIMENTAL_USE_OPENJDK9") {
if ctx.Config().UseOpenJDK9() {
ctx.Strict("JLINK", "${JlinkCmd}")
ctx.Strict("JMOD", "${JmodCmd}")
}