NoIssue: Initial autogenerated files (from 'module_setup-0.0.2.3')
This commit is contained in:
127
build.gradle.kts
Normal file
127
build.gradle.kts
Normal file
@@ -0,0 +1,127 @@
|
||||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
group = "com.r35157.libs"
|
||||
version = project.findProperty("version") ?: "UNSET"
|
||||
if (version == "UNSET" && gradle.startParameter.taskNames.any { it.startsWith("publish") }) {
|
||||
throw GradleException("You must set -Pversion=... (use publish.sh / publishCICD.sh)")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
maven {
|
||||
name = "Artifacts"
|
||||
url = uri("/mnt/artifacts/java")
|
||||
|
||||
// Failsafe for Android variant-aware deps + klassiske Maven-artefakter:
|
||||
metadataSources {
|
||||
gradleMetadata() // bevar .module for Android/AAR varianter
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// The test classes are compiled with these:
|
||||
implementation("com.r35157.libs:testtools-api:0.0-dev")
|
||||
implementation("com.r35157.libs:testtools-impl-ref:0.0-dev")
|
||||
implementation("org.jetbrains:annotations:26.0.1")
|
||||
|
||||
// The JUnit platform will not be included in the JAR file but are needed for running the tests:
|
||||
testImplementation(platform("org.junit:junit-bom:5.11.4"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain { languageVersion.set(JavaLanguageVersion.of(24)) }
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.release.set(24)
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
// Standard JUnit logning – behold defaults
|
||||
}
|
||||
|
||||
/** Kun tests-jar – slå standard :jar fra for at undgå filnavnskonflikt */
|
||||
tasks.jar {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
val testSummary by tasks.registering(Test::class) {
|
||||
description = "Runs tests and prints only a compact summary"
|
||||
group = "verification"
|
||||
|
||||
// ---- wire inputs/classpath ----
|
||||
testClassesDirs = sourceSets.test.get().output.classesDirs
|
||||
classpath = sourceSets.test.get().runtimeClasspath
|
||||
dependsOn(tasks.named("testClasses")) // ensures tests are compiled
|
||||
|
||||
useJUnitPlatform()
|
||||
|
||||
// Disable normal per-test logging
|
||||
testLogging {
|
||||
events() // Ingen events
|
||||
showExceptions = false
|
||||
showStackTraces = false
|
||||
showCauses = false
|
||||
}
|
||||
|
||||
// Our own custom compact status report
|
||||
addTestListener(object : TestListener {
|
||||
override fun beforeSuite(suite: TestDescriptor) {}
|
||||
override fun beforeTest(testDescriptor: TestDescriptor) {}
|
||||
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
|
||||
|
||||
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
|
||||
// Only for the whole test suite (top level)
|
||||
if (suite.parent == null) {
|
||||
val total = result.testCount
|
||||
val failed = result.failedTestCount
|
||||
val skipped = result.skippedTestCount
|
||||
val passed = total - failed - skipped
|
||||
|
||||
// Choose icon - based on status
|
||||
val status = when {
|
||||
failed > 0 -> "\uD83D\uDD34" // Red
|
||||
skipped > 0 -> "\uD83D\uDFE1" // Yellow
|
||||
else -> "\uD83D\uDFE2" // Green
|
||||
}
|
||||
|
||||
println("\n$status $passed passed, $failed failed, $skipped skipped (Total: $total tests)")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
val testJar by tasks.registering(Jar::class) {
|
||||
from(sourceSets.test.get().output)
|
||||
archiveBaseName.set("testtools-tests")
|
||||
archiveVersion.set(version.toString())
|
||||
description = "Assembles a jar archive containing the test classes."
|
||||
group = "build"
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
artifactId = "testtools-tests"
|
||||
artifact(testJar.get()) // Use test-jar as the artifact
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "Artifacts"
|
||||
url = uri("/mnt/artifacts/java")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user