refactor(build): remove kotlin-library
plugin from Android modules
This commit is contained in:
parent
7b5ded4064
commit
bf6fe08472
8 changed files with 9 additions and 16 deletions
|
@ -5,7 +5,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.android-password-store.published-android-library")
|
id("com.github.android-password-store.published-android-library")
|
||||||
id("com.github.android-password-store.kotlin-android")
|
id("com.github.android-password-store.kotlin-android")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
id("com.github.android-password-store.psl-plugin")
|
id("com.github.android-password-store.psl-plugin")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
class KotlinCommonPlugin : Plugin<Project> {
|
class KotlinCommonPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
|
val isAppModule = project.pluginManager.hasPlugin("com.android.application")
|
||||||
project.pluginManager.apply(DetektPlugin::class.java)
|
project.pluginManager.apply(DetektPlugin::class.java)
|
||||||
project.extensions.configure<DetektExtension> {
|
project.extensions.configure<DetektExtension> {
|
||||||
parallel = true
|
parallel = true
|
||||||
|
@ -44,12 +45,15 @@ class KotlinCommonPlugin : Plugin<Project> {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
targetCompatibility = JavaVersion.VERSION_11.toString()
|
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
}
|
}
|
||||||
withType<KotlinCompile>().configureEach {
|
withType<KotlinCompile>().configureEach task@{
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
jvmTarget.set(JvmTarget.JVM_11)
|
jvmTarget.set(JvmTarget.JVM_11)
|
||||||
allWarningsAsErrors.set(true)
|
allWarningsAsErrors.set(true)
|
||||||
languageVersion.set(KotlinVersion.KOTLIN_1_5)
|
languageVersion.set(KotlinVersion.KOTLIN_1_5)
|
||||||
freeCompilerArgs.addAll(ADDITIONAL_COMPILER_ARGS)
|
freeCompilerArgs.addAll(ADDITIONAL_COMPILER_ARGS)
|
||||||
|
if (!this@task.name.contains("test", ignoreCase = true) && !isAppModule) {
|
||||||
|
freeCompilerArgs.add("-Xexplicit-api=strict")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withType<Test>().configureEach {
|
withType<Test>().configureEach {
|
||||||
|
|
|
@ -8,20 +8,11 @@ package app.passwordstore.gradle
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.withType
|
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
@Suppress("Unused")
|
@Suppress("Unused")
|
||||||
class KotlinLibraryPlugin : Plugin<Project> {
|
class KotlinLibraryPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.pluginManager.apply(KotlinCommonPlugin::class)
|
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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ import org.gradle.kotlin.dsl.apply
|
||||||
class LibraryPlugin : Plugin<Project> {
|
class LibraryPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.pluginManager.apply(LibraryPlugin::class)
|
project.pluginManager.run {
|
||||||
|
apply(LibraryPlugin::class)
|
||||||
|
apply(KotlinCommonPlugin::class)
|
||||||
|
}
|
||||||
AndroidCommon.configure(project)
|
AndroidCommon.configure(project)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.android-password-store.published-android-library")
|
id("com.github.android-password-store.published-android-library")
|
||||||
id("com.github.android-password-store.kotlin-android")
|
id("com.github.android-password-store.kotlin-android")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.android-password-store.android-library")
|
id("com.github.android-password-store.android-library")
|
||||||
id("com.github.android-password-store.kotlin-android")
|
id("com.github.android-password-store.kotlin-android")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.android-password-store.android-library")
|
id("com.github.android-password-store.android-library")
|
||||||
id("com.github.android-password-store.kotlin-android")
|
id("com.github.android-password-store.kotlin-android")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.android-password-store.android-library")
|
id("com.github.android-password-store.android-library")
|
||||||
id("com.github.android-password-store.kotlin-android")
|
id("com.github.android-password-store.kotlin-android")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
Loading…
Reference in a new issue