Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Bug 1882134 - Use jvmToolchain for setting target JVM version
Browse files Browse the repository at this point in the history
  • Loading branch information
rvandermeulen authored and mergify[bot] committed Feb 27, 2024
1 parent 51ee7db commit bc9140a
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 55 deletions.
1 change: 1 addition & 0 deletions android-components/.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
componentsGroupId: "org.mozilla.components"

# Synchronized build configuration for all modules
jvmTargetCompatibility: 17
compileSdkVersion: 34
minSdkVersion: 21
targetSdkVersion: 34
10 changes: 4 additions & 6 deletions android-components/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ subprojects {
lintChecks project(':tooling-lint')
}

kotlin {
jvmToolchain(config.jvmTargetCompatibility)
}

android {
testOptions {
unitTests {
Expand All @@ -224,13 +228,7 @@ subprojects {
ignoreAssetsPattern "manifest.template.json"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
}
}
Expand Down
3 changes: 0 additions & 3 deletions android-components/components/tooling/detekt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'

targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17

dependencies {
implementation ComponentsDependencies.tools_detekt_api

Expand Down
7 changes: 0 additions & 7 deletions android-components/components/tooling/lint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply plugin: 'java-library'
apply plugin: 'kotlin'

targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17

dependencies {
compileOnly ComponentsDependencies.tools_lintapi
compileOnly ComponentsDependencies.tools_lintchecks
Expand Down Expand Up @@ -43,7 +40,3 @@ tasks.register("assembleAndroidTest") {
// behaves like our others and we do not need to special case it in automation.
}
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "17"
}
5 changes: 0 additions & 5 deletions fenix/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@ android {
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

bundle {
// Profiler issues require us to temporarily package native code compressed to
// match the previous APK packaging.
Expand Down
9 changes: 0 additions & 9 deletions fenix/benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ android {
namespace 'org.mozilla.fenix.benchmark'
compileSdk config.compileSdkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}

defaultConfig {
minSdk 23
targetSdk config.targetSdkVersion
Expand Down
10 changes: 2 additions & 8 deletions fenix/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ allprojects {
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "17"
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += [
"-opt-in=kotlin.RequiresOptIn", "-Xjvm-default=all-compatibility"
Expand All @@ -180,13 +179,8 @@ allprojects {

subprojects {
afterEvaluate {
if (it.hasProperty('android')) {
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
kotlin {
jvmToolchain(config.jvmTargetCompatibility)
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions fenix/mozilla-lint-rules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'

targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17

repositories {
if (project.hasProperty("centralRepo")) {
maven {
Expand Down
7 changes: 0 additions & 7 deletions focus-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ android {
vectorDrawables.useSupportLibrary = true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

lint {
lintConfig file("lint.xml")
}
Expand Down Expand Up @@ -167,7 +162,6 @@ android {
}
}


namespace 'org.mozilla.focus'
}

Expand All @@ -178,7 +172,6 @@ tasks.withType(KotlinCompile).configureEach {
"-opt-in=kotlin.RequiresOptIn",
"-Xjvm-default=all"
]
kotlinOptions.jvmTarget = '17'
}

// -------------------------------------------------------------------------------------------------
Expand Down
9 changes: 2 additions & 7 deletions focus-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,8 @@ allprojects {

subprojects {
afterEvaluate {
if (it.hasProperty('android')) {
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
kotlin {
jvmToolchain(config.jvmTargetCompatibility)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions shared-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@ class Config {

public final String componentsVersion
public final String componentsGroupId
public final Integer jvmTargetCompatibility
public final Integer compileSdkVersion
public final Integer minSdkVersion
public final Integer targetSdkVersion

Config(
String componentsVersion,
String componentsGroupId,
Integer jvmTargetCompatibility,
Integer compileSdkVersion,
Integer minSdkVersion,
Integer targetSdkVersion
) {
this.componentsVersion = componentsVersion
this.componentsGroupId = componentsGroupId
this.jvmTargetCompatibility = jvmTargetCompatibility
this.compileSdkVersion = compileSdkVersion
this.minSdkVersion = minSdkVersion
this.targetSdkVersion = targetSdkVersion
Expand Down Expand Up @@ -102,6 +105,7 @@ gradle.projectsLoaded { ->
gradle.rootProject.ext.config = new Config(
version,
configData.componentsGroupId,
configData.jvmTargetCompatibility,
configData.compileSdkVersion,
configData.minSdkVersion,
configData.targetSdkVersion
Expand Down

0 comments on commit bc9140a

Please sign in to comment.