Skip to content
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

Add a workspace client module #738

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ COPY docshtml /tmp/workspace/docshtml/
COPY docsource /tmp/workspace/docsource/
COPY lib /tmp/workspace/lib/
COPY service /tmp/workspace/service
COPY client /tmp/workspace/client
# for the git commit
COPY .git /tmp/workspace/.git/
RUN ./gradlew war
Expand Down
118 changes: 118 additions & 0 deletions client/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* This file was generated by the Gradle 'init' task.
*/

// TODO TEST switch to Kotlin DSL which is now the default and apparently better
// TODO TEST avoid early configuration, see
// https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
// need to avoid withType as well apparently?

plugins {
id 'java'
id 'maven-publish'
}

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/ws"

var LOC_WS_SPEC = "$rootDir/workspace.spec"

repositories {
mavenCentral()
maven {
name = "Jitpack"
url = 'https://jitpack.io'
}
}

compileJava {
// 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
}

java {
withSourcesJar()
withJavadocJar()
}

javadoc {
/* TODO DOCS the current sdk documentation looks like invalid html to javadoc
* need to go through and remove
* also some spots with < / > that need to be wrapped with {@code } in internal code
*/
failOnError = false
options {
links "https://docs.oracle.com/en/java/javase/11/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/"
}
}

/* 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 = "./typescript"

task sdkCompileJava {
// TODO GRADLE is there a variable for src/main/java?
var cmd = "kb-sdk compile " +
"--java " +
"--javasrc ${project.projectDir}/src/main/java/ " +
"--out . " +
"--url $DEFAULT_URL " +
LOC_WS_SPEC
doLast {
exec {
commandLine "script", "-qefc", cmd
}
delete LOC_SCRIPT_TYPESCRIPT
}
}

task sdkCompile {
dependsOn sdkCompileJava
}

task buildAll {
dependsOn jar
}

publishing {
publications {
maven(MavenPublication) {
from components.java
artifactId = "workspace-client"
}
}
}

dependencies {
// using older dependencies to not force upgrades on services that might not be able to
// handle them. Need to upgrade the services and then upgrade here
implementation "com.fasterxml.jackson.core:jackson-annotations:2.5.4"
implementation "com.fasterxml.jackson.core:jackson-databind:2.5.4"
implementation "com.github.kbase:auth2_client_java:$VER_AUTH2_CLIENT"
implementation "com.github.kbase:java_common:$VER_JAVA_COMMON"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
}
179 changes: 179 additions & 0 deletions client/src/main/java/us/kbase/common/service/Tuple11.java
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything in client/src is SDK generated

Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
package us.kbase.common.service;

import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;

public class Tuple11 <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
private T1 e1;
private T2 e2;
private T3 e3;
private T4 e4;
private T5 e5;
private T6 e6;
private T7 e7;
private T8 e8;
private T9 e9;
private T10 e10;
private T11 e11;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

public T1 getE1() {
return e1;
}

public void setE1(T1 e1) {
this.e1 = e1;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE1(T1 e1) {
this.e1 = e1;
return this;
}

public T2 getE2() {
return e2;
}

public void setE2(T2 e2) {
this.e2 = e2;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE2(T2 e2) {
this.e2 = e2;
return this;
}

public T3 getE3() {
return e3;
}

public void setE3(T3 e3) {
this.e3 = e3;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE3(T3 e3) {
this.e3 = e3;
return this;
}

public T4 getE4() {
return e4;
}

public void setE4(T4 e4) {
this.e4 = e4;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE4(T4 e4) {
this.e4 = e4;
return this;
}

public T5 getE5() {
return e5;
}

public void setE5(T5 e5) {
this.e5 = e5;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE5(T5 e5) {
this.e5 = e5;
return this;
}

public T6 getE6() {
return e6;
}

public void setE6(T6 e6) {
this.e6 = e6;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE6(T6 e6) {
this.e6 = e6;
return this;
}

public T7 getE7() {
return e7;
}

public void setE7(T7 e7) {
this.e7 = e7;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE7(T7 e7) {
this.e7 = e7;
return this;
}

public T8 getE8() {
return e8;
}

public void setE8(T8 e8) {
this.e8 = e8;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE8(T8 e8) {
this.e8 = e8;
return this;
}

public T9 getE9() {
return e9;
}

public void setE9(T9 e9) {
this.e9 = e9;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE9(T9 e9) {
this.e9 = e9;
return this;
}

public T10 getE10() {
return e10;
}

public void setE10(T10 e10) {
this.e10 = e10;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE10(T10 e10) {
this.e10 = e10;
return this;
}

public T11 getE11() {
return e11;
}

public void setE11(T11 e11) {
this.e11 = e11;
}

public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> withE11(T11 e11) {
this.e11 = e11;
return this;
}

@Override
public String toString() {
return "Tuple11 [e1=" + e1 + ", e2=" + e2 + ", e3=" + e3 + ", e4=" + e4 + ", e5=" + e5 + ", e6=" + e6 + ", e7=" + e7 + ", e8=" + e8 + ", e9=" + e9 + ", e10=" + e10 + ", e11=" + e11 + "]";
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperties(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
Loading
Loading