Add git and gradle build information

This commit is contained in:
JeremyStar™ 2024-12-18 17:41:53 +01:00
parent 574c9586a1
commit 2629e940e7
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
5 changed files with 63 additions and 11 deletions

2
base/src/main/resources/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
sosengine-*-git.properties
sosengine-*-gradle.properties

View file

@ -2,6 +2,8 @@ import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.net.URI
import java.nio.file.Files
import java.nio.file.LinkOption
/*
* STAROPENSOURCE ENGINE SOURCE FILE
@ -115,6 +117,21 @@ allprojects {
jvmTarget = JvmTarget.valueOf("JVM_${property("java") as String}")
}
// Unit testing
// -> Configure Gradle to use JUnit
tasks.test {
useJUnitPlatform()
testLogging {
events(
"passed",
"skipped",
"failed"
)
}
maxParallelForks = 1
}
// Dokka
// -> Register jar generation tasks
// See https://kotlinlang.org/docs/dokka-gradle.html#build-javadoc-jar
@ -173,18 +190,45 @@ allprojects {
}
}
// Unit testing
// -> Configure Gradle to use JUnit
tasks.test {
useJUnitPlatform()
// Git properties
// -> Configure
gitProperties {
dotGitDirectory = file("${rootProject.rootDir}/.git")
failOnNoGitDirectory = false // Allow continuing if .git directory is missing (tarball)
extProperty = "git"
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "UTC"
}
// -> Copy task
tasks.register("copyGitProperties") {
dependsOn(tasks.generateGitProperties)
testLogging {
events(
"passed",
"skipped",
"failed"
)
doLast {
val target: File = file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-git.properties")
val source: File = file("${project.projectDir}/build/resources/main/git.properties")
if (Files.exists(target.toPath(), LinkOption.NOFOLLOW_LINKS))
Files.delete(target.toPath())
Files.move(source.toPath(), target.toPath())
}
maxParallelForks = 1
}
tasks.processResources {
dependsOn(tasks["copyGitProperties"])
}
// Gradle properties
// -> Copy task
tasks.register("copyGradleProperties") {
doLast {
val target: File = file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-gradle.properties")
val source: File = file("${project(":").projectDir.path}/gradle.properties")
if (Files.exists(target.toPath(), LinkOption.NOFOLLOW_LINKS))
Files.delete(target.toPath())
Files.copy(source.toPath(), target.toPath())
}
}
tasks.processResources {
dependsOn(tasks["copyGradleProperties"])
}
}

View file

@ -0,0 +1,2 @@
sosengine-*-git.properties
sosengine-*-gradle.properties

2
testapp/src/main/resources/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
sosengine-*-git.properties
sosengine-*-gradle.properties

2
testing/src/main/resources/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
sosengine-*-git.properties
sosengine-*-gradle.properties