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

Commit b0353ed3 authored by Cole Faust's avatar Cole Faust Committed by Gerrit Code Review
Browse files

Merge "Use the current java version for -jvm-target"

parents b43ae1ee d96eebf3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -513,6 +513,20 @@ func (v javaVersion) String() string {
	}
}

func (v javaVersion) StringForKotlinc() string {
	// $ ./external/kotlinc/bin/kotlinc -jvm-target foo
	// error: unknown JVM target version: foo
	// Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17
	switch v {
	case JAVA_VERSION_7:
		return "1.6"
	case JAVA_VERSION_9:
		return "9"
	default:
		return v.String()
	}
}

// Returns true if javac targeting this version uses system modules instead of a bootclasspath.
func (v javaVersion) usesJavaModules() bool {
	return v >= 9
+2 −3
Original line number Diff line number Diff line
@@ -119,8 +119,7 @@ func kotlinCompile(ctx android.ModuleContext, outputFile, headerOutputFile andro
			"srcJarDir":         android.PathForModuleOut(ctx, "kotlinc", "srcJars").String(),
			"kotlinBuildFile":   android.PathForModuleOut(ctx, "kotlinc-build.xml").String(),
			"emptyDir":          android.PathForModuleOut(ctx, "kotlinc", "empty").String(),
			// http://b/69160377 kotlinc only supports -jvm-target 1.6 and 1.8
			"kotlinJvmTarget": "1.8",
			"kotlinJvmTarget":   flags.javaVersion.StringForKotlinc(),
			"name":              kotlinName,
		},
	})