@@ -2,7 +2,7 @@ plugins {
22 id ' application'
33 id ' jacoco'
44 id ' org.ajoberstar.grgit' version ' 4.1.1'
5- id ' org.graalvm.buildtools.native' version " 0.10.6"
5+ id ' org.graalvm.buildtools.native' version ' 0.10.6'
66}
77
88// TODO BUILD look into GraalVM native compilation vs. dockerizing kb-sdk
@@ -22,11 +22,11 @@ group = 'us.kbase.sdk'
2222repositories {
2323 mavenCentral()
2424 maven { // for syslog4j
25- name = " Clojars"
26- url = " https://repo.clojars.org/"
25+ name = ' Clojars'
26+ url = ' https://repo.clojars.org/'
2727 }
2828 maven {
29- name = " Jitpack"
29+ name = ' Jitpack'
3030 url = ' https://jitpack.io'
3131 }
3232}
@@ -66,7 +66,7 @@ task kb_sdk_plusScript {
6666 }
6767
6868 def buildjar = " $buildDir /libs/${ project.name} .jar"
69- def classpath = buildjar + " : " + dependencies. join(' :' )
69+ def classpath = buildjar + ' : ' + dependencies. join(' :' )
7070
7171 def scriptContent = """ #!/bin/sh
7272
@@ -86,7 +86,7 @@ task prepareRunnableDir {
8686 // Note requires bash vs just sh
8787 dependsOn jar
8888 def runnableDir = file(" $buildDir /runnable" )
89- def runnerScript = new File (runnableDir, " kb-sdk" )
89+ def runnerScript = new File (runnableDir, ' kb-sdk' )
9090
9191 doFirst {
9292 // Clean and recreate runnable dir
@@ -135,11 +135,24 @@ task pythonTest(type: Exec) {
135135 }
136136}
137137
138+ // this is used in TypeGeneratorTest to supply dependencies for compiler tests
139+ def genCodeLibDir = file(" $buildDir /generated-code-libs" )
140+
141+ task resolveGeneratedCodeDeps {
142+ outputs. dir genCodeLibDir
143+ doLast {
144+ copy {
145+ from configurations. generatedCodeClasspath
146+ into genCodeLibDir
147+ }
148+ }
149+ }
150+
138151test {
152+ dependsOn resolveGeneratedCodeDeps
139153 dependsOn kb_sdk_plusScript // tests use script to compile sdk modules
140154 dependsOn pythonTest
141155
142- maxHeapSize = " 3G"
143156 testLogging {
144157 exceptionFormat = ' full'
145158 showStandardStreams = true
@@ -158,10 +171,10 @@ jacocoTestReport {
158171 classDirectories. setFrom(
159172 files(classDirectories. files. collect {
160173 fileTree(dir : it, exclude : [
161- " **/common/executionengine/**" ,
162- " **/common/service/**" ,
163- " **/catalog/**" ,
164- " **/narrativemethodstore/**" ,
174+ ' **/common/executionengine/**' ,
175+ ' **/common/service/**' ,
176+ ' **/catalog/**' ,
177+ ' **/narrativemethodstore/**' ,
165178 ])
166179 })
167180 )
@@ -171,10 +184,12 @@ jacocoTestReport {
171184// TODO BUILD the other script tasks could possibly be made simpler with some of the
172185// variables in this task
173186tasks. register(' generateNativeAgentScript' ) {
174- description = " Generates a script to run the application with GraalVM native-image-agent. " +
175- " Will init and test an SDK app called 'testapp', so run this in a location where " +
176- " creating that directory is safe."
177- group = " native-image"
187+ description = """
188+ Generates a script to run the application with the GraalVM native-image-agent.
189+ Will init and test an SDK app called 'testapp', so run this in a location where
190+ creating that directory is safe.
191+ """
192+ group = ' native-image'
178193
179194 dependsOn jar
180195
@@ -257,13 +272,13 @@ echo "Edit manually if necessary."
257272
258273graalvmNative {
259274 binaries {
260- named(" main" ) {
261- imageName. set(" kb-sdk" )
275+ named(' main' ) {
276+ imageName. set(' kb-sdk' )
262277 // Don't fall back to a jar based build
263278 buildArgs. addAll([
264- " --no-fallback" ,
265- " --enable-url-protocols=https,http" ,
266- " -H:+AddAllCharsets"
279+ ' --no-fallback' ,
280+ ' --enable-url-protocols=https,http' ,
281+ ' -H:+AddAllCharsets'
267282 ])
268283 }
269284 }
@@ -272,6 +287,8 @@ graalvmNative {
272287configurations {
273288 // can't directly access testImplementation, so extend and access
274289 testimpl. extendsFrom testImplementation
290+ // isolate the sdk generated code dependencies from the standard dependencies
291+ generatedCodeClasspath
275292}
276293
277294configurations. all {
@@ -288,10 +305,10 @@ dependencies {
288305 annotationProcessor ' info.picocli:picocli-codegen:4.7.7'
289306 compileOnly ' javax.servlet:servlet-api:2.5'
290307
291- implementation(" com.github.kbase:auth2_client_java:0.5.0" ) {
308+ implementation(' com.github.kbase:auth2_client_java:0.5.0' ) {
292309 exclude group : ' com.fasterxml.jackson.core' // don't upgrade yet, breaks tests
293310 }
294- implementation(" com.github.kbase:java_common:0.3.1" ) {
311+ implementation(' com.github.kbase:java_common:0.3.1' ) {
295312 exclude group : ' com.fasterxml.jackson.core' // don't upgrade yet, breaks tests
296313 exclude group : ' net.java.dev.jna' // don't include in runtime path
297314 }
@@ -302,8 +319,8 @@ dependencies {
302319 exclude group : ' com.fasterxml.jackson.core' // don't upgrade yet, breaks tests
303320 exclude group : ' net.java.dev.jna' // don't include in runtime path
304321 }
305- implementation " com.fasterxml.jackson.core:jackson-annotations:2.2.3"
306- implementation " com.fasterxml.jackson.core:jackson-databind:2.2.3"
322+ implementation ' com.fasterxml.jackson.core:jackson-annotations:2.2.3'
323+ implementation ' com.fasterxml.jackson.core:jackson-databind:2.2.3'
307324 implementation ' com.google.guava:guava:18.0'
308325 implementation ' com.googlecode.jsonschema2pojo:jsonschema2pojo-core:0.3.6'
309326 implementation(' com.j2html:j2html:0.7' ) {
@@ -334,7 +351,7 @@ dependencies {
334351 // abandonware and has a ton of CVEs, even in the newer versions.
335352 // Note that the java SDK modules use syslog4j, so we'll need to figure something out
336353 // there. I doubt any of the apps actually use the logging code that triggers it though
337- implementation " org.syslog4j:syslog4j:0.9.46"
354+ implementation ' org.syslog4j:syslog4j:0.9.46'
338355
339356 // needed for syslog4j. Used in java test modules and JsonServerServlet subclasses in tests
340357 // but not in SDK code proper.
@@ -345,6 +362,29 @@ dependencies {
345362 }
346363 testImplementation ' junit:junit:4.12'
347364 testImplementation ' org.hamcrest:hamcrest-core:1.3'
365+
366+ // isolate the sdk generated code dependencies from the standard dependencies
367+
368+ generatedCodeClasspath ' ch.qos.logback:logback-classic:1.1.2'
369+ generatedCodeClasspath ' com.fasterxml.jackson.core:jackson-annotations:2.2.3'
370+ generatedCodeClasspath ' com.fasterxml.jackson.core:jackson-databind:2.2.3'
371+ generatedCodeClasspath(' com.github.kbase:auth2_client_java:0.5.0' ) {
372+ exclude group : ' com.fasterxml.jackson.core' // don't upgrade yet, breaks tests
373+ }
374+ generatedCodeClasspath(' com.github.kbase:java_common:0.3.1' ) {
375+ exclude group : ' com.fasterxml.jackson.core' // don't upgrade yet, breaks tests
376+ exclude group : ' net.java.dev.jna' // don't include in test path
377+ }
378+ generatedCodeClasspath ' javax.annotation:javax.annotation-api:1.3.2'
379+ generatedCodeClasspath ' javax.servlet:servlet-api:2.5'
380+ generatedCodeClasspath ' joda-time:joda-time:2.2'
381+ generatedCodeClasspath ' junit:junit:4.12'
382+ generatedCodeClasspath ' net.java.dev.jna:jna:3.4.0'
383+ generatedCodeClasspath ' org.eclipse.jetty.aggregate:jetty-all:7.0.0.v20091005'
384+ generatedCodeClasspath ' org.hamcrest:hamcrest-core:1.3'
385+ generatedCodeClasspath ' org.ini4j:ini4j:0.5.2'
386+ generatedCodeClasspath ' org.syslog4j:syslog4j:0.9.46'
387+ generatedCodeClasspath ' org.slf4j:slf4j-api:1.7.7'
348388}
349389
350390task showTestClassPath {
0 commit comments