Specify JDK toolchain directly

Specifying JDK toolchain in the java block lets us avoid specifying
same version again and again for different options while ensuring everything
is on the same version

Ref: https://developer.android.com/build/jdks#toolchain

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2025-10-17 16:25:51 +08:00
parent 3784dbd4ca
commit fef0e02a4d

View file

@ -18,6 +18,12 @@ val gitWorkingBranch = providers.exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
}.standardOutput.asText.map { it.trim() }
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
android {
compileSdk = 36
namespace = "org.schabi.newpipe"
@ -87,16 +93,9 @@ android {
compileOptions {
// Flag to enable support for the new language APIs
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
encoding = "utf-8"
}
kotlinOptions {
jvmTarget = "17"
}
sourceSets {
getByName("androidTest") {
assets.srcDir("$projectDir/schemas")