Set up project structure
This commit is contained in:
115
build.gradle.kts
Normal file
115
build.gradle.kts
Normal file
@@ -0,0 +1,115 @@
|
||||
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
|
||||
import java.lang.System.getenv
|
||||
import java.time.OffsetDateTime.now
|
||||
import java.time.ZoneId.of
|
||||
import java.time.format.DateTimeFormatter.ofPattern
|
||||
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType.SARIF
|
||||
|
||||
plugins {
|
||||
alias(aa.plugins.gradle.detekt)
|
||||
alias(aa.plugins.gradle.ktlint)
|
||||
alias(aa.plugins.kotlin.jvm)
|
||||
|
||||
`kotlin-dsl`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(aa.kotlin.junit5)
|
||||
|
||||
testRuntimeOnly(aa.junit.platform.launcher)
|
||||
}
|
||||
|
||||
description = "Lulz Core Plugin"
|
||||
group = "ltd.lulz.plugin"
|
||||
|
||||
detekt {
|
||||
buildUponDefaultConfig = true
|
||||
basePath = projectDir.path
|
||||
source.from(DEFAULT_SRC_DIR_KOTLIN, DEFAULT_TEST_SRC_DIR_KOTLIN)
|
||||
}
|
||||
|
||||
gradlePlugin.plugins.create("core-plugin") {
|
||||
id = "ltd.lulz.plugin.core-plugin"
|
||||
implementationClass = "ltd.lulz.plugin.CorePlugin"
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
kotlin.compilerOptions.freeCompilerArgs.addAll("-Xjsr305=strict")
|
||||
|
||||
ktlint {
|
||||
verbose = true
|
||||
filter {
|
||||
include("**/kotlin/**")
|
||||
}
|
||||
reporters {
|
||||
reporter(SARIF)
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
|
||||
fun retrieveConfiguration(
|
||||
property: String,
|
||||
environment: String,
|
||||
): String? = project.findProperty(property)?.toString() ?: getenv(environment)
|
||||
|
||||
maven {
|
||||
url = uri("https://gitea.lulz.ltd/api/packages/aura-ascend/maven")
|
||||
name = "GiteaPackages"
|
||||
credentials {
|
||||
username = retrieveConfiguration("repository.gitea.user", "REPOSITORY_USER")
|
||||
password = retrieveConfiguration("repository.gitea.token", "REPOSITORY_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
named("build") {
|
||||
dependsOn("buildInfo")
|
||||
}
|
||||
register("buildInfo") {
|
||||
group = "hlaeja"
|
||||
description = "Prints the project name and version"
|
||||
val projectName = project.name
|
||||
val projectVersion = project.version
|
||||
doLast {
|
||||
println("Project Name: $projectName Version: $projectVersion")
|
||||
}
|
||||
}
|
||||
withType<Detekt> {
|
||||
reports {
|
||||
html.required = false
|
||||
md.required = false
|
||||
sarif.required = true
|
||||
txt.required = false
|
||||
xml.required = false
|
||||
}
|
||||
}
|
||||
withType<Jar> {
|
||||
manifest.attributes.apply {
|
||||
put("Implementation-Title", project.name)
|
||||
put("Implementation-Version", project.version)
|
||||
put("Implementation-Vendor", "Lulz Ltd")
|
||||
put("Built-By", System.getProperty("user.name"))
|
||||
put("Built-Gradle", project.gradle.gradleVersion)
|
||||
put("Built-JDK", System.getProperty("java.version"))
|
||||
put("Built-OS", "${System.getProperty("os.name")} v${System.getProperty("os.version")}")
|
||||
put(
|
||||
"Built-Time",
|
||||
now().atZoneSameInstant(of("UTC")).format(ofPattern("yyyy-MM-dd HH:mm:ss z")).toString(),
|
||||
)
|
||||
}
|
||||
}
|
||||
withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user