diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index bc538222..f58eb64c 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -15,7 +15,7 @@ dependencies { implementation 'com.srcclr.gradle:com.srcclr.gradle.gradle.plugin:3.1.12' implementation 'de.undercouch.download:de.undercouch.download.gradle.plugin:5.1.0' implementation 'org.hidetake.swagger.generator:org.hidetake.swagger.generator.gradle.plugin:2.19.1' - implementation 'org.sonarqube:org.sonarqube.gradle.plugin:3.4.0.2513' + implementation 'org.sonarqube:org.sonarqube.gradle.plugin:5.1.0.4882' // This is required due to a dependency conflict between jib and srcclr. Removing it will cause jib to fail. implementation 'org.apache.commons:commons-compress:1.21' } diff --git a/buildSrc/src/main/groovy/bio.terra.pipelines.java-common-conventions.gradle b/buildSrc/src/main/groovy/bio.terra.pipelines.java-common-conventions.gradle index 65d37dcd..9e3f613a 100644 --- a/buildSrc/src/main/groovy/bio.terra.pipelines.java-common-conventions.gradle +++ b/buildSrc/src/main/groovy/bio.terra.pipelines.java-common-conventions.gradle @@ -74,4 +74,3 @@ compileJava { dependsOn(spotlessApply) } } - diff --git a/client/build.gradle b/client/build.gradle index d28bf070..244fc5a5 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -15,4 +15,4 @@ dependencyManagement { } apply from: 'artifactory.gradle' -apply from: 'swagger.gradle' +apply from: 'java-client.gradle' diff --git a/client/swagger.gradle b/client/java-client.gradle similarity index 100% rename from client/swagger.gradle rename to client/java-client.gradle diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 068cdb2d..e411586a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 78c08c0a..112fb2af 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,5 @@ rootProject.name = 'terra-scientific-pipelines-service' -include('service', 'scripts', 'client', 'rawls-client') - -gradle.ext.releaseVersion = "0.0.69-SNAPSHOT" -include 'scripts:git-hooks' +include('service', 'scripts', 'scripts:git-hooks', 'client', 'rawls-client', 'teaspoons-cli') findProject(':scripts:git-hooks')?.name = 'git-hooks' +gradle.ext.releaseVersion = "0.0.69-SNAPSHOT" diff --git a/teaspoons-cli/README.md b/teaspoons-cli/README.md new file mode 100644 index 00000000..973311f6 --- /dev/null +++ b/teaspoons-cli/README.md @@ -0,0 +1,15 @@ +# Teaspoons CLI + +## Python thin client auto-generation +We use the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) to generate the "thin" Python client, +which is then used to build the Python-based "thick" CLI tool. + +To generate the Python thin client, run the following command: +```bash +./gradlew :teaspoons-cli:openApiGenerate +``` + +This will produce generated files at `/teaspoons-cli/build/`. + +Note we do not run the openApiGenerate task as part of the main Teaspoons build, as it is not necessary for the +service itself and we don't want any potential bugs in the CLI to affect the service. diff --git a/teaspoons-cli/build.gradle b/teaspoons-cli/build.gradle new file mode 100644 index 00000000..97eec9d0 --- /dev/null +++ b/teaspoons-cli/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'org.openapi.generator' version '7.8.0' +} + +apply plugin: 'java' + +apply from: 'teaspoons-client.gradle' diff --git a/teaspoons-cli/teaspoons-client.gradle b/teaspoons-cli/teaspoons-client.gradle new file mode 100644 index 00000000..223e8b73 --- /dev/null +++ b/teaspoons-cli/teaspoons-client.gradle @@ -0,0 +1,18 @@ +tasks.openApiGenerate { + generatorName.set("python") + inputSpec.set("$rootDir/common/openapi.yml") + outputDir.set("$rootDir/teaspoons-cli/build") + configOptions.put("projectName", "teaspoons-client") + configOptions.put("packageName", "teaspoons_client") + configOptions.put("packageVersion", "0.0.0") + configOptions.put("httpUserAgent", "teaspoons-client/0.0.0/python") +} + +// we do NOT want to build this project when building the main service project, to prevent a bug in the cli code from breaking the main service build +//compileJava.dependsOn tasks.openApiGenerate + +task customCleanUp(type:Delete) { + delete "${rootDir}/teaspoons-cli/build/" +} + +tasks.clean.dependsOn(tasks.customCleanUp)