add plugin common

This commit is contained in:
2024-10-30 09:16:46 +00:00
parent 83e2e4a19c
commit 30dab5c2fe
4 changed files with 62 additions and 1 deletions

View File

@@ -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.

View File

@@ -12,6 +12,8 @@ plugins {
}
dependencies {
implementation(hlaeja.ltd.hlaeja.plugin.core)
implementation(hlaeja.org.jetbrains.kotlin.gradle.plugin)
}
description = "Hlæja Common Plugin"

View File

@@ -1,3 +1,3 @@
kotlin.code.style=official
version=0.1.0-SNAPSHOT
catalog=0.1.0
catalog=0.2.0-SNAPSHOT

View File

@@ -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<Test> {
useJUnitPlatform()
}
}
version = git.version()