From 30dab5c2fe3a94023f5ca428cf9510d33c0d2af4 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Wed, 30 Oct 2024 09:16:46 +0000 Subject: [PATCH] add plugin common --- README.md | 11 +++++ build.gradle.kts | 2 + gradle.properties | 2 +- ...gin.hlaeja-common-plugin.common.gradle.kts | 48 +++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.common.gradle.kts diff --git a/README.md b/README.md index 56020d9..06ae709 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,17 @@ Plugins for the libraries, lofty and grand, Plugins for the services, steadfast ## Plugins +### Plugin Common + +id `ltd.hlaeja.plugin.hlaeja-common-plugin.common` + +Set core Java and Kotlin settings and overweight project version with git version. + +#### Gradle Tasks + +* `buildInfo` display name and version, add to `build` task. +* `projectInfo` display project, Gradle, and Java information + ## Releasing plugin Run `release.sh` script from `master` branch. diff --git a/build.gradle.kts b/build.gradle.kts index dd6a6b6..c37c178 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,8 @@ plugins { } dependencies { + implementation(hlaeja.ltd.hlaeja.plugin.core) + implementation(hlaeja.org.jetbrains.kotlin.gradle.plugin) } description = "Hlæja Common Plugin" diff --git a/gradle.properties b/gradle.properties index 37e4012..003da4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official version=0.1.0-SNAPSHOT -catalog=0.1.0 +catalog=0.2.0-SNAPSHOT diff --git a/src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.common.gradle.kts b/src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.common.gradle.kts new file mode 100644 index 0000000..596e517 --- /dev/null +++ b/src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.common.gradle.kts @@ -0,0 +1,48 @@ +plugins { + id("ltd.hlaeja.plugin.hlaeja-core-plugin") + + kotlin("jvm") +} + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +kotlin.compilerOptions.freeCompilerArgs.addAll("-Xjsr305=strict") + +tasks { + named("build") { + dependsOn("buildInfo") + } + + register("buildInfo") { + group = "hlaeja" + description = "Prints the project name and version" + + doLast { + println(info.nameVersion) + } + } + + register("projectInfo") { + group = "hlaeja" + description = "Prints project information" + doLast { + println() + println("UTC Time: ${info.utcTimestamp}") + println() + println("Project group: ${project.group}") + println("Project name: ${project.name}") + println("Project version: ${project.version}") + println("Project description: ${project.description ?: "N/A"}") + println() + println("Gradle version: ${GradleVersion.current().version}") + println("Java JVM version: ${JavaVersion.current()}") + println("Java toolchain version: ${java.toolchain.languageVersion.orNull ?: "N/A"}") + } + } + + withType { + useJUnitPlatform() + } +} + +version = git.version()