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.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.net.URI import java.net.URI
import java.nio.file.Files
import java.nio.file.LinkOption
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
@ -115,6 +117,21 @@ allprojects {
jvmTarget = JvmTarget.valueOf("JVM_${property("java") as String}") 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 // Dokka
// -> Register jar generation tasks // -> Register jar generation tasks
// See https://kotlinlang.org/docs/dokka-gradle.html#build-javadoc-jar // See https://kotlinlang.org/docs/dokka-gradle.html#build-javadoc-jar
@ -173,18 +190,45 @@ allprojects {
} }
} }
// Unit testing // Git properties
// -> Configure Gradle to use JUnit // -> Configure
tasks.test { gitProperties {
useJUnitPlatform() 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 { doLast {
events( val target: File = file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-git.properties")
"passed", val source: File = file("${project.projectDir}/build/resources/main/git.properties")
"skipped",
"failed" 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