-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
283 lines (238 loc) · 6.89 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
plugins {
id 'com.netflix.nebula.ospackage' version '11.6.0'
id 'pmd'
//id 'checkstyle'
}
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'pmd'
pmd {
ignoreFailures = true
}
}
subprojects {
ext {
ecco = {
adapter = false
set("storage", false)
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.netflix.nebula.ospackage'
//apply plugin: 'checkstyle'
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
}
jar {
manifest {
attributes("Implementation-Title": project.name, "Implementation-Version": project.version, "Implementation-Vendor": project.group)
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integrationTest/java')
}
resources {
srcDir file('src/integrationTest/resources')
}
}
}
configurations {
integrationTestCompile.extendsFrom implementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
}
test {
useJUnitPlatform()
outputs.upToDateWhen { false }
filter {
exclude("**/integrationTest/**")
}
}
task integrationTest(type: Test, group: 'verification', description: 'Runs the integration tests.') {
useJUnitPlatform()
classpath = sourceSets.integrationTest.runtimeClasspath
testClassesDirs = sourceSets.integrationTest.output.classesDirs
outputs.upToDateWhen { false }
filter {
exclude("**/test/**")
}
}
check.dependsOn -= integrationTest
tasks.named("processIntegrationTestResources") {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
idea {
module {
testSourceDirs += file('src/integrationTest/java')
scopes.TEST.plus += [configurations.integrationTestCompile]
downloadJavadoc = true
downloadSources = true
}
}
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
task sourcesJar(type: Jar, group: 'packaging') {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, group: 'packaging', dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
eccoMaven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from project.components.java
artifact javadocJar {
}
artifact sourcesJar {
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = System.getenv("GITHUB_PACKAGES_URL")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
// # PACKAGING
ospackage {
packageName = project.name
version = project.version
release = 1
arch = NOARCH
os = LINUX
prefix '/usr/'
directory('/usr/share/java/ecco')
directory('/usr/share/java/ecco/lib')
into('/usr/share/java/') {
from(project.jar) {
addParentDirs false
into 'ecco/'
}
from({
def temp = project.configurations.runtimeClasspath
project.configurations.findAll { it.name.equals("runtimeClasspath") }.collectMany {
it.allDependencies
}.findAll { it instanceof ProjectDependency }.collect {
(it as ProjectDependency).dependencyProject.configurations.runtimeClasspath
}.each { temp = temp - it }
project.configurations.findAll { it.name.equals("runtimeClasspath") }.collectMany {
it.allDependencies
}.findAll { it instanceof ProjectDependency }.collect { (it as ProjectDependency).dependencyProject.jar.outputs.files }.each {
temp = temp - it
}
return temp
}) {
addParentDirs false
into 'ecco/lib/'
}
}
}
buildRpm {
}
buildDeb {
}
task rpm(type: Rpm, group: 'packaging') {
}
task deb(type: Deb, group: 'packaging') {
}
task sourcesZip(type: Zip, group: 'packaging') {
//compression = Compression.GZIP
archiveClassifier = 'src'
from projectDir
include 'src/**/*'
include 'build.gradle'
}
task linuxZip(type: Zip, group: 'packaging') {
archiveClassifier = 'linux'
into(archiveFileName.get() - ('.' + archiveExtension)) {
from project.jar
from project.configurations.runtimeClasspath
}
}
task windowsZip(type: Zip, group: 'packaging') {
archiveClassifier = 'windows'
into(archiveFileName.get() - ('.' + archiveExtension)) {
from project.jar
from project.configurations.runtimeClasspath
}
}
// # BUNDLING
task copyJars(type: Copy, dependsOn: project.build) {
from(project.jar)
into project.file('build/bundle/')
}
task copyDependencies(type: Copy) {
from(project.configurations.runtimeOnly)
into project.file('build/bundle/lib/')
}
task bundle(dependsOn: [copyJars, copyDependencies])
task depTest {
def temp = project.configurations.runtimeOnly
project.configurations.findAll { it.name.equals("runtimeOnly") }.collectMany { it.allDependencies }.findAll {
it instanceof ProjectDependency
}.collect { it.dependencyProject.jar.outputs.files }.each { println it }
}
}
task combinedjavadoc(type: Javadoc, group: "documentation") {
description = 'Generates a global javadoc from all the modules.'
source project.subprojects.collect { it.sourceSets.main.allJava }
classpath = files(project.subprojects.collect { it.sourceSets.main.compileClasspath })
options.memberLevel = JavadocMemberLevel.PRIVATE
options.links = ['https://docs.oracle.com/en/java/javase/13/docs/api/']
destinationDir = file("${buildDir}/docs/javadoc")
}
task combinedrpm(type: Copy, group: 'packaging') {
dependsOn subprojects.rpm
into "$project.distsDirectory/rpm"
//from project.subprojects.collect { it.rpm.archivePath }
from subprojects.rpm.archivePath
}
task combineddeb(type: Copy, group: 'packaging') {
dependsOn subprojects.deb
into "$project.distsDirectory/deb"
//from project.subprojects.collect { it.deb.archivePath }
from subprojects.deb.archivePath
}
task combinedLinuxZip(type: Zip, group: 'packaging') {
into project.name
archiveClassifier = 'linux'
destinationDirectory = file("$project.distsDirectory/zip")
from { subprojects.linuxZip.source }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task combinedWindowsZip(type: Zip, group: 'packaging') {
into project.name
archiveClassifier = 'windows'
destinationDirectory = file("$project.distsDirectory/zip")
from { subprojects.windowsZip.source }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}