diff --git a/build-logic/automation-plugins/build.gradle.kts b/build-logic/automation-plugins/build.gradle.kts index 83b89079..80b53e10 100644 --- a/build-logic/automation-plugins/build.gradle.kts +++ b/build-logic/automation-plugins/build.gradle.kts @@ -28,11 +28,15 @@ gradlePlugin { plugins { register("crowdin") { id = "com.github.android-password-store.crowdin-plugin" - implementationClass = "crowdin.CrowdinDownloadPlugin" + implementationClass = "dev.msfjarvis.aps.gradle.crowdin.CrowdinDownloadPlugin" } register("psl") { id = "com.github.android-password-store.psl-plugin" - implementationClass = "psl.PublicSuffixListPlugin" + implementationClass = "dev.msfjarvis.aps.gradle.psl.PublicSuffixListPlugin" + } + register("git-hooks") { + id = "com.github.android-password-store.git-hooks" + implementationClass = "dev.msfjarvis.aps.gradle.GitHooksPlugin" } } } diff --git a/build-logic/automation-plugins/src/main/kotlin/com.github.android-password-store.git-hooks.gradle.kts b/build-logic/automation-plugins/src/main/kotlin/com.github.android-password-store.git-hooks.gradle.kts deleted file mode 100644 index 6f661a6a..00000000 --- a/build-logic/automation-plugins/src/main/kotlin/com.github.android-password-store.git-hooks.gradle.kts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -import tasks.GitHooks - -tasks.register("installGitHooks") { - val projectDirectory = layout.projectDirectory - hookScript.set(projectDirectory.file("scripts/pre-push-hook.sh").asFile.readText()) - hookOutput.set(projectDirectory.file(".git/hooks/pre-push").asFile) -} diff --git a/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/GitHooksPlugin.kt b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/GitHooksPlugin.kt new file mode 100644 index 00000000..3ddb656b --- /dev/null +++ b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/GitHooksPlugin.kt @@ -0,0 +1,18 @@ +package dev.msfjarvis.aps.gradle + +import dev.msfjarvis.aps.gradle.tasks.GitHooks +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.register + +@Suppress("Unused") +class GitHooksPlugin : Plugin { + + override fun apply(project: Project) { + project.tasks.register("installGitHooks") { + val projectDirectory = project.layout.projectDirectory + hookScript.set(projectDirectory.file("scripts/pre-push-hook.sh").asFile.readText()) + hookOutput.set(projectDirectory.file(".git/hooks/pre-push").asFile) + } + } +} diff --git a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/crowdin/CrowdinExtension.kt similarity index 91% rename from build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt rename to build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/crowdin/CrowdinExtension.kt index 761267b5..7d32dc01 100644 --- a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt +++ b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/crowdin/CrowdinExtension.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -package crowdin +package dev.msfjarvis.aps.gradle.crowdin /** Extension for configuring [CrowdinDownloadPlugin] */ interface CrowdinExtension { diff --git a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/crowdin/CrowdinPlugin.kt similarity index 99% rename from build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt rename to build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/crowdin/CrowdinPlugin.kt index e147b42c..62d8e32d 100644 --- a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinPlugin.kt +++ b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/crowdin/CrowdinPlugin.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -package crowdin +package dev.msfjarvis.aps.gradle.crowdin import de.undercouch.gradle.tasks.download.Download import java.io.File diff --git a/build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/psl/PSLUpdateTask.kt similarity index 97% rename from build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt rename to build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/psl/PSLUpdateTask.kt index e8fdc498..7e137b2f 100644 --- a/build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt +++ b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/psl/PSLUpdateTask.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -package psl +package dev.msfjarvis.aps.gradle.psl import okio.buffer import okio.sink diff --git a/build-logic/automation-plugins/src/main/kotlin/psl/PublicSuffixListPlugin.kt b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/psl/PublicSuffixListPlugin.kt similarity index 98% rename from build-logic/automation-plugins/src/main/kotlin/psl/PublicSuffixListPlugin.kt rename to build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/psl/PublicSuffixListPlugin.kt index 9d4c3f63..775ec722 100644 --- a/build-logic/automation-plugins/src/main/kotlin/psl/PublicSuffixListPlugin.kt +++ b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/psl/PublicSuffixListPlugin.kt @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package psl +package dev.msfjarvis.aps.gradle.psl import java.io.Serializable import java.util.TreeSet diff --git a/build-logic/automation-plugins/src/main/kotlin/tasks/GitHooks.kt b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/tasks/GitHooks.kt similarity index 97% rename from build-logic/automation-plugins/src/main/kotlin/tasks/GitHooks.kt rename to build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/tasks/GitHooks.kt index ec045227..1eb8540f 100644 --- a/build-logic/automation-plugins/src/main/kotlin/tasks/GitHooks.kt +++ b/build-logic/automation-plugins/src/main/kotlin/dev/msfjarvis/aps/gradle/tasks/GitHooks.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -package tasks +package dev.msfjarvis.aps.gradle.tasks import java.io.File import java.nio.file.Files