Always use OpenJDK9 for building
Remove support for compiling with javac from OpenJDK8. We still target 1.8 by default, and OpenJDK8 prebuilts are still required for the bootclasspath and running robolectric. Bug: 38418220 Test: m java Change-Id: I5686deb0ae4f9927192a039d08adc0117b2605dd
This commit is contained in:
@@ -108,8 +108,7 @@ type config struct {
|
|||||||
captureBuild bool // true for tests, saves build parameters for each module
|
captureBuild bool // true for tests, saves build parameters for each module
|
||||||
ignoreEnvironment bool // true for tests, returns empty from all Getenv calls
|
ignoreEnvironment bool // true for tests, returns empty from all Getenv calls
|
||||||
|
|
||||||
useOpenJDK9 bool // Use OpenJDK9, but possibly target 1.8
|
targetOpenJDK9 bool // Target 1.9
|
||||||
targetOpenJDK9 bool // Use OpenJDK9 and target 1.9
|
|
||||||
|
|
||||||
stopBefore bootstrap.StopBefore
|
stopBefore bootstrap.StopBefore
|
||||||
|
|
||||||
@@ -321,20 +320,13 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
|
|||||||
|
|
||||||
func (c *config) fromEnv() error {
|
func (c *config) fromEnv() error {
|
||||||
switch c.Getenv("EXPERIMENTAL_USE_OPENJDK9") {
|
switch c.Getenv("EXPERIMENTAL_USE_OPENJDK9") {
|
||||||
case "":
|
case "", "1.8":
|
||||||
// Use OpenJDK9, but target 1.8
|
// Nothing, we always use OpenJDK9
|
||||||
c.useOpenJDK9 = true
|
|
||||||
case "false":
|
|
||||||
// Use OpenJDK8
|
|
||||||
case "1.8":
|
|
||||||
// Use OpenJDK9, but target 1.8
|
|
||||||
c.useOpenJDK9 = true
|
|
||||||
case "true":
|
case "true":
|
||||||
// Use OpenJDK9 and target 1.9
|
// Use OpenJDK9 and target 1.9
|
||||||
c.useOpenJDK9 = true
|
|
||||||
c.targetOpenJDK9 = true
|
c.targetOpenJDK9 = true
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "false", "1.8", or "true"`)
|
return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "1.8", or "true"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -633,11 +625,6 @@ func (c *config) RunErrorProne() bool {
|
|||||||
return c.IsEnvTrue("RUN_ERROR_PRONE")
|
return c.IsEnvTrue("RUN_ERROR_PRONE")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if OpenJDK9 prebuilts are being used
|
|
||||||
func (c *config) UseOpenJDK9() bool {
|
|
||||||
return c.useOpenJDK9
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if -source 1.9 -target 1.9 is being passed to javac
|
// Returns true if -source 1.9 -target 1.9 is being passed to javac
|
||||||
func (c *config) TargetOpenJDK9() bool {
|
func (c *config) TargetOpenJDK9() bool {
|
||||||
return c.targetOpenJDK9
|
return c.targetOpenJDK9
|
||||||
|
@@ -61,10 +61,8 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||||||
ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
|
ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
|
||||||
ctx.Strict("HOST_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
|
ctx.Strict("HOST_JAVAC", "${JavacCmd} ${CommonJdkFlags}")
|
||||||
|
|
||||||
if ctx.Config().UseOpenJDK9() {
|
ctx.Strict("JLINK", "${JlinkCmd}")
|
||||||
ctx.Strict("JLINK", "${JlinkCmd}")
|
ctx.Strict("JMOD", "${JmodCmd}")
|
||||||
ctx.Strict("JMOD", "${JmodCmd}")
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
|
ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
|
||||||
ctx.Strict("ZIPSYNC", "${ZipSyncCmd}")
|
ctx.Strict("ZIPSYNC", "${ZipSyncCmd}")
|
||||||
|
@@ -540,20 +540,13 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
var bootClasspathArgs, classpathArgs string
|
var bootClasspathArgs, classpathArgs string
|
||||||
|
|
||||||
javaVersion := getJavaVersion(ctx, String(j.properties.Java_version), String(j.properties.Sdk_version))
|
javaVersion := getJavaVersion(ctx, String(j.properties.Java_version), String(j.properties.Sdk_version))
|
||||||
if javaVersion == "1.9" || ctx.Config().UseOpenJDK9() {
|
if len(deps.bootClasspath) > 0 {
|
||||||
if len(deps.bootClasspath) > 0 {
|
var systemModules classpath
|
||||||
var systemModules classpath
|
if deps.systemModules != nil {
|
||||||
if deps.systemModules != nil {
|
systemModules = append(systemModules, deps.systemModules)
|
||||||
systemModules = append(systemModules, deps.systemModules)
|
|
||||||
}
|
|
||||||
bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
|
|
||||||
bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if len(deps.bootClasspath.Strings()) > 0 {
|
|
||||||
// For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
|
|
||||||
bootClasspathArgs = deps.bootClasspath.FormJavaClassPath("-bootclasspath")
|
|
||||||
}
|
}
|
||||||
|
bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
|
||||||
|
bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
|
||||||
}
|
}
|
||||||
if len(deps.classpath.Strings()) > 0 {
|
if len(deps.classpath.Strings()) > 0 {
|
||||||
classpathArgs = "-classpath " + strings.Join(deps.classpath.Strings(), ":")
|
classpathArgs = "-classpath " + strings.Join(deps.classpath.Strings(), ":")
|
||||||
|
@@ -164,11 +164,7 @@ func NewConfig(ctx Context, args ...string) Config {
|
|||||||
if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
|
if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
|
||||||
return override
|
return override
|
||||||
}
|
}
|
||||||
v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9")
|
return java9Home
|
||||||
if !ok || v != "false" {
|
|
||||||
return java9Home
|
|
||||||
}
|
|
||||||
return java8Home
|
|
||||||
}()
|
}()
|
||||||
absJavaHome := absPath(ctx, javaHome)
|
absJavaHome := absPath(ctx, javaHome)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user