-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from jgi-kbase/dev-gradle
Add Gradle and update dockerfile / docker-compose
- Loading branch information
Showing
26 changed files
with
551 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
/* | ||
* 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 switch to std gradle layout | ||
// TODO NOW use jitpacked workspace client and shadow jar when available and remove jars | ||
|
||
repositories { | ||
mavenCentral() | ||
|
||
maven { | ||
name = "Clojars" | ||
url = "https://repo.clojars.org/" | ||
} | ||
maven { | ||
name = "JitPack" | ||
url = 'https://jitpack.io' | ||
} | ||
} | ||
task buildGitCommitFile { | ||
doLast { | ||
def commitId = grgit.head().id | ||
// is there a variable for builddir/classes/java/main? | ||
file("$buildDir/classes/java/main/us/kbase/assemblyhomology/gitcommit").text = commitId | ||
} | ||
} | ||
|
||
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 tests into mongo wrapper tests & all other tests (incl. integration). | ||
* Set up GHA to run the non-mongo tests with a single version of mongo and run the | ||
* mongo tests with matrixed mongo versions. Combine coverage at the end somehow | ||
*/ | ||
systemProperty "ASSEMHOMOL_TEST_CONFIG", "./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 | ||
} | ||
} | ||
|
||
javadoc { | ||
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/" | ||
} | ||
} | ||
|
||
war { | ||
webXml = file('war/web.xml') | ||
} | ||
|
||
configurations { | ||
// can't directly access testImplementation, so extend and access | ||
testimpl.extendsFrom testImplementation | ||
} | ||
|
||
task generateCLIScript { | ||
dependsOn compileJava | ||
doLast { | ||
def dependencies = configurations.runtimeClasspath.collect { File file -> | ||
file.absolutePath | ||
} | ||
|
||
def classpath = dependencies.join(':') | ||
|
||
def scriptContent = """#!/bin/sh | ||
CLASSPATH=$classpath | ||
java -cp build/classes/java/main:\$CLASSPATH us.kbase.assemblyhomology.cli.AssemblyHomologyCLI \$@ | ||
""" | ||
|
||
file("$buildDir/assembly_homology").text = scriptContent | ||
file("$buildDir/assembly_homology").setExecutable(true) | ||
} | ||
} | ||
|
||
task buildAll { | ||
dependsOn generateCLIScript | ||
dependsOn war | ||
dependsOn javadoc | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDirs = ["src"] | ||
exclude '**/test/**' | ||
} | ||
} | ||
test { | ||
java { | ||
srcDirs = ["src"] | ||
include '**/test/**' | ||
} | ||
resources { | ||
srcDirs = ["src"] | ||
include "**/*.msh" | ||
include "**/*.txt" | ||
include "**/wsjars" | ||
} | ||
} | ||
} | ||
|
||
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 { | ||
|
||
implementation fromURL( | ||
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/workspace/WorkspaceService-0.8.0.jar', | ||
'WorkspaceService-0.8.0' | ||
) | ||
|
||
implementation 'org.ini4j:ini4j:0.5.2' | ||
implementation 'commons-io:commons-io:2.4' | ||
implementation 'com.beust:jcommander:1.72' | ||
implementation 'org.mongodb:mongo-java-driver:3.10.1' | ||
implementation 'com.google.guava:guava:18.0' | ||
implementation "com.github.kbase:auth2_client_java:0.5.0" | ||
implementation('com.github.kbase:java_common:0.3.0') { | ||
exclude group: 'net.java.dev.jna' // breaks mac builds, not needed | ||
exclude group: 'org.eclipse.jetty.aggregate' // ugh, java common pollutes everything | ||
exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade | ||
exclude group: 'javax.servlet', module: 'servlet-api' // 2.5 vs 3.1 below | ||
} | ||
implementation 'com.github.zafarkhaja:java-semver:0.9.0' | ||
implementation 'org.yaml:snakeyaml:1.18' | ||
implementation 'ch.qos.logback:logback-classic:1.1.2' | ||
implementation 'org.slf4j:slf4j-api:1.7.25' | ||
// 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 "org.syslog4j:syslog4j:0.9.46" | ||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.5.4' | ||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.4' | ||
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider: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 'javax.servlet:javax.servlet-api:3.0.1' | ||
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' | ||
|
||
testImplementation "com.github.kbase:auth2:0.7.1" | ||
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10' | ||
testImplementation 'junit:junit:4.12' | ||
testImplementation('org.eclipse.jetty:jetty-servlet:9.3.11.v20160721') { | ||
exclude group: "javax.servlet", module: "javax.servlet-api" // upgrading breaks tests | ||
} | ||
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 } | ||
} | ||
} |
Oops, something went wrong.