Skip to content

Commit

Permalink
Merge pull request #730 from kbase/dev-gradle2_upstream
Browse files Browse the repository at this point in the history
Build client jar
  • Loading branch information
MrCreosote authored Apr 17, 2024
2 parents b1bdb86 + d6f4fcb commit 19117a4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
fail-fast: false
matrix:
include:
- java: '11'
- java: '8' # needs to be compatible so jars can be used w/ java 8
mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4'
minio: '2019-05-23T00-29-34Z'
wired_tiger: 'true'
Expand Down
29 changes: 20 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var BUILD_OTHER_DOC_DIR = "$BUILD_DOC_ROOT/otherdoc/"
var IN_JAR_DOC_DIR = "/server_docs"
var IN_JAR_JAVA_DOC_DIR = "$IN_JAR_DOC_DIR/javadoc"

// TODO NOW client jar - commit 4
// TODO NOW schema updater script - commit 5
// TODO NOW sdk-compile all, java, and docs - commit 6
// TODO NOW handle the git commit the same way as auth does - commit 7
Expand All @@ -37,7 +36,10 @@ repositories {
mavenCentral()
}
compileJava {
options.release = 11
// build needs to be java 8 compatible so jars can be used in java 8 projects
// 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 {
Expand Down Expand Up @@ -140,6 +142,15 @@ task jacocoTestQuickReport(type: JacocoReport, dependsOn: testQuick) {
executionData(testQuick)
}

jar {
// Much like javadoc, we hijack this task to build the client jar, since we don't need
// a service jar
include "us/kbase/workspace/*.class"
exclude "us/kbase/workspace/WorkspaceServer*.class" // exclude anonymous classes
include "us/kbase/common/service/Tuple*.class"
archiveAppendix = 'client'
}

shadowJar {
// Be careful when updating jars - you may want to set the duplicates strategy to WARN
// to see if any of the jars are shadowing the others when building the fat jar, which
Expand All @@ -160,6 +171,13 @@ shadowJar {
from(BUILD_OTHER_DOC_DIR) { into IN_JAR_DOC_DIR }
}

war {
dependsOn buildDocs
webXml = file('war/web.xml')
from(BUILD_JAVA_DOC_DIR) { into "/WEB-INF/classes/$IN_JAR_JAVA_DOC_DIR" }
from(BUILD_OTHER_DOC_DIR) { into "/WEB-INF/classes/$IN_JAR_DOC_DIR" }
}

// Custom java project layout
sourceSets {
main {
Expand Down Expand Up @@ -190,13 +208,6 @@ sourceSets {
}
}

war {
dependsOn buildDocs
webXml = file('war/web.xml')
from(BUILD_JAVA_DOC_DIR) { into "/WEB-INF/classes/$IN_JAR_JAVA_DOC_DIR" }
from(BUILD_OTHER_DOC_DIR) { into "/WEB-INF/classes/$IN_JAR_DOC_DIR" }
}

configurations {
// can't directly access testImplementation, so extend and access
testimpl.extendsFrom testImplementation
Expand Down
2 changes: 1 addition & 1 deletion src/us/kbase/workspace/database/provenance/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Common {
private Common() {}

static String processString(final String input) {
return isNullOrWhitespace(input) ? null : input.strip();
return isNullOrWhitespace(input) ? null : input.trim();
}

static URL processURL(final String url, final String name) {
Expand Down

0 comments on commit 19117a4

Please sign in to comment.