-
Notifications
You must be signed in to change notification settings - Fork 55
/
build.gradle
542 lines (442 loc) · 20.1 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
//Import required to format the license report plugin
import com.github.jk1.license.render.*
import com.github.jk1.license.filter.*
buildscript {
repositories {
if (project.hasProperty('local')) mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'http://repository.activeeon.com/content/groups/proactive/' }
maven { url "http://nexus.qmino.com/content/repositories/miredot" }
maven { url "https://repo.jenkins-ci.org/releases/" }
}
dependencies {
classpath "org.objectweb.proactive:programming-build-utils:${programmingVersion}"
// needed at runtime by AntStubGenerator...
classpath("org.objectweb.proactive:programming-core:${programmingVersion}")
classpath('org.hsudbrock:gradle-trang:0.1-proactive') {
exclude group: 'xml-apis', module: 'xml-apis'
}
classpath 'com.github.rholder:gradle-one-jar:1.0.3'
classpath 'org.ow2.proactive:gradle-serialver:2.2'
classpath 'org.ow2.proactive:gradle-max-nodes-number:0.2'
classpath 'org.postgresql:postgresql:9.3-1102-jdbc41'
classpath 'org.ajoberstar:gradle-jacoco:0.3.0'
classpath('org.gradle.api.plugins:gradle-format-plugin:1.1') {
exclude group: 'javassist', module: 'javassist'
}
classpath 'com.qmino:miredot-plugin:2.2'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
classpath "com.diffplug.gradle.spotless:spotless:2.4.0"
classpath "org.ow2.proactive:coding-rules:1.0.0"
classpath 'com.github.jk1:gradle-license-report:1.9'
classpath "gradle.plugin.net.ossindex:ossindex-gradle-plugin:0.4.11"
delete "gradle/ext"
ant.unjar src: configurations.classpath.find { it.name.startsWith("coding-rules") }, dest: 'gradle/ext'
}
}
logging.captureStandardOutput(LogLevel.DEBUG)
//logging {
// file ('build.log', LogLevel.DEBUG)
// console (LogLevel.INFO)
//}
def fileLogger = [
onOutput : {
File logfile = new File( 'gradle.log' )
logfile << it
}
] as org.gradle.api.logging.StandardOutputListener
allprojects { logging.addStandardOutputListener( fileLogger ) }
def isWindows = System.properties['os.name'].toLowerCase().contains('windows')
def custom ={ "$rootDir/gradle/${it}.gradle"}
apply plugin: 'java'
apply plugin: 'org.sonarqube'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: 'net.ossindex.audit'
apply from: "$rootDir/gradle/ext/coding-format.gradle"
archivesBaseName = 'scheduling' // in case current folder is not named scheduling
project.ext.set('nativeLibsDir', "$rootDir/dist/lib/")
project.ext.set('schedulingParentFolder', "$rootDir")
apply from: custom("sonar-scheduling")
apply from: custom("jacoco-scheduling")
configurations {
nativeBundle
restCli
distLib {
extendsFrom restCli
}
}
allprojects {
apply plugin: 'maven'
apply plugin: 'project-report'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: 'net.ossindex.audit'
group = 'org.ow2.proactive'
version = schedulingVersion
if (project.hasProperty('ci')) {
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
configurations.all {
resolutionStrategy.force "org.ow2.proactive:scheduler-api:${schedulingVersion}"
}
rootProject.buildscript.repositories.each {
repositories.add(it)
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(url: "http://repository.activeeon.com/content/repositories/snapshots/") {
authentication(userName: "${System.getProperty('nexusUsername')}",
password: "${System.getProperty('nexusPassword')}")
}
repository(url: "http://repository.activeeon.com/content/repositories/releases/") {
authentication(userName: "${System.getProperty('nexusUsername')}",
password: "${System.getProperty('nexusPassword')}")
}
}
}
}
licenseReport {
configurations = ['runtime']
excludeGroups = ['org.objectweb.proactive','jsr223']
filters = [new LicenseBundleNormalizer(bundlePath: "$rootDir/config/report/license-normalizer-bundle.json")]
renderers = [new InventoryHtmlReportRenderer()]
}
}
ext.javaSubprojects = subprojects.findAll { new File(it.projectDir, "src").exists() }
ext.serialver = schedulingSerialver
configure(javaSubprojects) {
apply plugin: 'java'
apply plugin: 'format'
apply plugin: 'jacoco'
apply plugin: 'net.ossindex.audit'
apply from: custom("jacoco-scheduling")
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.compilerArgs << '-Xlint:-options' // remove warning about bootstrap class path
dependencies {
compile 'ch.qos.reload4j:reload4j:1.2.25'
compile ('log4j:apache-log4j-extras:1.2.17') {
exclude group: 'log4j', module: 'log4j'
}
compile 'com.google.guava:guava:32.0.1-jre'
runtime 'org.slf4j:slf4j-reload4j:1.7.36'
testCompile 'com.google.truth:truth:0.30'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'ObjectFaker:ObjectFaker:0.4'
testCompile 'com.jayway.awaitility:awaitility:1.6.0'
testCompile 'org.apache.commons:commons-lang3:3.4'
testCompile 'org.postgresql:postgresql:42.0.0'
testCompile 'mysql:mysql-connector-java:8.0.18'
testCompile 'com.microsoft.sqlserver:mssql-jdbc:7.1.2.jre8-preview'
}
test {
exclude 'functionaltests/**'
exclude 'unittests/**'
exclude 'unitTests/**'
exclude 'performancetests/**'
if(Boolean.valueOf(System.getProperty("java.awt.headless"))){
exclude 'org/ow2/proactive_grid_cloud_portal/cli/**'
}
// uncomment the following to enable the security manager
//systemProperties << ['java.security.manager' : 'java.lang.SecurityManager']
systemProperties << ['java.security.policy': file("$rootDir/config/security.java.policy-server").absolutePath]
systemProperties << ['file.encoding': 'UTF-8']
systemProperties << ['pa.rm.home': rootDir.absolutePath]
}
task serialver(type: serialver.InsertSerialVersionUIDTask) {
serialver = rootProject.serialver
overwrite = false
forceUIDOnException = true
}
format {
configurationFile = file("$rootDir/eclipse_formatter_config.xml")
}
jar {
manifest {
attributes("Implementation-Title": "ProActive",
"Implementation-Version": version,
"Specification-Version": version,
"Implementation-Vendor": "Activeeon - OASIS - INRIA Sophia Antipolis",
"Implementation-URL": "http://proactive.inria.fr"
)
}
}
audit {
failOnError = false
rateLimitAsError = false
cache = System.getProperty("java.io.tmpdir") + File.separator + "ossindex.cache"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.13' //version required
}
ext.schedulingFunctionalTestConfiguration = {
include 'functionaltests/StandardTestSuite*'
if(project.hasProperty('regression')){
include 'functionaltests/RegressionTestSuite*'
}
systemProperties << ['proactive.home': rootDir.absolutePath]
systemProperties << ['pa.rm.home': rootDir.absolutePath]
systemProperties << ['pa.scheduler.home': rootDir.absolutePath]
systemProperties << ['proactive.communication.protocol': 'pnp']
systemProperties << ['proactive.test.timeout': 800000]
systemProperties << ['java.awt.headless': 'true']
systemProperties << ['java.library.path': project.nativeLibsDir]
systemProperties << ['java.security.policy': file("$rootDir/config/security.java.policy-server").absolutePath]
systemProperties << ['file.encoding': 'UTF-8']
if (project.hasProperty('runasme.user')) {
systemProperties << ['runasme.user': project.property('runasme.user')]
}
if (project.hasProperty('runasme.pwd')) {
systemProperties << ['runasme.pwd': project.property('runasme.pwd')]
}
if (project.hasProperty('runasme.key.path')) {
systemProperties << ['runasme.key.path': project.property('runasme.key.path')]
}
if (project.hasProperty('runasme.shared.dir')) {
systemProperties << ['runasme.shared.dir': project.property('runasme.shared.dir')]
}
testLogging {
exceptionFormat = 'full'
}
beforeTest { descriptor ->
logger.lifecycle("Running: " + descriptor)
}
def createRunAsMeUser = {
if (project.hasProperty('runasme.user') && project.hasProperty('runasme.pwd')) {
def extension = isWindows ? ".bat" : ""
def pb = new java.lang.ProcessBuilder()
pb.inheritIO()
pb.command(new File(project.rootDir.getAbsoluteFile(), "tools/proactive-users" + extension).getAbsolutePath(), "-C", "-l", project.property('runasme.user'), "-p", project.property('runasme.pwd'), "-g", "user")
def process = pb.start()
process.waitFor();
}
}
def copySchedulingToSharedDirOnWindows = {
if (System.properties['os.name'].toLowerCase().contains('windows') && project.hasProperty('runasme.shared.dir')) {
project.copy {
from project.rootDir
into project.property('runasme.shared.dir')
include "dist/lib/*"
include "dist/script/**"
include "config/**"
}
}
}
def clean = {
println project.nativeLibsDir
if (project.hasProperty('runasme.user')) {
def extension = isWindows ? ".bat" : ""
def pb = new java.lang.ProcessBuilder()
pb.inheritIO()
pb.command(new File(project.rootDir.getAbsoluteFile(), "tools/proactive-users" + extension).getAbsolutePath(), "-D", "-l", project.property('runasme.user'))
def process = pb.start()
process.waitFor();
}
project.javaexec {
main = "org.ow2.tests.ProcessCleaner"
classpath = fileTree(project.nativeLibsDir).include("*.jar") + project(':rm:rm-server').sourceSets.test.output
systemProperty "java.library.path", project.nativeLibsDir
}
}
finalizedBy project.task(project.name + '-clean', { doLast clean })
dependsOn project.task(project.name + '-beforetests') << {
clean(); createRunAsMeUser(); copySchedulingToSharedDirOnWindows()
}
}
ext.schedulingPerformanceTestConfiguration = {
include 'performancetests/PerformanceTestSuite*'
systemProperties << ['pa.rm.home': rootDir.absolutePath]
systemProperties << ['pa.scheduler.home': rootDir.absolutePath]
systemProperties << ['proactive.communication.protocol': 'pnp']
systemProperties << ['proactive.test.timeout': 800000]
systemProperties << ['java.awt.headless': 'true']
systemProperties << ['java.library.path': project.nativeLibsDir]
systemProperties << ['java.security.policy': file("$rootDir/config/security.java.policy-server").absolutePath]
systemProperties << ['file.encoding': 'UTF-8']
testLogging {
exceptionFormat = 'full'
}
beforeTest { descriptor ->
logger.lifecycle("Running: " + descriptor)
}
}
dependencies {
distLib(project(':scheduler:scheduler-server')) {
exclude group: 'javassist', module: 'javassist' // to avoid duplicate (artifact named differently)
}
distLib project('rm:rm-policy:rm-policy-scheduler')
distLib project(':scheduler:scheduler-node')
distLib project(':scheduler:scheduler-examples')
distLib project(':rm:rm-server')
distLib project(':rm:rm-node-updater')
distLib(project(':rest:rest-server')) {
exclude group: 'javassist', module: 'javassist' // to avoid duplicate (artifact named differently)
}
restCli project(':rest:rest-cli')
distLib project(':rest:rest-client')
distLib project(':rest:rest-smartproxy')
distLib project(':scheduler:scheduler-smartproxy')
nativeBundle 'org.jvnet.winp:winp:1.28-proactive:native'
nativeBundle 'sigar:sigar:1.7.0-proactive:native'
nativeBundle 'net.sf.jpam:libjpam:1.1-proactive:native'
nativeBundle 'jsr223:jsr223-powershell:0.2.3:native'
compile 'org.codehaus.groovy:groovy-all:2.4.21'
compile 'commons-io:commons-io:2.14.0'
}
task dist(type: Sync) {
from configurations.distLib
from configurations.runtime
from jar
[project(':scheduler:scheduler-server')].each {
from it.configurations.archives.artifacts.files.files
if (it.tasks.findByName('testJar')) {
from it.testJar.outputs
}
}
from {
configurations.nativeBundle.collect { zipTree(it) }
}
into file("$rootDir/dist/lib")
}
defaultTasks 'dist'
build.dependsOn 'dist'
task scripts
dist.dependsOn scripts
task cleanScripts
clean.dependsOn cleanScripts
class CustomCreateStartScripts extends CreateStartScripts {
//We override the generate() method because Gradle adds "lib/" in the classpath by default.
@Override
void generate() {
def generator = new org.gradle.api.internal.plugins.StartScriptGenerator()
generator.applicationName = getApplicationName()
generator.mainClassName = getMainClassName()
if (getApplicationName().equals("proactive-server")) {
generator.defaultJvmOpts = ["-server", "-Dfile.encoding=UTF-8", "-Dresteasy.allowGzip=true", "-Doracle.jdbc.useFetchSizeWithLongColumn=true", "-Xms4g"]
} else {
generator.defaultJvmOpts = ["-server", "-Dfile.encoding=UTF-8"]
}
generator.optsEnvironmentVar = getOptsEnvironmentVar()
generator.exitEnvironmentVar = getExitEnvironmentVar()
if (getApplicationName().equals("proactive-client")) {
generator.classpath = ["dist/lib/*"]
} else {
generator.classpath = ["dist/lib/*", "addons", "addons/*"]
}
generator.scriptRelPath = "bin/${getUnixScript().name}"
generator.windowsStartScriptGenerator.template = project.resources.text.fromFile("src/main/resources/org/gradle/api/internal/plugins/windowsStartScript.txt")
generator.unixStartScriptGenerator.template = project.resources.text.fromFile("src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt")
generator.generateUnixScript(getUnixScript())
generator.generateWindowsScript(getWindowsScript())
}
}
def createStartScripts(className, name, String outputFolder) {
def scriptTask = project.tasks.create(name: ('script' + name), type: CustomCreateStartScripts) {
mainClassName className
applicationName name
outputDir project.file("build/" + outputFolder)
classpath = project.configurations.distLib // will be replaced with CustomCreateStartScripts
}
scriptTask.doLast { // otherwise outputDir would get deleted by clean tasks
project.copy {
from project.file("build/" + outputFolder)
into project.file(outputFolder)
}
}
project.scripts.dependsOn scriptTask
project.cleanScripts.dependsOn 'cleanScript' + name
}
createStartScripts('org.ow2.proactive.scheduler.util.SchedulerStarter', 'proactive-server', 'bin')
createStartScripts('org.ow2.proactive_grid_cloud_portal.cli.CommonEntryPoint', 'proactive-client', 'bin')
createStartScripts('org.ow2.proactive.resourcemanager.utils.RMNodeStarter', 'proactive-node', 'bin')
createStartScripts('org.ow2.proactive.resourcemanager.updater.RMNodeUpdater', 'proactive-node-autoupdate', 'bin')
createStartScripts('org.objectweb.proactive.extensions.vfsprovider.console.PADataserverStarter', 'proactive-dataserver', 'tools')
createStartScripts('org.objectweb.proactive.extensions.vfsprovider.gui.ServerBrowser', 'proactive-dataserver-gui', 'tools')
createStartScripts('org.ow2.proactive.authentication.crypto.CreateCredentials', 'proactive-create-cred', 'tools')
createStartScripts('org.ow2.proactive.authentication.crypto.KeyGen', 'proactive-key-gen', 'tools')
createStartScripts('org.ow2.proactive.scheduler.authentication.ManageUsers', 'proactive-users', 'tools')
createStartScripts('org.ow2.proactive.scheduler.authentication.RegeneratePasswords', 'regenerate-passwords', 'tools')
createStartScripts('org.ow2.proactive.scheduler.util.EncryptCommand', 'encrypt', 'tools')
createStartScripts('org.ow2.proactive.scheduler.util.ChangeHttpConfiguration', 'configure-http', 'tools')
createStartScripts('org.ow2.proactive.scheduler.util.ChangeDBConfiguration', 'configure-db', 'tools')
createStartScripts('org.ow2.proactive.scheduler.authentication.ChangeLDAPConfiguration', 'configure-ldap', 'tools')
createStartScripts('org.ow2.proactive.scheduler.authentication.CopyRBACRole', 'copy-role', 'tools')
createStartScripts('org.ow2.proactive.utils.PAMRRouterStarter', 'proactive-router', 'bin')
subprojects {
tasks.withType(Test).matching { it.name == 'functionalTest' }*.dependsOn dist
tasks.withType(Test).matching { it.name == 'performanceTest' }*.dependsOn dist
}
subprojects {
task allDeps(type: DependencyReportTask) {}
}
apply plugin: 'distribution'
distributions {
main {
baseName project.archivesBaseName
contents {
from '.'
include "dist/**", "config/**", "bin/**", "samples/**", "addons/**", "LICENSE*", "README*", 'tools/**'
}
}
}
distZip.dependsOn dist
artifacts {
archives distZip
}
// credentials are generated during release process
def createGenerateCredentialTask(String name, List<String> cliArgs) {
project.tasks.create(name: ('generateCredentials' + name), type: JavaExec) {
classpath = project(':common:common-client').sourceSets.main.runtimeClasspath
main = 'org.ow2.proactive.authentication.crypto.CreateCredentials'
args = cliArgs
}
}
createGenerateCredentialTask('Rm', [ '-F', 'config/authentication/keys/pub.key',
'-l', 'rm', '-p', 'rm_pwd', '-o', 'config/authentication/rm.cred'])
createGenerateCredentialTask('Scheduler', ['-F', 'config/authentication/keys/pub.key',
'-l', 'scheduler', '-p', 'scheduler_pwd', '-o', 'config/authentication/scheduler.cred'])
createGenerateCredentialTask('Admin', ['-F', 'config/authentication/keys/pub.key',
'-l', 'admin', '-p', 'admin', '-o', 'config/authentication/admin_user.cred'])
task generateCredentials
generateCredentials.dependsOn generateCredentialsAdmin, generateCredentialsScheduler, generateCredentialsRm
def exportedProjects= [
":common:common-api",
":common:common-client",
":common:common-db",
":scheduler:scheduler-api",
":scheduler:scheduler-client",
":scheduler:scheduler-examples",
":scheduler:scheduler-node",
":scheduler:scheduler-smartproxy",
":scheduler:scheduler-smartproxy-common",
":rest:rest-api",
":rest:rest-client",
":rest:rest-smartproxy",
":rm:rm-api",
":rm:rm-client",
":rm:rm-server"
]
task alljavadoc(type: org.gradle.api.tasks.javadoc.Javadoc) {
source exportedProjects.collect { project(it).sourceSets.main.allJava }
classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })
destinationDir = file("${buildDir}/docs/javadoc")
configure(options) {
links = [
'https://docs.oracle.com/javase/8/docs/api/',
'https://docs.jboss.org/hibernate/orm/5.3/javadocs/',
'https://docs.jboss.org/hibernate/jpa/2.1/api/',
'https://docs.jboss.org/hibernate/jpa/2.2/api/'
]
}
}
task alljavadocZip(type: Zip, dependsOn: alljavadoc) {
from "${buildDir}/docs/javadoc"
archiveName project.archivesBaseName + '-' + project.version + '-javadoc.zip'
destinationDir file("${buildDir}/distributions")
}