refactor(build): introduce a standalone plugin for Kotlin JVM libraries
This commit is contained in:
parent
bf6fe08472
commit
ca327555cd
10 changed files with 38 additions and 35 deletions
|
@ -53,9 +53,9 @@ gradlePlugin {
|
||||||
id = "com.github.android-password-store.kotlin-kapt"
|
id = "com.github.android-password-store.kotlin-kapt"
|
||||||
implementationClass = "app.passwordstore.gradle.KotlinKaptPlugin"
|
implementationClass = "app.passwordstore.gradle.KotlinKaptPlugin"
|
||||||
}
|
}
|
||||||
register("kotlin-library") {
|
register("kotlin-jvm-library") {
|
||||||
id = "com.github.android-password-store.kotlin-library"
|
id = "com.github.android-password-store.kotlin-jvm-library"
|
||||||
implementationClass = "app.passwordstore.gradle.KotlinLibraryPlugin"
|
implementationClass = "app.passwordstore.gradle.KotlinJVMLibrary"
|
||||||
}
|
}
|
||||||
register("ktfmt") {
|
register("ktfmt") {
|
||||||
id = "com.github.android-password-store.ktfmt"
|
id = "com.github.android-password-store.ktfmt"
|
||||||
|
|
|
@ -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) }
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,8 +3,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies { implementation(libs.thirdparty.kotlinResult) }
|
dependencies { implementation(libs.thirdparty.kotlinResult) }
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -3,6 +3,5 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,5 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
id("com.github.android-password-store.kotlin-jvm-library")
|
||||||
id("com.github.android-password-store.kotlin-library")
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue