From 549ee790d3e52bc62565ddf92e6a556e98b5195e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 15 Jul 2022 00:53:48 +0530 Subject: all: re-do package structure yet again --- .../gradle/BinaryCompatibilityPlugin.kt | 34 +++++++++++++ .../gradle/DependencyUpdatesPlugin.kt | 33 +++++++++++++ .../passwordstore/gradle/KotlinAndroidPlugin.kt | 22 +++++++++ .../app/passwordstore/gradle/KotlinCommonPlugin.kt | 50 ++++++++++++++++++++ .../app/passwordstore/gradle/KotlinKaptPlugin.kt | 55 ++++++++++++++++++++++ .../passwordstore/gradle/KotlinLibraryPlugin.kt | 27 +++++++++++ .../app/passwordstore/gradle/SpotlessPlugin.kt | 44 +++++++++++++++++ .../aps/gradle/BinaryCompatibilityPlugin.kt | 34 ------------- .../aps/gradle/DependencyUpdatesPlugin.kt | 33 ------------- .../msfjarvis/aps/gradle/KotlinAndroidPlugin.kt | 22 --------- .../dev/msfjarvis/aps/gradle/KotlinCommonPlugin.kt | 50 -------------------- .../dev/msfjarvis/aps/gradle/KotlinKaptPlugin.kt | 55 ---------------------- .../msfjarvis/aps/gradle/KotlinLibraryPlugin.kt | 27 ----------- .../dev/msfjarvis/aps/gradle/SpotlessPlugin.kt | 44 ----------------- 14 files changed, 265 insertions(+), 265 deletions(-) create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinKaptPlugin.kt create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/BinaryCompatibilityPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinAndroidPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinCommonPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinKaptPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinLibraryPlugin.kt delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/SpotlessPlugin.kt (limited to 'build-logic/kotlin-plugins/src') diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt new file mode 100644 index 00000000..a64d8fb3 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt @@ -0,0 +1,34 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +package app.passwordstore.gradle + +import kotlinx.validation.ApiValidationExtension +import kotlinx.validation.BinaryCompatibilityValidatorPlugin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.getByType + +@Suppress("Unused") +class BinaryCompatibilityPlugin : Plugin { + + override fun apply(project: Project) { + project.pluginManager.apply(BinaryCompatibilityValidatorPlugin::class) + project.extensions.getByType().ignoredProjects = + mutableSetOf( + "app", + "coroutine-utils", + "coroutine-utils-testing", + "crypto-common", + "crypto-pgpainless", + "format-common", + "diceware", + "random", + "sentry-stub", + "ui-compose", + ) + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt new file mode 100644 index 00000000..6dff57a1 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/DependencyUpdatesPlugin.kt @@ -0,0 +1,33 @@ +package app.passwordstore.gradle + +import com.github.benmanes.gradle.versions.VersionsPlugin +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask +import nl.littlerobots.vcu.plugin.VersionCatalogUpdateExtension +import nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.getByType +import org.gradle.kotlin.dsl.withType + +@Suppress("Unused") +class DependencyUpdatesPlugin : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(VersionsPlugin::class) + project.pluginManager.apply(VersionCatalogUpdatePlugin::class) + project.tasks.withType().configureEach { + rejectVersionIf { + when (candidate.group) { + "commons-codec", + "com.android.tools.build", + "org.eclipse.jgit" -> true + else -> false + } + } + checkForGradleUpdate = false + } + project.extensions.getByType().run { + keep.keepUnusedLibraries.set(true) + } + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt new file mode 100644 index 00000000..49f207a1 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt @@ -0,0 +1,22 @@ +/* + * 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 +import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper + +@Suppress("Unused") +class KotlinAndroidPlugin : Plugin { + + override fun apply(project: Project) { + project.pluginManager.run { + apply(KotlinAndroidPluginWrapper::class) + apply(KotlinCommonPlugin::class) + } + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt new file mode 100644 index 00000000..50d67e52 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt @@ -0,0 +1,50 @@ +/* + * 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.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.testing.Test +import org.gradle.api.tasks.testing.logging.TestLogEvent +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +@Suppress("Unused") +class KotlinCommonPlugin : Plugin { + + override fun apply(project: Project) { + project.tasks.run { + withType().configureEach { + sourceCompatibility = JavaVersion.VERSION_11.toString() + targetCompatibility = JavaVersion.VERSION_11.toString() + } + withType().configureEach { + kotlinOptions { + allWarningsAsErrors = true + jvmTarget = JavaVersion.VERSION_11.toString() + freeCompilerArgs = freeCompilerArgs + ADDITIONAL_COMPILER_ARGS + languageVersion = "1.5" + } + } + withType().configureEach { + maxParallelForks = Runtime.getRuntime().availableProcessors() * 2 + testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) } + doNotTrackState("We want tests to always run even if Gradle thinks otherwise") + } + } + } + + private companion object { + private val ADDITIONAL_COMPILER_ARGS = + listOf( + "-opt-in=kotlin.RequiresOptIn", + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true", + ) + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinKaptPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinKaptPlugin.kt new file mode 100644 index 00000000..a798ec8e --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinKaptPlugin.kt @@ -0,0 +1,55 @@ +/* + * 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 +import org.gradle.kotlin.dsl.getByType +import org.jetbrains.kotlin.gradle.internal.Kapt3GradleSubplugin +import org.jetbrains.kotlin.gradle.plugin.KaptExtension +import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper + +@Suppress("Unused") +class KotlinKaptPlugin : Plugin { + + override fun apply(project: Project) { + project.pluginManager.run { + apply(KotlinAndroidPluginWrapper::class) + apply(Kapt3GradleSubplugin::class) + } + project.afterEvaluate { + project.extensions.getByType().run { + javacOptions { + if (hasDaggerCompilerDependency()) { + // https://dagger.dev/dev-guide/compiler-options#fastinit-mode + option("-Adagger.fastInit=enabled") + // Enable the better, experimental error messages + // https://github.com/google/dagger/commit/0d2505a727b54f47b8677f42dd4fc5c1924e37f5 + option("-Adagger.experimentalDaggerErrorMessages=enabled") + // Share test components for when we start leveraging Hilt for tests + // https://github.com/google/dagger/releases/tag/dagger-2.34 + option("-Adagger.hilt.shareTestComponents=true") + // KAPT nests errors causing real issues to be suppressed in CI logs + option("-Xmaxerrs", 500) + // Enables per-module validation for faster error detection + // https://github.com/google/dagger/commit/325b516ac6a53d3fc973d247b5231fafda9870a2 + option("-Adagger.moduleBindingValidation=ERROR") + } + } + } + } + project.tasks + .matching { it.name.startsWith("kapt") && it.name.endsWith("UnitTestKotlin") } + .configureEach { enabled = false } + } + + private fun Project.hasDaggerCompilerDependency(): Boolean { + return configurations.any { + it.dependencies.any { dependency -> dependency.name == "hilt-compiler" } + } + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt new file mode 100644 index 00000000..ad6ffc0b --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinLibraryPlugin.kt @@ -0,0 +1,27 @@ +/* + * 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 +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +@Suppress("Unused") +class KotlinLibraryPlugin : Plugin { + + override fun apply(project: Project) { + project.pluginManager.apply(KotlinCommonPlugin::class) + project.tasks.withType().configureEach { + kotlinOptions { + if (!name.contains("test", ignoreCase = true)) { + freeCompilerArgs = freeCompilerArgs + listOf("-Xexplicit-api=strict") + } + } + } + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt new file mode 100644 index 00000000..76b50bf7 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt @@ -0,0 +1,44 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +package app.passwordstore.gradle + +import com.diffplug.gradle.spotless.SpotlessExtension +import com.diffplug.gradle.spotless.SpotlessPlugin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.getByType + +@Suppress("Unused") +class SpotlessPlugin : Plugin { + + override fun apply(project: Project) { + project.pluginManager.apply(SpotlessPlugin::class) + project.extensions.getByType().run { + kotlin { + ktfmt(KTFMT_VERSION).googleStyle() + target("**/*.kt") + targetExclude("**/build/") + } + kotlinGradle { + ktfmt(KTFMT_VERSION).googleStyle() + target("**/*.kts") + targetExclude("**/build/") + } + format("xml") { + target("**/*.xml") + targetExclude("**/build/", ".idea/") + trimTrailingWhitespace() + indentWithSpaces() + endWithNewline() + } + } + } + + private companion object { + private const val KTFMT_VERSION = "0.39" + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/BinaryCompatibilityPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/BinaryCompatibilityPlugin.kt deleted file mode 100644 index 9876ec36..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/BinaryCompatibilityPlugin.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.gradle - -import kotlinx.validation.ApiValidationExtension -import kotlinx.validation.BinaryCompatibilityValidatorPlugin -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.getByType - -@Suppress("Unused") -class BinaryCompatibilityPlugin : Plugin { - - override fun apply(project: Project) { - project.pluginManager.apply(BinaryCompatibilityValidatorPlugin::class) - project.extensions.getByType().ignoredProjects = - mutableSetOf( - "app", - "coroutine-utils", - "coroutine-utils-testing", - "crypto-common", - "crypto-pgpainless", - "format-common", - "diceware", - "random", - "sentry-stub", - "ui-compose", - ) - } -} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt deleted file mode 100644 index e3d6e761..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/DependencyUpdatesPlugin.kt +++ /dev/null @@ -1,33 +0,0 @@ -package dev.msfjarvis.aps.gradle - -import com.github.benmanes.gradle.versions.VersionsPlugin -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask -import nl.littlerobots.vcu.plugin.VersionCatalogUpdateExtension -import nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.getByType -import org.gradle.kotlin.dsl.withType - -@Suppress("Unused") -class DependencyUpdatesPlugin : Plugin { - override fun apply(project: Project) { - project.pluginManager.apply(VersionsPlugin::class) - project.pluginManager.apply(VersionCatalogUpdatePlugin::class) - project.tasks.withType().configureEach { - rejectVersionIf { - when (candidate.group) { - "commons-codec", - "com.android.tools.build", - "org.eclipse.jgit" -> true - else -> false - } - } - checkForGradleUpdate = false - } - project.extensions.getByType().run { - keep.keepUnusedLibraries.set(true) - } - } -} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinAndroidPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinAndroidPlugin.kt deleted file mode 100644 index f874c137..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinAndroidPlugin.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.gradle - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper - -@Suppress("Unused") -class KotlinAndroidPlugin : Plugin { - - override fun apply(project: Project) { - project.pluginManager.run { - apply(KotlinAndroidPluginWrapper::class) - apply(KotlinCommonPlugin::class) - } - } -} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinCommonPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinCommonPlugin.kt deleted file mode 100644 index 3fd6815a..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinCommonPlugin.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.gradle - -import org.gradle.api.JavaVersion -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.api.tasks.testing.Test -import org.gradle.api.tasks.testing.logging.TestLogEvent -import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -@Suppress("Unused") -class KotlinCommonPlugin : Plugin { - - override fun apply(project: Project) { - project.tasks.run { - withType().configureEach { - sourceCompatibility = JavaVersion.VERSION_11.toString() - targetCompatibility = JavaVersion.VERSION_11.toString() - } - withType().configureEach { - kotlinOptions { - allWarningsAsErrors = true - jvmTarget = JavaVersion.VERSION_11.toString() - freeCompilerArgs = freeCompilerArgs + ADDITIONAL_COMPILER_ARGS - languageVersion = "1.5" - } - } - withType().configureEach { - maxParallelForks = Runtime.getRuntime().availableProcessors() * 2 - testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) } - doNotTrackState("We want tests to always run even if Gradle thinks otherwise") - } - } - } - - private companion object { - private val ADDITIONAL_COMPILER_ARGS = - listOf( - "-opt-in=kotlin.RequiresOptIn", - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true", - ) - } -} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinKaptPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinKaptPlugin.kt deleted file mode 100644 index f057fbb3..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinKaptPlugin.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.gradle - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.getByType -import org.jetbrains.kotlin.gradle.internal.Kapt3GradleSubplugin -import org.jetbrains.kotlin.gradle.plugin.KaptExtension -import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper - -@Suppress("Unused") -class KotlinKaptPlugin : Plugin { - - override fun apply(project: Project) { - project.pluginManager.run { - apply(KotlinAndroidPluginWrapper::class) - apply(Kapt3GradleSubplugin::class) - } - project.afterEvaluate { - project.extensions.getByType().run { - javacOptions { - if (hasDaggerCompilerDependency()) { - // https://dagger.dev/dev-guide/compiler-options#fastinit-mode - option("-Adagger.fastInit=enabled") - // Enable the better, experimental error messages - // https://github.com/google/dagger/commit/0d2505a727b54f47b8677f42dd4fc5c1924e37f5 - option("-Adagger.experimentalDaggerErrorMessages=enabled") - // Share test components for when we start leveraging Hilt for tests - // https://github.com/google/dagger/releases/tag/dagger-2.34 - option("-Adagger.hilt.shareTestComponents=true") - // KAPT nests errors causing real issues to be suppressed in CI logs - option("-Xmaxerrs", 500) - // Enables per-module validation for faster error detection - // https://github.com/google/dagger/commit/325b516ac6a53d3fc973d247b5231fafda9870a2 - option("-Adagger.moduleBindingValidation=ERROR") - } - } - } - } - project.tasks - .matching { it.name.startsWith("kapt") && it.name.endsWith("UnitTestKotlin") } - .configureEach { enabled = false } - } - - private fun Project.hasDaggerCompilerDependency(): Boolean { - return configurations.any { - it.dependencies.any { dependency -> dependency.name == "hilt-compiler" } - } - } -} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinLibraryPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinLibraryPlugin.kt deleted file mode 100644 index 7c6e1aaa..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/KotlinLibraryPlugin.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.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 { - - override fun apply(project: Project) { - project.pluginManager.apply(KotlinCommonPlugin::class) - project.tasks.withType().configureEach { - kotlinOptions { - if (!name.contains("test", ignoreCase = true)) { - freeCompilerArgs = freeCompilerArgs + listOf("-Xexplicit-api=strict") - } - } - } - } -} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/SpotlessPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/SpotlessPlugin.kt deleted file mode 100644 index 4ef94024..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/SpotlessPlugin.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.gradle - -import com.diffplug.gradle.spotless.SpotlessExtension -import com.diffplug.gradle.spotless.SpotlessPlugin -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.getByType - -@Suppress("Unused") -class SpotlessPlugin : Plugin { - - override fun apply(project: Project) { - project.pluginManager.apply(SpotlessPlugin::class) - project.extensions.getByType().run { - kotlin { - ktfmt(KTFMT_VERSION).googleStyle() - target("**/*.kt") - targetExclude("**/build/") - } - kotlinGradle { - ktfmt(KTFMT_VERSION).googleStyle() - target("**/*.kts") - targetExclude("**/build/") - } - format("xml") { - target("**/*.xml") - targetExclude("**/build/", ".idea/") - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - } - } - } - - private companion object { - private const val KTFMT_VERSION = "0.39" - } -} -- cgit v1.2.3