Skip to content

Commit

Permalink
#62 Fix gradle registration. (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
jemacineiras authored Jul 13, 2023
1 parent 18051da commit e9257c5
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 27 deletions.
2 changes: 1 addition & 1 deletion multiapi-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.sngular</groupId>
<artifactId>multiapi-engine</artifactId>
<version>4.9.3</version>
<version>4.9.4</version>
<packaging>jar</packaging>

<properties>
Expand Down
4 changes: 2 additions & 2 deletions scs-multiapi-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}

group = 'com.sngular'
version = '4.9.3'
version = '4.9.4'

def SCSMultiApiPluginGroupId = group
def SCSMultiApiPluginVersion = version
Expand Down Expand Up @@ -98,7 +98,7 @@ testing {

integrationTest(JvmTestSuite) {
dependencies {
implementation 'com.sngular:scs-multiapi-gradle-plugin:4.9.0'
implementation 'com.sngular:scs-multiapi-gradle-plugin:4.9.3'
implementation 'org.assertj:assertj-core:3.23.1'
}

Expand Down
Binary file modified scs-multiapi-gradle-plugin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions scs-multiapi-gradle-plugin/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions scs-multiapi-gradle-plugin/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

package com.sngular.api.generator.plugin


import com.sngular.api.generator.plugin.asyncapi.AsyncApiGenerator
import com.sngular.api.generator.plugin.asyncapi.parameter.OperationParameterObject
import com.sngular.api.generator.plugin.asyncapi.parameter.SpecFile
import com.sngular.api.generator.plugin.model.AsyncApiModelExtension
import com.sngular.api.generator.plugin.model.AsyncApiSpecFile
import com.sngular.api.generator.plugin.model.OperationParameter
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.tasks.Optional
Expand All @@ -27,8 +30,8 @@ abstract class AsyncApiTask extends DefaultTask {
def generatedDir = getOrCreateGenerated(getOutputDir())
AsyncApiModelExtension asyncApiModelExtension = getProject().getExtensions().getByType(AsyncApiModelExtension.class)
if (null != asyncApiModelExtension && !asyncApiModelExtension.getSpecFiles().isEmpty()) {
def asyncApiGen = new com.sngular.api.generator.plugin.asyncapi.AsyncApiGenerator(asyncApiModelExtension.getSpringBootVersion(), targetFolder, generatedDir, project.getGroup() as String, project.getProjectDir())
List<com.sngular.api.generator.plugin.asyncapi.parameter.SpecFile> asyncApiSpecFiles = []
def asyncApiGen = new AsyncApiGenerator(asyncApiModelExtension.getSpringBootVersion(), targetFolder, generatedDir, project.getGroup() as String, project.getProjectDir())
List<SpecFile> asyncApiSpecFiles = []
asyncApiModelExtension.getSpecFiles().forEach(apiSpec -> {
asyncApiSpecFiles.add(toFileSpec(apiSpec))
})
Expand Down Expand Up @@ -58,7 +61,7 @@ abstract class AsyncApiTask extends DefaultTask {
}

static def toFileSpec(AsyncApiSpecFile apiSpecFile) {
def builder = com.sngular.api.generator.plugin.asyncapi.parameter.SpecFile.builder()
def builder = SpecFile.builder()
if (!apiSpecFile.filePath.isEmpty()) {
builder.filePath(apiSpecFile.getFilePath())
}
Expand All @@ -75,8 +78,8 @@ abstract class AsyncApiTask extends DefaultTask {
return builder.build()
}

static com.sngular.api.generator.plugin.asyncapi.parameter.OperationParameterObject toOperationParameterObject(com.sngular.api.generator.plugin.model.OperationParameter parameterObject) {
def builder = com.sngular.api.generator.plugin.asyncapi.parameter.OperationParameterObject.builder()
static OperationParameterObject toOperationParameterObject(OperationParameter parameterObject) {
def builder = OperationParameterObject.builder()
if (parameterObject.getApiPackage()) {
builder.apiPackage(parameterObject.apiPackage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ package com.sngular.api.generator.plugin

import com.sngular.api.generator.plugin.model.OpenApiModelExtension
import com.sngular.api.generator.plugin.model.OpenApiSpecFile
import com.sngular.api.generator.plugin.openapi.OpenApiGenerator
import com.sngular.api.generator.plugin.openapi.parameter.SpecFile
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.tasks.Optional
Expand All @@ -27,8 +29,8 @@ abstract class OpenApiTask extends DefaultTask {
def generatedDir = getOrCreateGenerated(getOutputDir())
OpenApiModelExtension openApiExtension = getProject().getExtensions().getByType(OpenApiModelExtension.class)
if (null != openApiExtension && !openApiExtension.getSpecFile().isEmpty()) {
def openApiGen = new com.sngular.api.generator.plugin.openapi.OpenApiGenerator(openApiExtension.getSpringBootVersion(), openApiExtension.getOverWriteModel(), generatedDir, project.getGroup() as String, targetFolder, project.getProjectDir())
List<com.sngular.api.generator.plugin.openapi.parameter.SpecFile> openApiSpecFiles = []
def openApiGen = new OpenApiGenerator(openApiExtension.getSpringBootVersion(), openApiExtension.getOverWriteModel(), generatedDir, project.getGroup() as String, targetFolder, project.getProjectDir())
List<SpecFile> openApiSpecFiles = []
openApiExtension.getSpecFile().forEach(apiSpec -> {
openApiSpecFiles.add(toFileSpec(apiSpec))
})
Expand Down Expand Up @@ -57,7 +59,7 @@ abstract class OpenApiTask extends DefaultTask {
}

static def toFileSpec(OpenApiSpecFile openApiSpecFile) {
def builder = com.sngular.api.generator.plugin.openapi.parameter.SpecFile.builder()
def builder = SpecFile.builder()
if (openApiSpecFile.filePath) {
builder.filePath(openApiSpecFile.filePath)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ class ScsMultiApi implements Plugin<Project> {
project.plugins.apply("java")
project.extensions.create("openapimodel", OpenApiModelExtension)
project.extensions.create("asyncapimodel", AsyncApiModelExtension)
def openApiTask = project.task("openApiTask", type: OpenApiTask)
def outputDirDefault = new File(project.buildDir.absolutePath + '/generated-source')
outputDirDefault.mkdirs()
openApiTask.configure {
def openApiTask = project.getTasks().register("openApiTask", OpenApiTask.class, {
it.outputDir = outputDirDefault
}
def asyncApiTask = project.task("asyncApiTask", type: AsyncApiTask)
asyncApiTask.configure {
})
def asyncApiTask = project.getTasks().register("asyncApiTask", AsyncApiTask.class, {
it.outputDir = outputDirDefault
})
project.tasks.named('compileJava').configure {
it.dependsOn(openApiTask)
it.dependsOn(asyncApiTask)
}
}
}
4 changes: 2 additions & 2 deletions scs-multiapi-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.sngular</groupId>
<artifactId>scs-multiapi-maven-plugin</artifactId>
<version>4.9.3</version>
<version>4.9.4</version>
<packaging>maven-plugin</packaging>

<name>AsyncApi - OpenApi Code Generator Maven Plugin</name>
Expand Down Expand Up @@ -233,7 +233,7 @@
<dependency>
<groupId>com.sngular</groupId>
<artifactId>multiapi-engine</artifactId>
<version>4.9.3</version>
<version>4.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down

0 comments on commit e9257c5

Please sign in to comment.