diff options
author | Colin Cross <ccross@android.com> | 2017-09-29 17:58:17 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-10-16 15:00:02 -0700 |
commit | 1369cdb28013ece5eecf51dc9facc822ea9222b3 (patch) | |
tree | 7f1c21ddd0440c663f2d665efd9bef915be7c801 /java/config/config.go | |
parent | 070879e69eec3647424169767790993330222430 (diff) | |
download | build_soong-1369cdb28013ece5eecf51dc9facc822ea9222b3.tar.gz build_soong-1369cdb28013ece5eecf51dc9facc822ea9222b3.tar.bz2 build_soong-1369cdb28013ece5eecf51dc9facc822ea9222b3.zip |
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
Diffstat (limited to 'java/config/config.go')
-rw-r--r-- | java/config/config.go | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/java/config/config.go b/java/config/config.go index 70b8fe52..7d1fa29b 100644 --- a/java/config/config.go +++ b/java/config/config.go @@ -27,6 +27,7 @@ var ( pctx = android.NewPackageContext("android/soong/java/config") DefaultBootclasspathLibraries = []string{"core-oj", "core-libart"} + DefaultSystemModules = "core-system-modules" DefaultLibraries = []string{"ext", "framework", "okhttp"} ) @@ -47,9 +48,10 @@ func init() { // If a different javac is used the flag will be ignored and extra bridges will be inserted. // The flag is implemented by https://android-review.googlesource.com/c/486427 `-XDskipDuplicateBridges=true`, - }, " ")) - pctx.StaticVariable("DefaultJavaVersion", "1.8") + // b/65004097: prevent using java.lang.invoke.StringConcatFactory when using -target 1.9 + `-XDstringConcat=inline`, + }, " ")) pctx.VariableConfigMethod("hostPrebuiltTag", android.Config.PrebuiltOS) @@ -57,7 +59,7 @@ func init() { if override := config.(android.Config).Getenv("OVERRIDE_ANDROID_JAVA_HOME"); override != "" { return override, nil } - if jdk9 := config.(android.Config).Getenv("EXPERIMENTAL_USE_OPENJDK9"); jdk9 != "" { + if config.(android.Config).UseOpenJDK9() { return "prebuilts/jdk/jdk9/${hostPrebuiltTag}", nil } return "prebuilts/jdk/jdk8/${hostPrebuiltTag}", nil @@ -71,6 +73,7 @@ func init() { pctx.SourcePathVariable("JavadocCmd", "${JavaToolchain}/javadoc") pctx.SourcePathVariable("JlinkCmd", "${JavaToolchain}/jlink") pctx.SourcePathVariable("JmodCmd", "${JavaToolchain}/jmod") + pctx.SourcePathVariable("JrtFsJar", "${JavaHome}/lib/jrt-fs.jar") pctx.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh") pctx.StaticVariable("SoongZipCmd", filepath.Join("${bootstrap.ToolDir}", "soong_zip")) @@ -86,17 +89,3 @@ func init() { return "", nil }) } - -func StripJavac9Flags(flags []string) []string { - var ret []string - for _, f := range flags { - switch { - case strings.HasPrefix(f, "-J--add-modules="): - // drop - default: - ret = append(ret, f) - } - } - - return ret -} |