forked from linkedin/parseq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
156 lines (135 loc) · 4.14 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
}
}
apply from: file("gradle/versioning.gradle")
allprojects { // for all projects including the root project
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'maven'
// TODO: remove this once we no longer need ivy publications (adds the "signatures" .ivy configuration)
apply plugin: 'signing'
version = rootProject.version
repositories {
mavenCentral()
mavenLocal()
}
}
idea {
project {
jdkName = '1.8.0_121'
languageLevel = '1.8'
}
}
subprojects {
if (!it.name.equals("parseq-tracevis")) {
apply plugin: 'java'
apply plugin: 'java-library'
sourceCompatibility = 1.8
targetCompatibility = 1.8
test {
useTestNG()
}
if (it.name.startsWith('parseq-') && !it.name.equals("parseq-lambda-names")) { // all contrib modules
dependencies {
compile project(":parseq")
}
}
// package jar
task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
classifier = 'javadoc'
}
task packageSources(type: Jar, dependsOn: 'classes') {
from sourceSets.main.allSource
classifier = 'sources'
}
// configure MANIFEST
// TODO: unnecessary and volatile attributes affect caching and should be removed
jar {
manifest {
attributes("Created-By": "Gradle",
"Version": version,
"Build-JDK": JavaVersion.current())
}
}
javadoc {
options.source = "8"
options.use = true
options.author = true
// TODO: update date to be dynamically set
options.bottom = "Copyright © 2018. All rights reserved."
options.classpath += file("${project.projectDir.absolutePath}/src/main/java")
options.links("https://docs.oracle.com/javase/8/docs/api/")
options.addStringOption("charset", "UTF-8")
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
}
// Don't include parseq-examples and parseq-legacy-examples, since we don't need to publish their jar files
afterEvaluate {
if (it.name.startsWith('parseq') && !it.name.endsWith('examples') && !it.name.endsWith('tracevis')) {
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}
}
}
}
task runTracevisServer (dependsOn:':parseq-tracevis-server:build') {
description 'Start trace visualization server for observing the execution of tasks.'
doLast {
// get dot path in local machine, before running this task, please install graphviz in your machine
try {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'which'
args = ["dot"]
standardOutput = os
}
ext.dotLocation = os.toString().trim()
}
} catch (Exception e) {
throw new Exception("Can not find dot tools, please install it or check the docLocation!")
}
def tracevisJar = "${projectDir}/subprojects/parseq-tracevis-server/build/libs/parseq-tracevis-server-" + version + '-jar-with-dependencies.jar'
File docFile = new File(dotLocation)
if (docFile.exists()) {
javaexec {
main="-jar"
args = [
tracevisJar,
dotLocation
]
}
} else {
logger.error('Can not find dot tools, please install it or check the docLocation!')
}
}
}
subprojects { p ->
if (!p.name.endsWith('examples')) {
p.afterEvaluate {
p.apply from: "$rootDir/gradle/publications.gradle"
}
p.apply from: "$rootDir/gradle/jfrog.gradle"
}
}
// TODO: remove once ivy publications are no longer required
// Clean the project's local ivy repo before publishing to prevent conflicts
project.tasks.uploadArchives.doFirst {
logger.lifecycle "Cleaning local ivy repo: $rootDir/build/ivy-repo"
delete(file("$rootDir/build/ivy-repo"))
}