-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.gradle
209 lines (184 loc) · 6.34 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
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'java'
id 'war'
id 'jacoco'
}
group = 'com.github.kbase'
var VER_JAVA_COMMON = "0.3.0"
var VER_AUTH2_CLIENT = "0.5.0"
var DEFAULT_URL = "https://ci.kbase.us/services/narrative_method_store/rpc"
var LOC_NMS_SPEC = "$rootDir/NarrativeMethodStore.spec"
var LOC_DOC_HTML = "$rootDir/docshtml"
repositories {
mavenCentral()
maven {
name = "Jitpack"
url = 'https://jitpack.io'
}
maven {
name = "Clojars"
url = "https://repo.clojars.org/"
}
}
compileJava {
// TODO BUILD remove when we no longer support java 8, use `options.release = 11` if needed
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
}
javadoc {
/* We don't actually need the full javadoc for anything, so just hijack this task for
* building the client javadocs. If we ever need the full javadocs make a new task for the
* client java docs
*/
failOnError = false // fixing this would be a lot of work
options {
// I don't know why this isn't working, but it's not worth spending time on right now
links "https://docs.oracle.com/javase/8/docs/api/"
links "https://javadoc.jitpack.io/com/github/kbase/auth2_client_java/$VER_AUTH2_CLIENT/javadoc/"
links "https://javadoc.jitpack.io/com/github/kbase/java_common/$VER_JAVA_COMMON/javadoc/"
}
include "**/narrativemethodstore/*.java"
exclude "**/narrativemethodstore/NarrativeMethodStoreServer.java"
exclude "**/narrativemethodstore/ImageServlet.java"
include "**/common/service/Tuple*.java"
}
test {
/*
* TODO TEST Figure out why tests fail without this and remove. Might have something to do
* with the stfuLoggers() call in many of the tests, might kill logging for tests that
* require it
* Although it seems to make Mongo start up correctly as well which is odd
*/
forkEvery = 1
systemProperty "test.cfg", "./test.cfg"
testLogging {
exceptionFormat = 'full'
showStandardStreams = true
}
finalizedBy jacocoTestReport
}
// TODO TEST add a test that starts the server in a docker container and checks some simple cmds
jacocoTestReport {
reports {
xml.required = true
csv.required = true
}
}
jar {
// Much like javadoc, we hijack this task to build the client jar, since we don't need
// a service jar
include "us/kbase/narrativemethodstore/*.class"
exclude "us/kbase/narrativemethodstore/NarrativeMethodStoreServer*.class" // exclude anonymous classes
exclude "us/kbase/narrativemethodstore/ImageServlet*.class" // exclude anonymous classes
include "us/kbase/common/service/Tuple*.class"
archiveAppendix = 'client'
}
war {
webXml = file('war/web.xml')
}
/* SDK compile notes:
* kb-sdk starts a docker container in interactive mode. Gradle's commandLine doesn't allocate
* a tty so the command fails.
* I tried using a ProcessBuilder and
* https://docs.oracle.com/en%2Fjava%2Fjavase%2F11%2Fdocs%2Fapi%2F%2F/java.base/java/lang/ProcessBuilder.html#inheritIO()
* but that failed also with no useful output.
*
* The current solution is to precede the kb-sdk call with a script call, which either
* allocates a tty or fools kb-sdk into thinking there is one - not quite sure.
* https://man7.org/linux/man-pages/man1/script.1.html
* I tried to redirect the script log file to /dev/null with -O and --log-out but script didn't
* recognize either option, hence the delete.
*
* This is, generally speaking, a janky mess and if someone can find a better way to do this
* that'd be fantastic.
*/
var LOC_SCRIPT_TYPESCRIPT = "$rootDir/typescript"
// TODO GRADLE is there some way to DRY these 3 compile tasks up? Not a huge deal
task sdkCompileHTML {
// We want to check in the HTML so we don't put it in the build dir
var cmd = "kb-sdk compile --html --out $LOC_DOC_HTML $LOC_NMS_SPEC"
doLast {
exec {
commandLine "script", "-qefc", cmd
}
delete LOC_SCRIPT_TYPESCRIPT
}
}
task sdkCompileLibs {
var cmd = "kb-sdk compile " +
"--out lib " +
"--jsclname javascript/NarrativeMethodStore/Client " +
"--plclname Bio::KBase::NarrativeMethodStore::Client " +
"--pyclname biokbase.narrative_method_store.client " +
"--url $DEFAULT_URL " +
LOC_NMS_SPEC
doLast {
exec {
commandLine "script", "-qefc", cmd
}
delete LOC_SCRIPT_TYPESCRIPT
delete "$rootDir/lib/biokbase/narrative_method_store/authclient.py"
}
}
task sdkCompileJava {
// TODO GRADLE is there a variable for src/main/java?
var cmd = "kb-sdk compile " +
"--java " +
"--javasrc $rootDir/src/main/java " +
"--javasrv " +
"--out . " +
"--url $DEFAULT_URL " +
LOC_NMS_SPEC
doLast {
exec {
commandLine "script", "-qefc", cmd
}
delete LOC_SCRIPT_TYPESCRIPT
}
}
task sdkCompile {
dependsOn sdkCompileHTML
dependsOn sdkCompileJava
dependsOn sdkCompileLibs
}
configurations {
// can't directly access testImplementation, so extend and access
testimpl.extendsFrom testImplementation
}
dependencies {
implementation("com.github.kbase:auth2_client_java:$VER_AUTH2_CLIENT") {
exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade
}
implementation("com.github.kbase:java_common:$VER_JAVA_COMMON") {
exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade
}
implementation 'org.ini4j:ini4j:0.5.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
implementation 'org.mongodb:mongodb-driver-core:4.11.1'
implementation 'org.mongodb:mongodb-driver-sync:4.11.1'
implementation 'org.mongodb:bson-record-codec:4.11.1'
implementation 'org.mongodb:bson:4.11.1'
implementation 'org.yaml:snakeyaml:1.11'
implementation 'org.apache.velocity:velocity:1.7'
implementation 'commons-io:commons-io:2.4'
implementation 'com.google.guava:guava:14.0.1'
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation 'javax.servlet:servlet-api:2.5'
// this is OOOOOOLD. But that probably means updating java_common
implementation 'org.eclipse.jetty.aggregate:jetty-all:7.0.0.v20091005'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.0.0'
testImplementation 'org.apache.commons:commons-lang3:3.5'
testImplementation('com.github.kbase:java_test_utilities:0.1.0') {
exclude group: 'com.fasterxml.jackson.core' // upgrading breaks stuff
}
}
task showTestClassPath {
doLast {
configurations.testimpl.each { println it }
}
}