add common, common-build, common-ktlint, common-detekt, and common-project
This commit is contained in:
42
README.md
42
README.md
@@ -2,14 +2,52 @@
|
|||||||
|
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
* [Common Plugin.](#common-plugin)
|
* [Common Plugin.](#common-plugin)
|
||||||
* [Plugins](#plugins)
|
* [Plugins.](#plugins)
|
||||||
|
* [Common.](#common)
|
||||||
|
* [Plugin Common.](#plugin-common)
|
||||||
|
* [Plugin Common Build.](#plugin-common-build)
|
||||||
|
* [Plugin Common Detekt.](#plugin-common-detekt)
|
||||||
|
* [Plugin Common Ktlint.](#plugin-common-ktlint)
|
||||||
|
* [Plugin Common Project.](#plugin-common-project)
|
||||||
* [Publish gradle plugin locally.](#publish-gradle-plugin-locally)
|
* [Publish gradle plugin locally.](#publish-gradle-plugin-locally)
|
||||||
* [Releasing gradle plugin.](#releasing-gradle-plugin)
|
* [Releasing gradle plugin.](#releasing-gradle-plugin)
|
||||||
* [Publish gradle plugin to repository.](#publish-gradle-plugin-to-repository)
|
* [Publish gradle plugin to repository.](#publish-gradle-plugin-to-repository)
|
||||||
* [Global gradle properties.](#global-gradle-properties)
|
* [Global gradle properties.](#global-gradle-properties)
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
|
|
||||||
## Plugins
|
## Plugins.
|
||||||
|
|
||||||
|
### Common.
|
||||||
|
|
||||||
|
#### Plugin Common.
|
||||||
|
|
||||||
|
id `ltd.lulz.plugin.common-plugin.common`
|
||||||
|
|
||||||
|
Set core Java and Kotlin settings and overweight project version with git version.
|
||||||
|
|
||||||
|
#### Plugin Common Build.
|
||||||
|
|
||||||
|
id `ltd.lulz.plugin.common-plugin.common-build`
|
||||||
|
|
||||||
|
Display name and version, add `buildInfo` to `build` task.
|
||||||
|
|
||||||
|
#### Plugin Common Detekt.
|
||||||
|
|
||||||
|
id `ltd.lulz.plugin.common-plugin.common-detekt`
|
||||||
|
|
||||||
|
Detect is a code smell analysis for your Kotlin projects.
|
||||||
|
|
||||||
|
#### Plugin Common Ktlint.
|
||||||
|
|
||||||
|
id `ltd.lulz.plugin.common-plugin.common-ktlint`
|
||||||
|
|
||||||
|
Ktlint enforces consistent code style and formatting across Kotlin codebases.
|
||||||
|
|
||||||
|
#### Plugin Common Project.
|
||||||
|
|
||||||
|
id `ltd.lulz.plugin.common-plugin.common-project`
|
||||||
|
|
||||||
|
Display project, Gradle, and Java information.
|
||||||
|
|
||||||
## Publish gradle plugin locally.
|
## Publish gradle plugin locally.
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ plugins {
|
|||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(aa.plugin.core)
|
||||||
|
implementation(aa.plugin.detekt)
|
||||||
|
implementation(aa.plugin.ktlint)
|
||||||
|
implementation(aa.plugin.kotlin)
|
||||||
|
}
|
||||||
|
|
||||||
description = "Lulz Common Plugin"
|
description = "Lulz Common Plugin"
|
||||||
group = "ltd.lulz.plugin"
|
group = "ltd.lulz.plugin"
|
||||||
version = git.version()
|
version = git.version()
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
version=0.1.0-SNAPSHOT
|
version=0.1.0-SNAPSHOT
|
||||||
catalog=0.1.0
|
catalog=0.2.0-SNAPSHOT
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
plugins {
|
||||||
|
id("ltd.lulz.plugin.core-plugin")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
named("build") {
|
||||||
|
dependsOn("buildInfo")
|
||||||
|
}
|
||||||
|
register("buildInfo") {
|
||||||
|
group = "lulz"
|
||||||
|
description = "Prints the project name and version"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
println(info.nameVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import io.gitlab.arturbosch.detekt.Detekt
|
||||||
|
import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_SRC_DIR_KOTLIN
|
||||||
|
import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_TEST_SRC_DIR_KOTLIN
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("io.gitlab.arturbosch.detekt")
|
||||||
|
}
|
||||||
|
|
||||||
|
detekt {
|
||||||
|
buildUponDefaultConfig = true
|
||||||
|
basePath = projectDir.path
|
||||||
|
source.from(
|
||||||
|
DEFAULT_SRC_DIR_KOTLIN,
|
||||||
|
DEFAULT_TEST_SRC_DIR_KOTLIN,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Detekt> {
|
||||||
|
reports {
|
||||||
|
html.required = false
|
||||||
|
md.required = false
|
||||||
|
sarif.required = true
|
||||||
|
txt.required = false
|
||||||
|
xml.required = false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType.SARIF
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.jlleitschuh.gradle.ktlint")
|
||||||
|
}
|
||||||
|
|
||||||
|
ktlint {
|
||||||
|
verbose = true
|
||||||
|
filter {
|
||||||
|
exclude("**/generated/**")
|
||||||
|
include("**/kotlin/**")
|
||||||
|
}
|
||||||
|
kotlinScriptAdditionalPaths {
|
||||||
|
include(fileTree("scripts/*"))
|
||||||
|
}
|
||||||
|
reporters {
|
||||||
|
reporter(SARIF)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import org.gradle.kotlin.dsl.kotlin
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("ltd.lulz.plugin.core-plugin")
|
||||||
|
kotlin("jvm")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("projectInfo") {
|
||||||
|
group = "lulz"
|
||||||
|
description = "Prints project information"
|
||||||
|
|
||||||
|
val groupValue = project.group.toString()
|
||||||
|
val nameValue = project.name
|
||||||
|
val versionValue = project.version.toString()
|
||||||
|
val descriptionValue = project.description ?: "N/A"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
println()
|
||||||
|
println("UTC Time: ${info.utcTimestamp}")
|
||||||
|
println()
|
||||||
|
println("Project group: $groupValue")
|
||||||
|
println("Project name: $nameValue\"")
|
||||||
|
println("Project version: $versionValue")
|
||||||
|
println("Project description: $descriptionValue")
|
||||||
|
println()
|
||||||
|
println("Gradle version: ${GradleVersion.current().version}")
|
||||||
|
println("Java JVM version: ${JavaVersion.current()}")
|
||||||
|
println("Java toolchain version: ${java.toolchain.languageVersion.orNull ?: "N/A"}")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
plugins {
|
||||||
|
id("ltd.lulz.plugin.common-plugin.common-build")
|
||||||
|
id("ltd.lulz.plugin.common-plugin.common-detekt")
|
||||||
|
id("ltd.lulz.plugin.common-plugin.common-ktlint")
|
||||||
|
id("ltd.lulz.plugin.common-plugin.common-project")
|
||||||
|
|
||||||
|
id("ltd.lulz.plugin.core-plugin")
|
||||||
|
|
||||||
|
kotlin("jvm")
|
||||||
|
}
|
||||||
|
|
||||||
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
|
kotlin.compilerOptions.freeCompilerArgs.addAll("-Xjsr305=strict")
|
||||||
|
|
||||||
|
tasks.withType<Test> {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
version = git.version()
|
||||||
Reference in New Issue
Block a user