aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/app
diff options
context:
space:
mode:
Diffstat (limited to 'build-logic/src/main/kotlin/app')
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt12
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt16
2 files changed, 10 insertions, 18 deletions
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt
index c1311f41..7157d3ae 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt
@@ -5,12 +5,11 @@ import app.passwordstore.gradle.flavors.configureSlimTests
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.LibraryExtension
import com.android.build.gradle.TestedExtension
+import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
-import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.findByType
-import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
object AndroidCommon {
@@ -47,11 +46,10 @@ object AndroidCommon {
}
project.extensions.findByType<ApplicationExtension>()?.run { lint.configureLint(project) }
project.extensions.findByType<LibraryExtension>()?.run { lint.configureLint(project) }
- val lintDepKeys = listOf("thirdparty-compose-lints", "thirdparty-slack-lints")
- val catalog = project.extensions.getByType<VersionCatalogsExtension>()
- val libs = catalog.named("libs")
- lintDepKeys.forEach { key ->
- project.dependencies.addProvider("lintChecks", libs.findLibrary(key).get())
+ val libs = project.extensions.getByName("libs") as LibrariesForLibs
+ project.dependencies.apply {
+ addProvider("lintChecks", libs.thirdparty.compose.lints)
+ addProvider("lintChecks", libs.thirdparty.slack.lints)
}
}
}
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt
index a80a5807..ead89705 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt
@@ -6,11 +6,9 @@
package app.passwordstore.gradle
import app.passwordstore.gradle.KotlinCommonPlugin.Companion.JVM_TOOLCHAIN_ACTION
+import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Plugin
import org.gradle.api.Project
-import org.gradle.api.artifacts.VersionCatalog
-import org.gradle.api.artifacts.VersionCatalogsExtension
-import org.gradle.api.artifacts.VersionConstraint
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
@@ -27,10 +25,9 @@ class KotlinAndroidPlugin : Plugin<Project> {
apply(KotlinCommonPlugin::class)
}
project.extensions.getByType<KotlinProjectExtension>().jvmToolchain(JVM_TOOLCHAIN_ACTION)
- val catalog = project.extensions.getByType<VersionCatalogsExtension>()
- val libs = catalog.named("libs")
- val composeCompilerVersion = libs.getVersion("composeCompiler")
- val kotlinVersion = libs.getVersion("kotlin")
+ val libs = project.extensions.getByName("libs") as LibrariesForLibs
+ val composeCompilerVersion = libs.versions.composeCompiler.get()
+ val kotlinVersion = libs.versions.kotlin.get()
val matches = COMPOSE_COMPILER_VERSION_REGEX.find(composeCompilerVersion)
if (matches != null) {
@@ -46,11 +43,8 @@ class KotlinAndroidPlugin : Plugin<Project> {
}
}
- private fun VersionCatalog.getVersion(key: String) =
- findVersion(key).map(VersionConstraint::toString).get()
-
private companion object {
// Matches against 1.5.0-dev-k1.9.0-6a60475e07f
- val COMPOSE_COMPILER_VERSION_REGEX = "\\d.\\d.\\d-dev-k(\\d.\\d.\\d)-[a-z0-9]+".toRegex()
+ val COMPOSE_COMPILER_VERSION_REGEX = "\\d.\\d.\\d-dev-k(\\d.\\d.\\d+)-[a-z0-9]+".toRegex()
}
}