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

Kotlin 1.8 and Anvil 2.4.4 support #568

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

rootProject.name = "buildSrc"
enableFeaturePreview("VERSION_CATALOGS")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version Catalogs were moved out of preview as part of Gradle 8.0

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

@Suppress("UnstableApiUsage")
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/CommonAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fun CommonExtension<*, *, *, *>.commonAndroid(target: Project) {

val publishedAsArtifact = target.extensions.findByName("com.vanniktech.maven.publish") != null

compileSdk = 32
compileSdk = 33

buildToolsVersion = "31.0.0"

Expand All @@ -35,8 +35,8 @@ fun CommonExtension<*, *, *, *>.commonAndroid(target: Project) {

// `targetSdk` doesn't have a single base interface, as of AGP 7.1.0
when (this@defaultConfig) {
is LibraryBaseFlavor -> targetSdk = 32
is ApplicationBaseFlavor -> targetSdk = 32
is LibraryBaseFlavor -> targetSdk = 33
is ApplicationBaseFlavor -> targetSdk = 33
}

vectorDrawables {
Expand Down
30 changes: 17 additions & 13 deletions buildSrc/src/main/kotlin/common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
import org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File

Expand All @@ -27,19 +28,22 @@ fun Project.common() {
tasks.withType<KotlinCompile>()
.configureEach {

kotlinOptions {
allWarningsAsErrors = false

jvmTarget = "1.8"

freeCompilerArgs = freeCompilerArgs + listOf(
"-Xjvm-default=all",
"-Xallow-result-return-type",
"-opt-in=kotlin.contracts.ExperimentalContracts",
"-opt-in=kotlin.Experimental",
"-opt-in=kotlin.time.ExperimentalTime",
"-opt-in=kotlin.RequiresOptIn",
"-Xinline-classes"
compilerOptions {
allWarningsAsErrors.set(false)

jvmTarget.set(JVM_1_8)

freeCompilerArgs.set(
freeCompilerArgs.get() + listOf(
"-Xjvm-default=all",
"-Xallow-result-return-type",
"-opt-in=kotlin.contracts.ExperimentalContracts",
"-opt-in=kotlin.Experimental",
"-opt-in=kotlin.time.ExperimentalTime",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After upgrading to Kotlin 1.8 I was getting a ton of ExperimentalCompilerApi so I added an opt in here.

"-Xinline-classes"
)
Comment on lines -30 to +46
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)
}
}
Expand Down
6 changes: 1 addition & 5 deletions buildSrc/src/main/kotlin/published.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.JavadocJar.Dokka
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost.DEFAULT
import com.vanniktech.maven.publish.SonatypeHost.Companion.DEFAULT
import com.vanniktech.maven.publish.tasks.JavadocJar
import com.vanniktech.maven.publish.tasks.SourcesJar
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import tangle.builds.GROUP
import tangle.builds.SOURCE_WEBSITE
Expand Down Expand Up @@ -126,9 +125,6 @@ tasks.withType(PublishToMavenRepository::class.java).configureEach {
tasks.withType(Jar::class.java).configureEach {
notCompatibleWithConfigurationCache("")
}
tasks.withType(SourcesJar::class.java).configureEach {
notCompatibleWithConfigurationCache("")
}
Comment on lines -129 to -131
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SourcesJar task was removed in the latest release based on the PR description there might be an equivalent task I could replace this with but I'm not entirely sure as I haven't worked with this plugin before.

tasks.withType(JavadocJar::class.java).configureEach {
notCompatibleWithConfigurationCache("")
}
Expand Down
28 changes: 15 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
androidTools = "7.2.2"
androidTools = "7.3.1"
benManes = "0.42.0"
changeTracker = "0.7.3"
coil = "2.2.0"
Expand All @@ -14,7 +14,7 @@ groovy = "3.0.12"
hermit = "0.9.6"
jUnit = "5.9.0"
kotest = "5.4.2"
kotlin = "1.7.0"
kotlin = "1.8.10"
ktlint-gradle = "11.0.0"

sonarPlugin = "2.6.1"
Expand All @@ -23,8 +23,10 @@ targetSdk = "30"
taskTree = "2.1.0"

androidx-activity = "1.5.1"
androidx-compose-runtime = "1.2.1"
androidx-compose-compiler = "1.2.0"
androidx-compose-foundation = "1.3.1"
androidx-compose-material = "1.3.1"
androidx-compose-runtime = "1.3.3"
androidx-compose-compiler = "1.4.2"
androidx-fragment-version = "1.5.2"
androidx-hilt = "1.0.0"
androidx-lifecycle = "2.5.1"
Expand All @@ -45,18 +47,18 @@ kotlinx-coroutines = "1.6.4"
kotlinx-knit = "0.4.0"

google-dagger = "2.43.2"
google-ksp = "1.7.0-1.0.6"
google-ksp = "1.8.10-1.0.9"
google-material = "1.6.1"

rickBusarow-dependencySync = "0.11.4"
rickBusarow-moduleCheck = "0.12.3"

square-anvil = "2.4.2"
square-anvil = "2.4.4"
square-moshi = "1.13.0"
square-okhttp = "4.10.0"
square-retrofit = "2.9.0"

vanniktech-publish = "0.21.0"
vanniktech-publish = "0.24.0"

zacSweers-moshix = "0.18.3"

Expand Down Expand Up @@ -94,11 +96,11 @@ androidx-arch-test-core = "androidx.arch.core:core-testing:2.1.0"

androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" }

androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-runtime" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-foundation" }

androidx-compose-material-core = { module = "androidx.compose.material:material", version.ref = "androidx-compose-runtime" }
androidx-compose-material-icons-core = { module = "androidx.compose.material:material-icons-core", version.ref = "androidx-compose-runtime" }
androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "androidx-compose-runtime" }
androidx-compose-material-core = { module = "androidx.compose.material:material", version.ref = "androidx-compose-material" }
androidx-compose-material-icons-core = { module = "androidx.compose.material:material-icons-core", version.ref = "androidx-compose-material" }
androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "androidx-compose-material" }

androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidx-compose-runtime" }

Expand Down Expand Up @@ -232,7 +234,7 @@ kotlin-gradle-pluginApi = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }

kotlin-compile-testing = "com.github.tschuchortdev:kotlin-compile-testing:1.4.9"
kotlin-compile-testing = "dev.zacsweers.kctfork:core:0.2.1"
Comment on lines -235 to +237
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

com.github.tschuchortdev:kotlin-compile-testing hasn't been updated to support Kotlin 1.8 so I swapped it out for a forked version that has Kotlin 1.8 support.


kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "kotlinx-atomicfu" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
Expand All @@ -257,7 +259,7 @@ rickBusarow-dispatch-test-jUnit4 = { module = "com.rickbusarow.dispatch:dispatch
rickBusarow-dispatch-test-jUnit5 = { module = "com.rickbusarow.dispatch:dispatch-test-junit5", version.ref = "dispatch" }
rickBusarow-dispatch-viewModel = { module = "com.rickbusarow.dispatch:dispatch-android-viewmodel", version.ref = "dispatch" }

robolectric = "org.robolectric:robolectric:4.8.2"
robolectric = "org.robolectric:robolectric:4.9.2"
Comment on lines -260 to +262
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed after upgrading the target/compile SDK to 33.


scabbard = "gradle.plugin.dev.arunkumar:scabbard-gradle-plugin:0.5.0"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Jan 29 19:04:46 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading