aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-04-27 00:40:40 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-04-27 01:34:35 +0530
commitbf6fe08472112bf41796e5bed874119b14b54ecb (patch)
tree25161eb86f81fb35e46a742593336b05d979c222
parent7b5ded406489a8ee078acdb7dcd4afafe4f96f8b (diff)
refactor(build): remove `kotlin-library` plugin from Android modules
-rw-r--r--autofill-parser/build.gradle.kts1
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt6
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt9
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/LibraryPlugin.kt5
-rw-r--r--openpgp-ktx/build.gradle.kts1
-rw-r--r--passgen/diceware/build.gradle.kts1
-rw-r--r--ssh/build.gradle.kts1
-rw-r--r--ui-compose/build.gradle.kts1
8 files changed, 9 insertions, 16 deletions
diff --git a/autofill-parser/build.gradle.kts b/autofill-parser/build.gradle.kts
index 6f4d5909..fa67cf7e 100644
--- a/autofill-parser/build.gradle.kts
+++ b/autofill-parser/build.gradle.kts
@@ -5,7 +5,6 @@
plugins {
id("com.github.android-password-store.published-android-library")
id("com.github.android-password-store.kotlin-android")
- id("com.github.android-password-store.kotlin-library")
id("com.github.android-password-store.psl-plugin")
}
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt
index 067cadfc..6d43a494 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
class KotlinCommonPlugin : Plugin<Project> {
override fun apply(project: Project) {
+ val isAppModule = project.pluginManager.hasPlugin("com.android.application")
project.pluginManager.apply(DetektPlugin::class.java)
project.extensions.configure<DetektExtension> {
parallel = true
@@ -44,12 +45,15 @@ class KotlinCommonPlugin : Plugin<Project> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}
- withType<KotlinCompile>().configureEach {
+ withType<KotlinCompile>().configureEach task@{
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
allWarningsAsErrors.set(true)
languageVersion.set(KotlinVersion.KOTLIN_1_5)
freeCompilerArgs.addAll(ADDITIONAL_COMPILER_ARGS)
+ if (!this@task.name.contains("test", ignoreCase = true) && !isAppModule) {
+ freeCompilerArgs.add("-Xexplicit-api=strict")
+ }
}
}
withType<Test>().configureEach {
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt
index e85d5c21..e9c9d1d3 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt
@@ -8,20 +8,11 @@ package app.passwordstore.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
-import org.gradle.kotlin.dsl.withType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@Suppress("Unused")
class KotlinLibraryPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.pluginManager.apply(KotlinCommonPlugin::class)
- project.tasks.withType<KotlinCompile>().configureEach task@{
- compilerOptions {
- if (!this@task.name.contains("test", ignoreCase = true)) {
- freeCompilerArgs.add("-Xexplicit-api=strict")
- }
- }
- }
}
}
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/LibraryPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/LibraryPlugin.kt
index 22cc8ca3..c607f6da 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/LibraryPlugin.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/LibraryPlugin.kt
@@ -9,7 +9,10 @@ import org.gradle.kotlin.dsl.apply
class LibraryPlugin : Plugin<Project> {
override fun apply(project: Project) {
- project.pluginManager.apply(LibraryPlugin::class)
+ project.pluginManager.run {
+ apply(LibraryPlugin::class)
+ apply(KotlinCommonPlugin::class)
+ }
AndroidCommon.configure(project)
}
}
diff --git a/openpgp-ktx/build.gradle.kts b/openpgp-ktx/build.gradle.kts
index e9b574ef..b16a1d03 100644
--- a/openpgp-ktx/build.gradle.kts
+++ b/openpgp-ktx/build.gradle.kts
@@ -5,7 +5,6 @@
plugins {
id("com.github.android-password-store.published-android-library")
id("com.github.android-password-store.kotlin-android")
- id("com.github.android-password-store.kotlin-library")
}
android {
diff --git a/passgen/diceware/build.gradle.kts b/passgen/diceware/build.gradle.kts
index 81db24cc..01441525 100644
--- a/passgen/diceware/build.gradle.kts
+++ b/passgen/diceware/build.gradle.kts
@@ -5,7 +5,6 @@
plugins {
id("com.github.android-password-store.android-library")
id("com.github.android-password-store.kotlin-android")
- id("com.github.android-password-store.kotlin-library")
}
android {
diff --git a/ssh/build.gradle.kts b/ssh/build.gradle.kts
index 80e6f58c..ccda4a16 100644
--- a/ssh/build.gradle.kts
+++ b/ssh/build.gradle.kts
@@ -7,7 +7,6 @@
plugins {
id("com.github.android-password-store.android-library")
id("com.github.android-password-store.kotlin-android")
- id("com.github.android-password-store.kotlin-library")
}
android {
diff --git a/ui-compose/build.gradle.kts b/ui-compose/build.gradle.kts
index e8abfeb8..711ffa52 100644
--- a/ui-compose/build.gradle.kts
+++ b/ui-compose/build.gradle.kts
@@ -5,7 +5,6 @@
plugins {
id("com.github.android-password-store.android-library")
id("com.github.android-password-store.kotlin-android")
- id("com.github.android-password-store.kotlin-library")
}
android {