aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-04-27 00:49:03 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-04-27 01:34:35 +0530
commitca327555cd71ff85e465a97898f6e7fa034d5a45 (patch)
treef232f83e9b2966d4e85ae434ab1e0719e7672bcf
parentbf6fe08472112bf41796e5bed874119b14b54ecb (diff)
refactor(build): introduce a standalone plugin for Kotlin JVM libraries
-rw-r--r--build-logic/build.gradle.kts6
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt28
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt18
-rw-r--r--coroutine-utils-testing/build.gradle.kts3
-rw-r--r--coroutine-utils/build.gradle.kts3
-rw-r--r--crypto-common/build.gradle.kts3
-rw-r--r--crypto-pgpainless/build.gradle.kts3
-rw-r--r--format-common/build.gradle.kts3
-rw-r--r--passgen/random/build.gradle.kts3
-rw-r--r--sentry-stub/build.gradle.kts3
10 files changed, 38 insertions, 35 deletions
diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts
index 6efbd1e6..41ee7256 100644
--- a/build-logic/build.gradle.kts
+++ b/build-logic/build.gradle.kts
@@ -53,9 +53,9 @@ gradlePlugin {
id = "com.github.android-password-store.kotlin-kapt"
implementationClass = "app.passwordstore.gradle.KotlinKaptPlugin"
}
- register("kotlin-library") {
- id = "com.github.android-password-store.kotlin-library"
- implementationClass = "app.passwordstore.gradle.KotlinLibraryPlugin"
+ register("kotlin-jvm-library") {
+ id = "com.github.android-password-store.kotlin-jvm-library"
+ implementationClass = "app.passwordstore.gradle.KotlinJVMLibrary"
}
register("ktfmt") {
id = "com.github.android-password-store.ktfmt"
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt
new file mode 100644
index 00000000..253c7aed
--- /dev/null
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+package app.passwordstore.gradle
+
+import app.passwordstore.gradle.LintConfig.configureLint
+import com.android.build.api.dsl.Lint
+import com.android.build.gradle.LintPlugin
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.kotlin.dsl.apply
+import org.gradle.kotlin.dsl.configure
+import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
+
+@Suppress("Unused")
+class KotlinJVMLibrary : Plugin<Project> {
+
+ override fun apply(project: Project) {
+ project.pluginManager.run {
+ apply(KotlinPluginWrapper::class)
+ apply(LintPlugin::class)
+ apply(KotlinCommonPlugin::class)
+ }
+ project.extensions.configure<Lint> { configureLint(project) }
+ }
+}
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt
deleted file mode 100644
index e9c9d1d3..00000000
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-package app.passwordstore.gradle
-
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.kotlin.dsl.apply
-
-@Suppress("Unused")
-class KotlinLibraryPlugin : Plugin<Project> {
-
- override fun apply(project: Project) {
- project.pluginManager.apply(KotlinCommonPlugin::class)
- }
-}
diff --git a/coroutine-utils-testing/build.gradle.kts b/coroutine-utils-testing/build.gradle.kts
index 96d87dc1..49683422 100644
--- a/coroutine-utils-testing/build.gradle.kts
+++ b/coroutine-utils-testing/build.gradle.kts
@@ -3,8 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}
dependencies {
diff --git a/coroutine-utils/build.gradle.kts b/coroutine-utils/build.gradle.kts
index 78f1e8c2..a7074506 100644
--- a/coroutine-utils/build.gradle.kts
+++ b/coroutine-utils/build.gradle.kts
@@ -3,8 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}
dependencies {
diff --git a/crypto-common/build.gradle.kts b/crypto-common/build.gradle.kts
index b644cddd..c7651695 100644
--- a/crypto-common/build.gradle.kts
+++ b/crypto-common/build.gradle.kts
@@ -3,8 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}
dependencies { implementation(libs.thirdparty.kotlinResult) }
diff --git a/crypto-pgpainless/build.gradle.kts b/crypto-pgpainless/build.gradle.kts
index ba7dac75..7933bf2e 100644
--- a/crypto-pgpainless/build.gradle.kts
+++ b/crypto-pgpainless/build.gradle.kts
@@ -3,8 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}
dependencies {
diff --git a/format-common/build.gradle.kts b/format-common/build.gradle.kts
index f20c56b6..2571a5ac 100644
--- a/format-common/build.gradle.kts
+++ b/format-common/build.gradle.kts
@@ -3,8 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}
dependencies {
diff --git a/passgen/random/build.gradle.kts b/passgen/random/build.gradle.kts
index 0f48bceb..9e5770e6 100644
--- a/passgen/random/build.gradle.kts
+++ b/passgen/random/build.gradle.kts
@@ -3,6 +3,5 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}
diff --git a/sentry-stub/build.gradle.kts b/sentry-stub/build.gradle.kts
index 0f48bceb..9e5770e6 100644
--- a/sentry-stub/build.gradle.kts
+++ b/sentry-stub/build.gradle.kts
@@ -3,6 +3,5 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
- kotlin("jvm")
- id("com.github.android-password-store.kotlin-library")
+ id("com.github.android-password-store.kotlin-jvm-library")
}