automation-plugins: convert to full plugins

This commit is contained in:
Harsh Shandilya 2022-06-05 03:25:25 +05:30
parent 504c8b466c
commit fe3ca3f7d8
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
8 changed files with 29 additions and 19 deletions

View file

@ -28,11 +28,15 @@ gradlePlugin {
plugins { plugins {
register("crowdin") { register("crowdin") {
id = "com.github.android-password-store.crowdin-plugin" id = "com.github.android-password-store.crowdin-plugin"
implementationClass = "crowdin.CrowdinDownloadPlugin" implementationClass = "dev.msfjarvis.aps.gradle.crowdin.CrowdinDownloadPlugin"
} }
register("psl") { register("psl") {
id = "com.github.android-password-store.psl-plugin" 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"
} }
} }
} }

View file

@ -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<GitHooks>("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)
}

View file

@ -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<Project> {
override fun apply(project: Project) {
project.tasks.register<GitHooks>("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)
}
}
}

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only * SPDX-License-Identifier: GPL-3.0-only
*/ */
package crowdin package dev.msfjarvis.aps.gradle.crowdin
/** Extension for configuring [CrowdinDownloadPlugin] */ /** Extension for configuring [CrowdinDownloadPlugin] */
interface CrowdinExtension { interface CrowdinExtension {

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only * SPDX-License-Identifier: GPL-3.0-only
*/ */
package crowdin package dev.msfjarvis.aps.gradle.crowdin
import de.undercouch.gradle.tasks.download.Download import de.undercouch.gradle.tasks.download.Download
import java.io.File import java.io.File

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only * SPDX-License-Identifier: GPL-3.0-only
*/ */
package psl package dev.msfjarvis.aps.gradle.psl
import okio.buffer import okio.buffer
import okio.sink import okio.sink

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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.io.Serializable
import java.util.TreeSet import java.util.TreeSet

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-3.0-only * SPDX-License-Identifier: GPL-3.0-only
*/ */
package tasks package dev.msfjarvis.aps.gradle.tasks
import java.io.File import java.io.File
import java.nio.file.Files import java.nio.file.Files