-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ID-937 upgrade client lib and code gen (#1273)
- Loading branch information
Showing
11 changed files
with
150 additions
and
17 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.4.7 | ||
sbt.version=1.6.2 |
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,4 @@ | ||
object Artifactory { | ||
val artifactoryHost = "broadinstitute.jfrog.io" | ||
val artifactory = s"https://$artifactoryHost/broadinstitute/" | ||
} |
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,40 @@ | ||
import sbt.Keys._ | ||
import sbt._ | ||
import Artifactory._ | ||
|
||
/** NOTE: This was lifted wholesale from Cromwell. | ||
*/ | ||
|
||
object Publishing { | ||
private val buildTimestamp = System.currentTimeMillis() / 1000 | ||
|
||
private def artifactoryResolver(isSnapshot: Boolean): Resolver = { | ||
val repoType = if (isSnapshot) "snapshot" else "release" | ||
val repoUrl = | ||
s"${artifactory}libs-$repoType-local;build.timestamp=$buildTimestamp" | ||
val repoName = "artifactory-publish" | ||
repoName at repoUrl | ||
} | ||
|
||
private val artifactoryCredentials: Credentials = { | ||
val username = sys.env.getOrElse("ARTIFACTORY_USERNAME", "") | ||
val password = sys.env.getOrElse("ARTIFACTORY_PASSWORD", "") | ||
Credentials("Artifactory Realm", artifactoryHost, username, password) | ||
} | ||
|
||
val publishSettings: Seq[Setting[_]] = | ||
// we only publish to libs-release-local because of a bug in sbt that makes snapshots take | ||
// priority over the local package cache. see here: https://github.com/sbt/sbt/issues/2687#issuecomment-236586241 | ||
Seq( | ||
publishTo := Option(artifactoryResolver(false)), | ||
publishArtifact in Compile := true, | ||
publishArtifact in Test := true, | ||
credentials += artifactoryCredentials | ||
) | ||
|
||
val noPublishSettings: Seq[Setting[_]] = | ||
Seq( | ||
publish := {}, | ||
publishLocal := {} | ||
) | ||
} |
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,20 @@ | ||
import scala.sys.process._ | ||
|
||
object Version { | ||
|
||
def createVersion(baseVersion: String) = { | ||
def getLastCommitFromGit = s"""git rev-parse --short HEAD""" !! | ||
|
||
// either specify git hash as an env var or derive it | ||
// if building from the hseeberger/scala-sbt docker image use env var | ||
// (scala-sbt doesn't have git in it) | ||
val lastCommit = sys.env.getOrElse("GIT_HASH", getLastCommitFromGit).trim() | ||
val version = baseVersion + "-" + lastCommit | ||
|
||
// The project isSnapshot string passed in via command line settings, if desired. | ||
val isSnapshot = sys.props.getOrElse("project.isSnapshot", "true").toBoolean | ||
|
||
// For now, obfuscate SNAPSHOTs from sbt's developers: https://github.com/sbt/sbt/issues/2687#issuecomment-236586241 | ||
if (isSnapshot) s"$version-SNAP" else version | ||
} | ||
} |
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 @@ | ||
sbt.version=1.4.7 |
43 changes: 43 additions & 0 deletions
43
codegen_java_old/templates/libraries/okhttp-gson/build.sbt.mustache
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,43 @@ | ||
import Publishing._ | ||
import Version._ | ||
|
||
lazy val root = (project in file(".")). | ||
settings( | ||
Seq(organization := "org.broadinstitute.dsde.workbench", | ||
name := "sam-client-javax", | ||
version := createVersion("{{artifactVersion}}"), | ||
scalaVersion := "2.13.10", | ||
scalacOptions ++= Seq("-feature"), | ||
javacOptions in compile ++= Seq("-Xlint:deprecation"), | ||
publishArtifact in (Compile, packageDoc) := false, | ||
resolvers += Resolver.mavenLocal, | ||
libraryDependencies ++= Seq( | ||
"io.swagger" % "swagger-annotations" % "1.5.24", | ||
"com.squareup.okhttp3" % "okhttp" % "4.10.0", | ||
"com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", | ||
"com.google.code.gson" % "gson" % "2.8.6", | ||
"org.apache.commons" % "commons-lang3" % "3.10", | ||
{{#openApiNullable}} | ||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2", | ||
{{/openApiNullable}} | ||
{{#hasOAuthMethods}} | ||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", | ||
{{/hasOAuthMethods}} | ||
{{#joda}} | ||
"joda-time" % "joda-time" % "2.9.9" % "compile", | ||
{{/joda}} | ||
{{#threetenbp}} | ||
"org.threeten" % "threetenbp" % "1.4.3" % "compile", | ||
{{/threetenbp}} | ||
{{#dynamicOperations}} | ||
"io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "compile" | ||
{{/dynamicOperations}} | ||
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile", | ||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", | ||
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", | ||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", | ||
"junit" % "junit" % "4.13.1" % "test", | ||
"com.novocode" % "junit-interface" % "0.10" % "test", | ||
"javax.annotation" % "javax.annotation-api" % "1.3.2" | ||
)) ++ publishSettings:_* | ||
) |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
set -e | ||
|
||
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v5.4.0 generate -i /local/src/main/resources/swagger/api-docs.yaml -g java -o /local/codegen_java --api-package org.broadinstitute.dsde.workbench.client.sam.api --model-package org.broadinstitute.dsde.workbench.client.sam.model --template-dir /local/codegen_java/templates --library okhttp-gson | ||
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v7.1.0 generate -i /local/src/main/resources/swagger/api-docs.yaml -g java -o /local/codegen_java --api-package org.broadinstitute.dsde.workbench.client.sam.api --model-package org.broadinstitute.dsde.workbench.client.sam.model --template-dir /local/codegen_java/templates --library okhttp-gson --additional-properties useJakartaEe=true | ||
cd codegen_java | ||
sbt test |
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,5 @@ | ||
set -e | ||
|
||
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v5.4.0 generate -i /local/src/main/resources/swagger/api-docs.yaml -g java -o /local/codegen_java_old --api-package org.broadinstitute.dsde.workbench.client.sam.api --model-package org.broadinstitute.dsde.workbench.client.sam.model --template-dir /local/codegen_java_old/templates --library okhttp-gson | ||
cd codegen_java_old | ||
sbt test |