-
Notifications
You must be signed in to change notification settings - Fork 55
/
build.gradle
99 lines (84 loc) · 3.38 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
import groovy.json.JsonOutput
import org.apache.tools.ant.filters.ReplaceTokens
import java.text.SimpleDateFormat
plugins {
id "net.nemerosa.versioning" version "3.0.0" apply false
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
}
apply from: './constant.gradle'
allprojects {
apply plugin: "java"
apply plugin: 'net.nemerosa.versioning'
version = versioning.info.build
}
subprojects {
repositories {
try (def scanner = new Scanner(file.repositories as File)) {
while (scanner.hasNextLine()) {
def line = scanner.nextLine()
if (line.trim().length() == 0 || (line.charAt(0) as String) == '#') continue
maven {
url line
}
}
}
}
dependencies {
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
compileOnly("org.jetbrains:annotations:24.1.0")
annotationProcessor("org.jetbrains:annotations:24.1.0")
try (def scanner = new Scanner(file.libraries as File)) {
while (scanner.hasNextLine()) {
def line = scanner.nextLine()
if (line.trim().length() == 0 || (line.charAt(0) as String) == '#') continue
def args = line.split("\\s+")
compileOnly group: args[0], name: args[1], version: args[2]
}
}
}
processResources {
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
def contributors = new HashSet<String>()
try (def scanner = new Scanner(file.contributors as File)) {
while (scanner.hasNextLine()) {
def line = scanner.nextLine()
if (line.trim().length() == 0 || (line.charAt(0) as String) == '#') continue
contributors.add(line)
}
}
def ver;
def env = System.getProperty("env", "AUTO").toLowerCase()
if (env == "final") {
ver = (project.plugin_version as String)
} else {
ver = "Build_" + version
}
filter ReplaceTokens, tokens: [
"contributors_json": JsonOutput.toJson(contributors),
"contributors" : contributors.join(", "),
"version" : ver,
"build_type" : env,
"build_timestamp" : System.currentTimeMillis() as String
]
}
jar {
manifest {
attributes(
'Built-By' : System.properties['user.name'],
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Build-Revision' : versioning.info.commit,
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
file.encoding = "UTF-8"
}
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
}
}