-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
executable file
·164 lines (136 loc) · 4.35 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import groovy.transform.Memoized
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.42.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
classpath 'me.champeau.jmh:jmh-gradle-plugin:0.6.8'
classpath "com.github.alisiikh:gradle-scalastyle-plugin:3.4.1"
classpath 'com.palantir.gradle.revapi:gradle-revapi:1.7.0'
classpath 'com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.1'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.15.0'
classpath ('org.eclipse.jgit:org.eclipse.jgit:5.13.1.202206130422-r') {
// gradle-git-version automatically uses a jgit version that requires JDK11
// so we need to enforce the latest jgit version that works with JDK8
force = true
}
}
}
plugins {
id 'nebula.dependency-recommender' version '11.0.0'
}
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
project.ext.jdkVersion = '8'
} else if (JavaVersion.current() == JavaVersion.VERSION_11) {
project.ext.jdkVersion = '11'
} else if (JavaVersion.current() == JavaVersion.VERSION_17) {
project.ext.jdkVersion = '17'
} else if (JavaVersion.current() == JavaVersion.VERSION_18) {
project.ext.jdkVersion = '18'
} else if (JavaVersion.current() == JavaVersion.VERSION_19) {
project.ext.jdkVersion = '19'
} else {
throw new GradleException("This build must be run with JDK 8 or 11 but was executed with JDK " + JavaVersion.current())
}
dependencyRecommendations {
propertiesFile file: file('versions.props')
}
def projectVersion = getProjectVersion()
allprojects {
group = "com.zetaris.lightning"
version = projectVersion
repositories {
mavenCentral()
mavenLocal()
}
}
subprojects {
apply plugin: 'nebula.dependency-recommender'
apply plugin: 'java-library'
configurations {
testImplementation.extendsFrom compileOnly
all {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.mortbay.jetty'
exclude group: 'com.sun.jersey'
exclude group: 'com.sun.jersey.contribs'
exclude group: 'org.pentaho', module: 'pentaho-aggdesigner-algorithm'
}
testArtifacts
}
compileJava {
options.encoding = "UTF-8"
}
compileTestJava {
options.encoding = "UTF-8"
}
javadoc {
options.encoding = 'UTF-8'
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
dependencies {
implementation 'org.slf4j:slf4j-api'
implementation 'com.github.stephenc.findbugs:findbugs-annotations'
testImplementation 'org.junit.vintage:junit-vintage-engine'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.slf4j:slf4j-simple'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-inline'
testImplementation 'org.assertj:assertj-core'
}
test {
def logDir = "${rootDir}/build/testlogs"
def logFile = "${logDir}/${project.name}.log"
mkdir("${logDir}")
delete("${logFile}")
def buildLog = new File(logFile)
addTestOutputListener(new TestOutputListener() {
def lastDescriptor
@Override
void onOutput(TestDescriptor testDescriptor, TestOutputEvent testOutputEvent) {
if (lastDescriptor != testDescriptor) {
buildLog << "--------\n- Test log for: "<< testDescriptor << "\n--------\n"
lastDescriptor = testDescriptor
}
buildLog << testOutputEvent.destination << " " << testOutputEvent.message
}
})
maxHeapSize = "1500m"
testLogging {
events "failed"
exceptionFormat "full"
}
}
}
@Memoized
boolean versionFileExists() {
return file('version.txt').exists()
}
@Memoized
String getVersionFromFile() {
return file('version.txt').text.trim()
}
String getProjectVersion() {
if (versionFileExists()) {
return getVersionFromFile()
}
return "0.1"
}
String getJavadocVersion() {
if (versionFileExists()) {
return getVersionFromFile()
}
try {
// use the branch name in place of version in Javadoc
return versionDetails().branchName
} catch (NullPointerException e) {
throw new Exception("Neither version.txt nor git version exists")
}
}
apply from: 'baseline.gradle'
apply from: 'tasks.gradle'