Skip to content

Commit

Permalink
Fix deprecations in build scripts (#1473)
Browse files Browse the repository at this point in the history
* Fix deprecation of project.buildDir

* Fix deprecation of kotlinOptions
  • Loading branch information
3flex authored Sep 1, 2024
1 parent 3301e84 commit e46dad2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
23 changes: 10 additions & 13 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.app)
Expand All @@ -18,6 +18,13 @@ detekt {
autoCorrect = true
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
optIn.add("kotlin.RequiresOptIn")
}
}

android {
namespace = "org.jellyfin.mobile"
compileSdk = 34
Expand Down Expand Up @@ -82,10 +89,6 @@ android {
viewBinding = true
compose = true
}
kotlinOptions {
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down Expand Up @@ -175,12 +178,6 @@ dependencies {
}

tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

withType<Detekt> {
jvmTarget = JavaVersion.VERSION_11.toString()

Expand All @@ -202,9 +199,9 @@ tasks {
}

register("versionTxt") {
val path = buildDir.resolve("version.txt")

doLast {
val path = layout.buildDirectory.file("version.txt").get().asFile

val versionString = "v${android.defaultConfig.versionName}=${android.defaultConfig.versionCode}"
println("Writing [$versionString] to $path")
path.writeText("$versionString\n")
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ allprojects {
}

tasks.create<Delete>("clean") {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}

0 comments on commit e46dad2

Please sign in to comment.