Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc44eb03 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Allow experimental Java target 21 by default" into main

parents 54082dd8 253f8c04
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -827,6 +827,10 @@ func (c *config) IsEnvFalse(key string) bool {
	return value == "0" || value == "n" || value == "no" || value == "off" || value == "false"
}

func (c *config) TargetsJava21() bool {
	return c.IsEnvTrue("EXPERIMENTAL_TARGET_JAVA_VERSION_21")
}

// EnvDeps returns the environment variables this build depends on. The first
// call to this function blocks future reads from the environment.
func (c *config) EnvDeps() map[string]string {
+6 −0
Original line number Diff line number Diff line
@@ -567,6 +567,12 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext an
		return normalizeJavaVersion(ctx, javaVersion)
	} else if ctx.Device() {
		return defaultJavaLanguageVersion(ctx, sdkContext.SdkVersion(ctx))
	} else if ctx.Config().TargetsJava21() {
		// Temporary experimental flag to be able to try and build with
		// java version 21 options.  The flag, if used, just sets Java
		// 21 as the default version, leaving any components that
		// target an older version intact.
		return JAVA_VERSION_21
	} else {
		return JAVA_VERSION_17
	}
+6 −0
Original line number Diff line number Diff line
@@ -65,6 +65,12 @@ func defaultJavaLanguageVersion(ctx android.EarlyModuleContext, s android.SdkSpe
		return JAVA_VERSION_9
	} else if sdk.FinalOrFutureInt() <= 33 {
		return JAVA_VERSION_11
	} else if ctx.Config().TargetsJava21() {
		// Temporary experimental flag to be able to try and build with
		// java version 21 options.  The flag, if used, just sets Java
		// 21 as the default version, leaving any components that
		// target an older version intact.
		return JAVA_VERSION_21
	} else {
		return JAVA_VERSION_17
	}