Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert toolchain changes from #556 #563

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions build-logic/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
* License information is available from the LICENSE file.
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
}

group = "ch.srgssr.pillarbox.gradle"

kotlin {
jvmToolchain(17)
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.majorVersion
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
*/
package ch.srgssr.pillarbox.gradle.internal

import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

internal object AppConfig {
// When changing this value, don't forget to also update the Detekt config in the root `build.gradle.kts` file
private val javaVersionName = "17"

internal const val minSdk = 21
internal const val targetSdk = 34
internal const val compileSdk = 34

// When changing this value, don't forget to also update the Detekt config in the root `build.gradle.kts` file
internal val javaVersion = 17
internal val javaVersion = JavaVersion.valueOf("VERSION_$javaVersionName")
internal val jvmTarget = JvmTarget.fromTarget(javaVersionName)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

internal val Project.libs: VersionCatalog
get() = extensions.getByType<VersionCatalogsExtension>().named("libs")
Expand All @@ -25,6 +25,8 @@ internal fun Project.configureAndroidModule(extension: CommonExtension<*, *, *,
}

compileOptions {
sourceCompatibility = AppConfig.javaVersion
targetCompatibility = AppConfig.javaVersion
isCoreLibraryDesugaringEnabled = true
}

Expand All @@ -40,9 +42,9 @@ internal fun Project.configureAndroidModule(extension: CommonExtension<*, *, *,
}

internal fun Project.configureKotlinModule() {
extensions.configure<KotlinAndroidProjectExtension> {
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmToolchain(AppConfig.javaVersion)
jvmTarget.set(AppConfig.jvmTarget)
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ The latest stable version is [![Last release](https://img.shields.io/github/v/re
If not already enabled, you also need to turn on Java 17 support in every `build.gradle`/`build.gradle.kts` files using Pillarbox. To do so, add/update the following to/in the `android` section:

```kotlin
kotlin {
jvmToolchain(17)
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}
```

Expand All @@ -120,6 +125,8 @@ A change in AndroidX Media3 1.3.0 requires applications to use library desugarin

```kotlin
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

Expand Down
Loading