Skip to content
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ The client can be used with Java 1.8+ and pulled into Maven or Gradle projects.
<dependency>
<groupId>com.vertexvis</groupId>
<artifactId>api-client-java</artifactId>
<version>0.16.0</version>
<version>0.17.0</version>
<scope>compile</scope>
</dependency>
```

### Gradle

```groovy
compile "com.vertexvis:api-client-java:0.16.0"
compile "com.vertexvis:api-client-java:0.17.0"
```

### Sbt

```sbt
libraryDependencies += "com.vertexvis" % "api-client-java" % "0.16.0"
libraryDependencies += "com.vertexvis" % "api-client-java" % "0.17.0"
```

### Others
Expand All @@ -44,7 +44,7 @@ mvn clean package

Then manually install the following JARs.

- `target/api-client-java-0.16.0.jar`
- `target/api-client-java-0.17.0.jar`
- `target/lib/*.jar`

## Usage
Expand Down Expand Up @@ -104,7 +104,7 @@ To consume published snapshot versions in other projects, add the snapshot repos
<dependency>
<groupId>com.vertexvis</groupId>
<artifactId>api-client-java</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.17.0-SNAPSHOT</version>
</dependency>
```

Expand All @@ -119,7 +119,7 @@ repositories {
}

dependencies {
implementation 'com.vertexvis:api-client-java:0.16.0-SNAPSHOT'
implementation 'com.vertexvis:api-client-java:0.17.0-SNAPSHOT'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "io.github.gradle-nexus.publish-plugin"
}

def projectVersion = '0.16.0'
def projectVersion = '0.17.0'
def isSnapshot = project.hasProperty('isSnapshot') && project.isSnapshot.toBoolean()
version = isSnapshot ? "${projectVersion}-SNAPSHOT" : projectVersion

Expand Down
11 changes: 9 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ repositories {
mavenCentral()
}

def rootProperties = new Properties()
def rootPropertiesFile = file("../gradle.properties")
if (rootPropertiesFile.exists()) {
rootPropertiesFile.withInputStream { rootProperties.load(it) }
}
def openapiGeneratorVersion = rootProperties.getProperty("openapiGeneratorVersion", "7.14.0")

dependencies {
implementation 'org.openapitools:openapi-generator-gradle-plugin:7.14.0'
implementation 'org.openapitools:openapi-generator:7.14.0'
implementation "org.openapitools:openapi-generator-gradle-plugin:${openapiGeneratorVersion}"
implementation "org.openapitools:openapi-generator:${openapiGeneratorVersion}"
implementation 'io.swagger.core.v3:swagger-models:2.2.31'
implementation 'io.github.gradle-nexus:publish-plugin:2.0.0'
}
45 changes: 44 additions & 1 deletion buildSrc/src/main/groovy/vertex.openapi-generator.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,48 @@ repositories {
mavenCentral()
}

def vertexOpenapiGeneratorVersion = project.findProperty("openapiGeneratorVersion") ?: "7.14.0"
def templateRootDir = "${buildDir}/openapi-templates"
def templateDirPath = "${templateRootDir}/Java/libraries/okhttp-gson"
def patchDirPath = "${project.rootDir}/openapi-generator-plugin/src/main/resources/patches"

configurations {
vertexOpenapiGeneratorTemplates
}

dependencies {
vertexOpenapiGeneratorTemplates("org.openapitools:openapi-generator:${vertexOpenapiGeneratorVersion}") {
transitive = false
}
}

tasks.register("prepareOpenApiTemplates") {
outputs.dir(templateRootDir)
doLast {
def generatorJar = configurations.vertexOpenapiGeneratorTemplates.singleFile
copy {
from(zipTree(generatorJar))
include "Java/libraries/okhttp-gson/**"
into templateRootDir
}
def patchDir = file(patchDirPath)
if (!patchDir.exists()) {
throw new GradleException("Patch directory not found at ${patchDir}")
}

def patches = fileTree(patchDir).matching { include "*.patch" }.files.sort { it.name }
patches.each { patchFile ->
exec {
workingDir = file(templateDirPath)
commandLine "patch", "--batch", "--forward", "--reject-file=-", "-p0", "-i", patchFile.absolutePath
}
}

def relPath = project.rootDir.toPath().relativize(file(templateDirPath).toPath()).toString()
println "OpenAPI templates prepared at: ${relPath}"
}
}

openApiGenerate {
verbose = false
generatorName = 'vertex-java' // Use our custom generator
Expand All @@ -18,7 +60,7 @@ openApiGenerate {
invokerPackage = 'com.vertexvis'
modelPackage = 'com.vertexvis.model'
apiPackage = 'com.vertexvis.api'
templateDir = "${project.rootDir}/buildSrc/src/main/resources/vertex-java"
templateDir = templateDirPath
configOptions = [
openApiNullable: "false",
dateLibrary: "java8",
Expand Down Expand Up @@ -46,3 +88,4 @@ sourceSets {

// Make sure compilation depends on code generation
compileJava.dependsOn tasks.openApiGenerate
tasks.openApiGenerate.dependsOn tasks.prepareOpenApiTemplates
Loading