Newer
Older
import java.time.LocalDateTime
import java.time.temporal.ChronoUnit
plugins {
id 'java'
id 'jacoco'
id "com.github.vlsi.jandex" version "1.86"
id 'org.ajoberstar.grgit' version '5.0.0'
}
apply from: rootProject.file('gradle/install-git-hooks.gradle')
allprojects {
version = project.version "-" + UUID.randomUUID().toString().substring(0, 8)
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/EFA-FHB/eforms-validator-core"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
subprojects {
apply plugin: 'java'
apply plugin: 'com.github.vlsi.jandex'
repositories {
mavenCentral()
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${property("github.packages.xray")}")
credentials {
username = findProperty("gpr.user") ?: findProperty("github.packages.username")
password = findProperty("gpr.key") ?: findProperty("github.packages.password")
}
}
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
}
test {
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
reports.html.required = false
}
compileTestJava {
options.encoding = 'UTF-8'
}
tasks.register('buildInfo') {
doLast {
def commitId = System.getenv('GIT_SHA_REF') ?: grgit.head().getId()
new File(sourceSets.main.output.resourcesDir, "build_info.json").text =
"""{
"name" : "${rootProject.name}-${project.name}",
"build" : {
"version" : "${project.version}",
"time" : "${LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS)}",
"git" : {
"sha" : "${commitId}",
"repository_url" : "${grgit.remote.list().get(0).url}"
}
}
}
"""
}
}
}