From 8e67da4ed2767f6e015e0d39ae47668e38d36511 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 1 Sep 2023 00:35:35 +0100 Subject: [PATCH] chore: Adding license and publishing --- LICENSE | 21 ++++++++++ build.gradle.kts | 44 +++++++++++++++++++++ src/main/kotlin/CatalogerPlugin.kt | 34 +++++++++++++++- src/main/kotlin/package-info.kt | 25 +++++++++++- src/main/kotlin/task/ValidateCatalogTask.kt | 27 ++++++++++++- 5 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c5e347 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2023 Matt (@LichtHund) - TriumphTeam + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/build.gradle.kts b/build.gradle.kts index 6b90789..cbc702b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,57 @@ plugins { + id("com.github.hierynomus.license") version "0.16.1" + id("com.gradle.plugin-publish") version "1.1.0" kotlin("jvm") version "1.9.10" `java-gradle-plugin` `kotlin-dsl` + +} + +repositories { + mavenCentral() } dependencies { implementation(gradleTestKit()) + implementation(kotlin("stdlib")) } kotlin { explicitApi() } + +license { + header = rootProject.file("LICENSE") + encoding = "UTF-8" + useDefaultMappings = true + + include("**/*.kt") +} + +gradlePlugin { + website.set("https://github.com/TriumphTeam/cataloger") + vcsUrl.set("https://github.com/TriumphTeam/cataloger.git") + + plugins { + create("cataloger") { + id = "dev.triumphteam.cataloger" + displayName = "Cataloger" + description = "Yeah" + // tags.set(listOf("tags", "for", "your", "plugins")) + implementationClass = "dev.triumphteam.cataloger.CatalogerPlugin" + } + } +} + +publishing { + repositories { + maven { + credentials { + username = System.getenv("REPO_USER") + password = System.getenv("REPO_PASS") + } + + url = uri("https://repo.triumphteam.dev/snapshots/") + } + } +} diff --git a/src/main/kotlin/CatalogerPlugin.kt b/src/main/kotlin/CatalogerPlugin.kt index ea8ac54..4cb7a64 100644 --- a/src/main/kotlin/CatalogerPlugin.kt +++ b/src/main/kotlin/CatalogerPlugin.kt @@ -1,6 +1,29 @@ -package dev.triumphteam.cataloguer +/** + * MIT License + * + * Copyright (c) 2019-2023 Matt (@LichtHund) - TriumphTeam + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package dev.triumphteam.cataloger -import dev.triumphteam.cataloguer.task.ValidateCatalogTask +import dev.triumphteam.cataloger.task.ValidateCatalogTask import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.internal.catalog.parser.TomlCatalogFileParser @@ -9,6 +32,13 @@ import org.gradle.api.plugins.catalog.internal.DefaultVersionCatalogPluginExtens import org.gradle.kotlin.dsl.register import java.nio.file.Path +/** + * This class represents a cataloger plugin for Gradle projects. + * + * Responsibilities: + * - Importing and combining toml catalog files + * - Registering a validator for the catalog + */ public abstract class CatalogerPlugin : Plugin { private companion object { diff --git a/src/main/kotlin/package-info.kt b/src/main/kotlin/package-info.kt index 865033f..b03a25a 100644 --- a/src/main/kotlin/package-info.kt +++ b/src/main/kotlin/package-info.kt @@ -1,2 +1,25 @@ +/** + * MIT License + * + * Copyright (c) 2019-2023 Matt (@LichtHund) - TriumphTeam + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ -package dev.triumphteam.cataloguer +package dev.triumphteam.cataloger diff --git a/src/main/kotlin/task/ValidateCatalogTask.kt b/src/main/kotlin/task/ValidateCatalogTask.kt index cabd5f8..0ea3bf6 100644 --- a/src/main/kotlin/task/ValidateCatalogTask.kt +++ b/src/main/kotlin/task/ValidateCatalogTask.kt @@ -1,7 +1,29 @@ -package dev.triumphteam.cataloguer.task +/** + * MIT License + * + * Copyright (c) 2019-2023 Matt (@LichtHund) - TriumphTeam + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package dev.triumphteam.cataloger.task import org.gradle.api.DefaultTask -import org.gradle.api.GradleException import org.gradle.api.artifacts.repositories.MavenArtifactRepository import org.gradle.api.internal.catalog.DefaultVersionCatalog import org.gradle.api.plugins.catalog.internal.DefaultVersionCatalogPluginExtension @@ -13,6 +35,7 @@ import java.io.File import java.lang.StringBuilder import kotlin.io.path.createTempDirectory +/** A task that validates a catalog by setting up and running Gradle test files. */ public abstract class ValidateCatalogTask : DefaultTask() { private companion object {