-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from Ant to Gradle #389
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
id 'java' | ||
id 'war' | ||
id 'jacoco' | ||
id 'org.ajoberstar.grgit' version '4.1.1' | ||
} | ||
|
||
// TODO NOW run tests from Eclipse w/o specifying classpath manually & remove sourceSets & classpath | ||
// TODO NOW update any ant refs in docs to gradle | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
task buildGitCommitFile { | ||
doLast { | ||
def commitId = grgit.head().id | ||
// is there a variable for builddir/classes/java/main? | ||
file("$buildDir/classes/java/main/us/kbase/groups/gitcommit").text = commitId | ||
} | ||
} | ||
Comment on lines
+19
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What benefits do we get for saving a commit in a file? Verification? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That commit winds up here: https://ci.kbase.us/services/groups/ so you know what code the server is running |
||
|
||
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 | ||
finalizedBy buildGitCommitFile | ||
} | ||
|
||
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 | ||
/* | ||
* TODO TEST split mongo wrapper tests out. | ||
* Set up GHA to run the full test suite with a single version of mongo and run the | ||
* mongo tests with matrixed mongo versions. | ||
* Since the tests only take a minute or two this isn't high ROI. | ||
*/ | ||
systemProperty "KBASE_GROUPS_TEST_CONFIG", "./test.cfg" | ||
maxHeapSize = "3G" | ||
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 | ||
} | ||
} | ||
|
||
war { | ||
webXml = file('war/web.xml') | ||
} | ||
|
||
// Custom java project layout | ||
sourceSets { | ||
main { | ||
java { | ||
srcDirs = ["src"] | ||
exclude '**/test/**' | ||
} | ||
} | ||
test { | ||
java { | ||
srcDirs = ["src"] | ||
include '**/test/**' | ||
} | ||
resources { | ||
srcDirs = ["src"] | ||
include "**/*wsjars" | ||
} | ||
} | ||
} | ||
|
||
configurations { | ||
// can't directly access testImplementation, so extend and access | ||
testimpl.extendsFrom testImplementation | ||
} | ||
|
||
def fromURL = { url, name -> | ||
File file = new File("$buildDir/download/${name}.jar") | ||
file.parentFile.mkdirs() | ||
if (!file.exists()) { | ||
new URL(url).withInputStream { downloadStream -> | ||
file.withOutputStream { fileOut -> | ||
fileOut << downloadStream | ||
} | ||
} | ||
} | ||
files(file.absolutePath) | ||
} | ||
|
||
dependencies { | ||
|
||
compileOnly 'javax.servlet:javax.servlet-api:3.0.1' | ||
|
||
implementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/auth/kbase-auth-0.4.4.jar', | ||
'kbase-auth-0.4.4' | ||
) | ||
implementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/workspace/WorkspaceClient-0.8.0.jar', | ||
'WorkspaceClient-0.8.0' | ||
) | ||
implementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/catalog/kbase-catalog-client-2.1.3.jar', | ||
'kbase-catalog-client-2.1.3' | ||
) | ||
implementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/common/kbase-common-0.0.25.jar', | ||
'kbase-common-0.0.25' | ||
) | ||
// Pull from jars repo vs a maven repository to avoid the JNA dependency | ||
// TODO DEPS Need to rework the java common logger to not use syslog4j at all since it's abandonware | ||
// and has a ton of CVEs, even in the newer versions. | ||
implementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/syslog4j/syslog4j-0.9.46.jar', | ||
'syslog4j-0.9.46' | ||
) | ||
implementation 'ch.qos.logback:logback-classic:1.1.2' | ||
implementation 'org.ini4j:ini4j:0.5.2' | ||
implementation 'org.mongodb:mongo-java-driver:3.8.2' | ||
implementation 'org.apache.kafka:kafka-clients:2.1.0' | ||
implementation 'com.google.guava:guava:18.0' | ||
implementation 'org.slf4j:slf4j-api:1.7.25' | ||
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.4' | ||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.5.4' | ||
implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.23.2' | ||
implementation 'org.glassfish.jersey.media:jersey-media-json-jackson:2.23.2' | ||
implementation 'com.github.zafarkhaja:java-semver:0.9.0' | ||
|
||
testImplementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/auth2/kbase-auth2-test-shadow-all-0.7.0.jar', | ||
'kbase-auth2-test-shadow-all-0.7.0' | ||
) | ||
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10' | ||
testImplementation 'junit:junit:4.12' | ||
testImplementation 'org.mockito:mockito-core:3.0.0' | ||
testImplementation('org.mock-server:mockserver-netty:5.4.1') { | ||
// otherwise a newer jackson implementation is brought in and tests make a poo poo | ||
// TODO BUILD on upgrade switch to the no dependencies version | ||
exclude group: "com.fasterxml.jackson.core" | ||
} | ||
testImplementation 'org.eclipse.jetty:jetty-servlet:9.3.11.v20160721' | ||
} | ||
|
||
task showTestClassPath { | ||
doLast { | ||
configurations.testimpl.each { println it } | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run: ./gradlew test
is sufficient? Probably don't needgradle_test: 'test'
unless I am missing something important.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for now, but it's a placeholder in case we ever split out the mongo tests as noted in a TODO earlier in the file IIRC