forked from Fraunhofer-AISEC/trusted-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
315 lines (264 loc) · 11.2 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
plugins {
id 'java'
id 'com.google.protobuf' version '0.8.9'
id 'com.moowork.node' version '1.3.1'
id 'biz.aQute.bnd' version '4.1.0' apply false
id 'com.github.lburgazzoli.karaf' version '0.5.1'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
id 'com.github.jlouns.cpe' version '0.5.0'
id 'com.benjaminsproule.swagger' version '1.0.6'
id 'com.bmuschko.docker-remote-api' version '3.4.3'
id 'com.diffplug.gradle.spotless' version '3.13.0'
id 'com.github.jk1.dependency-license-report' version '1.2'
}
licenseReport {
configurations = ['compile', 'providedByFeature', 'providedByBundle']
}
def getDockerTag() {
String commit = 'HEAD'
if (hasProperty('dockerTag')) {
return findProperty('dockerTag')
}
if (System.getenv('CI_COMMIT_SHA')) {
commit = System.getenv('CI_COMMIT_SHA')
} else {
String commandLine
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine = 'cmd /c '
} else {
commandLine = ''
}
def proc = (commandLine + 'git rev-parse HEAD').execute()
proc.in.eachLine { line -> commit = line }
proc.err.eachLine { line -> println line }
proc.waitFor()
}
if (commit == 'HEAD') {
commit
} else {
commit.substring(0, 8)
}
}
allprojects {
group = 'de.fhg.aisec.ids'
version = '2.1.0-SNAPSHOT'
String protobuf_version = '3.6.1';
if(System.getProperty("os.arch").equals("ppc64le")) {
protobuf_version = '3.8.0';
System.out.println("**In if block**");
}
System.out.println(System.getProperty("os.arch"));
ext.libraryVersions = [
// Versions for modules that will be released as libraries
api : '2.0.1',
idscp : '1.0.2',
// basically, the first requirement, all other libraries depend on this version
karaf : '4.2.6',
// The used version of the infomodel from IESE
infomodel : '1.0.2-20190326.094248-16',
infomodelSerializer: '1.0.2-20190326.155238-20',
// For javax.xml.bind support in newer java versions
jaxb : "2.2.11",
pax : '7.2.9',
camel : '2.22.3',
// Camel ships with cxf, however it is slightly older so we want a newer version
cxf : '3.2.4',
// OSGI libraries
osgiCompendium : '6.0.0',
osgi : '6.0.0',
felixFramework : '5.6.10',
ahc : '2.4.9',
acme : '2.3',
checkerQual : '2.5.2',
guava : '27.0-jre',
kotlin : '1.3.21',
tuprolog : '3.3.0',
log4j : '2.6.2',
junit4 : '4.12',
mapdb : '3.0.7',
// must be consistent with jnr-ffi version in jnr-unixsocket-wrapper
jnrunix : '0.22',
protobuf : protobuf_version,
httpcore : '4.4.11',
httpclient : '4.5.7',
// it seems not all jetty components are in our BOM so we need to specify it here as well
jetty : '9.4.18.v20190429',
// we will pull in a newer version of jackson because of security fixes
jackson : '2.9.8',
// needed for rat-repository, should be seperated
jersey : '2.26',
mockito : '1.10.19',
// for OSGi integration tests
paxExam : '4.6.0'
]
configurations {
// just to make bills of materials (bom) easier to see in the dependency tree
bom
// Configuration for dependencies that will be provided through features in the OSGi environment
providedByFeature
// Configurations for dependencies that will be provided through bundles in the OSGi environment
// Separate configurations are required when two bundles depend on different versions of the same bundle!
providedByBundle
unixSocketBundle
infomodelBundle
// Configurations for bundles grouped to dedicated features apart from the main ids feature
influxFeature
zmqFeature
// OSGi core dependencies which will just be there during runtime
osgiCore
// For artifacts that should be included as "compile" dependencies into published maven artifacts
publishCompile
// The "compile" configuration needs to be extended for dependency resolution of maven-publish
compile.extendsFrom providedByFeature, providedByBundle, unixSocketBundle, infomodelBundle, osgiCore, publishCompile
// Some compileOnly dependencies are also needed for unit tests
testImplementation.extendsFrom compileOnly
}
}
subprojects {
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
test {
exclude '**/*IT.*'
}
task integrationTest(type: Test) {
include '**/*IT.*'
systemProperty "project.version", "$project.version"
}
check.dependsOn integrationTest
// define some Bill of Materials (BOM) for all subprojects
dependencies {
// BOM from Karaf, sets common version for OSGi libraries
bom group: 'org.apache.karaf', name: 'karaf', version: libraryVersions.karaf
// BOM for pax, for jetty, etc.
bom group: 'org.ops4j.pax', name: 'web', version: libraryVersions.pax
// Required for successful build with JDK 11
compileOnly group: "javax.xml.bind", name: "jaxb-api", version: libraryVersions.jaxb
compileOnly group: "com.sun.xml.bind", name: "jaxb-core", version: libraryVersions.jaxb
compileOnly group: "com.sun.xml.bind", name: "jaxb-impl", version: libraryVersions.jaxb
testImplementation group: "javax.xml.bind", name: "jaxb-api", version: libraryVersions.jaxb
testImplementation group: "com.sun.xml.bind", name: "jaxb-core", version: libraryVersions.jaxb
testImplementation group: "com.sun.xml.bind", name: "jaxb-impl", version: libraryVersions.jaxb
testImplementation group: 'com.sun.activation', name: 'javax.activation', version: '1.2.0'
testImplementation "org.ops4j.pax.exam:pax-exam-container-karaf:${libraryVersions.paxExam}"
testImplementation "org.ops4j.pax.exam:pax-exam-junit4:${libraryVersions.paxExam}"
testImplementation "org.ops4j.pax.exam:pax-exam:${libraryVersions.paxExam}"
testImplementation "org.ops4j.pax.url:pax-url-aether:2.4.3"
testImplementation "javax.inject:javax.inject:1"
testImplementation "org.slf4j:slf4j-simple:1.7.12"
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Jar) {
jar {
manifest {
// set the vendor
attributes 'Bundle-Vendor': 'Fraunhofer AISEC'
// TODO: this was set in most of the bnd files. do we really need this?
attributes '-noee': true
}
}
}
repositories {
mavenCentral()
jcenter()
// References IAIS repository that contains the infomodel artifacts
maven {
url 'https://maven.iais.fraunhofer.de/artifactory/eis-ids-public/'
}
}
}
configure(subprojects.findAll { it.name != 'examples' }) {
apply plugin: 'com.diffplug.gradle.spotless'
spotless {
java {
enforceCheck = false // do not really check for now, we first need to format all the files
googleJavaFormat()
licenseHeader('''/*-
* ========================LICENSE_START=================================
* ''' + project.name + '''
* %%
* Copyright (C) $YEAR Fraunhofer AISEC
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =========================LICENSE_END==================================
*/''').yearSeparator(' - ')
}
}
}
configure(subprojects.findAll { it.name == 'ids-api' || it.name == 'ids-comm' }) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
from ('src/main') {
include 'proto/**'
}
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
idsLibrary(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'IDSCP Protocol Library'
description = 'Contains the WebSocket-based Industrial Data Space Communication Protocol (IDSCP)'
url = 'https://github.com/industrial-data-space/trusted-connector'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Michael Lux'
email = '[email protected]'
organization = 'Fraunhofer AISEC'
organizationUrl = 'aisec.fraunhofer.de'
}
}
scm {
connection = 'scm:git:git://github.com:industrial-data-space/trusted-connector.git'
developerConnection = 'scm:git:ssh://github.com:industrial-data-space/trusted-connector.git'
url = 'https://github.com/industrial-data-space/trusted-connector'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = project.findProperty('deployUsername')
password = project.findProperty('deployPassword')
}
}
}
}
signing {
useGpgCmd()
sign publishing.publications.idsLibrary
}
}