Skip to content

Commit 0c50365

Browse files
authored
Merge branch 'master' into master
2 parents c9ea0c6 + 7ebf4c4 commit 0c50365

File tree

9 files changed

+75
-55
lines changed

9 files changed

+75
-55
lines changed

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
dist: trusty
3+
language: java
4+
install: true
5+
6+
jdk:
7+
- oraclejdk8
8+
9+
addons:
10+
sonarcloud:
11+
organization: "springdoc-openapi"
12+
token:
13+
secure: "m8Q4W1ZyUuzcfoCPu+7Q2SSTpiReHiK1MnUhl6wW6t3RwasD/s0c9pn1q6ZtSRpYBzFKzWxfdALV06vOFrfbTUlMhzWJnNFEdvF/ApEiRtfd0eOJYXZ219R9Wi2JsCvJd7GP9p56KwiUkbHU5zU4dPkFeYf8wPs8xwqepukb0vzTn5/EfQgpQST2nMvXi3dWUmZZl70Wokug9A5Xe4yiIf7AbrvEcXcveq0i4vsPFiPUyec6OYpKAi0cAa+qlIlkuz6YIgEMvlU2KpYqgJShO3EByU7tDkTOg500VzUylkGHMFYrrS5fdZmNSULJgVMzCleibKPWzbhZkftdy7S360mEMNWOIFkQnqCWA2wgQgXryltr3gQeb+gD85R8qtiNnwxEe5ctoOiw/VWAq40zgL+0v4qzmVDfAGuhGrVUhfKIlUu4h7tK0kkT1fqAhQBz1bwa3otQkRL88/63VKQE151lmx+65dnb7HwPDYxVSMsbIN7AdczEhqaIQh2tGWj8BvQgMpAIb5a8DkdLTD+3XtQEbj1OgJ/r67sHzE5aGu1A5N3fTDNx7RiyfbFQKWhmxraZfMJOpMqDx6l+yZlzS1yzyFBpc1EPsInG6kFWyjeQKk3S3ZOx3vTZtuFmyPS/dAgjdkOjn0Gbp0/oBlEnZjA2N/twvIhZUTUJ/Mk7j3w=" # encrypted value of your token
14+
15+
script:
16+
- ./gradlew -S clean build sonarqube
17+
18+
before_cache:
19+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
20+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
21+
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
22+
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
23+
24+
cache:
25+
directories:
26+
- $HOME/.gradle/caches/
27+
- $HOME/.gradle/wrapper/

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[![Build Status](https://travis-ci.org/springdoc/springdoc-openapi-gradle-plugin.svg?branch=master)](https://travis-ci.org/springdoc/springdoc-openapi-gradle-plugin)
2+
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=springdoc_springdoc-openapi-gradle-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=springdoc_springdoc-openapi-gradle-plugin)
3+
14
# **Introduction to springdoc-openapi-gradle-plugin**
25

36
Spring Docs Open API Gradle Plugin - Generates OpenAPI-3 specification docs for spring boot application
@@ -89,4 +92,4 @@ Parameter | Description | Required | Default
8992

9093
# Building the plugin
9194

92-
TODO
95+
TODO

build.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
plugins {
22
`java-gradle-plugin`
33
id("com.gradle.plugin-publish") version "0.10.1"
4+
id("org.sonarqube") version "2.8"
45
kotlin("jvm") version "1.3.61"
56
`maven-publish`
67
}
78

89
group = "org.springdoc"
910
version = "1.0.0"
1011

12+
sonarqube {
13+
properties {
14+
property("sonar.projectKey", "springdoc_springdoc-openapi-gradle-plugin")
15+
}
16+
}
1117
repositories {
1218
mavenCentral()
1319
maven {
@@ -34,7 +40,7 @@ dependencies {
3440
implementation(group = "khttp", name = "khttp", version = "1.0.0")
3541
implementation(group = "com.google.code.gson", name = "gson", version = "2.8.6")
3642
implementation(group = "org.awaitility", name = "awaitility-kotlin", version = "4.0.2")
37-
implementation(files("/home/ramesh/gradle-processes/build/libs/gradle-processes-0.5.0.jar"))
43+
implementation(group = "gradle.plugin.com.github.jengelman.gradle.plugins", name = "gradle-processes", version = "0.5.0")
3844
}
3945

4046
gradlePlugin {

gradle/wrapper/gradle-wrapper.jar

53.9 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
#!/usr/bin/env sh
22

3-
#
4-
# Copyright 2015 the original author or authors.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# https://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
193
##############################################################################
204
##
215
## Gradle start up script for UN*X
@@ -44,7 +28,7 @@ APP_NAME="Gradle"
4428
APP_BASE_NAME=`basename "$0"`
4529

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

4933
# Use the maximum available, or set MAX_FD != -1 to use that value.
5034
MAX_FD="maximum"
@@ -125,8 +109,8 @@ if $darwin; then
125109
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126110
fi
127111

128-
# For Cygwin or MSYS, switch paths to Windows format before running java
129-
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
112+
# For Cygwin, switch paths to Windows format before running java
113+
if $cygwin ; then
130114
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131115
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132116
JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -154,19 +138,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
154138
else
155139
eval `echo args$i`="\"$arg\""
156140
fi
157-
i=`expr $i + 1`
141+
i=$((i+1))
158142
done
159143
case $i in
160-
0) set -- ;;
161-
1) set -- "$args0" ;;
162-
2) set -- "$args0" "$args1" ;;
163-
3) set -- "$args0" "$args1" "$args2" ;;
164-
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165-
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166-
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167-
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168-
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169-
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
144+
(0) set -- ;;
145+
(1) set -- "$args0" ;;
146+
(2) set -- "$args0" "$args1" ;;
147+
(3) set -- "$args0" "$args1" "$args2" ;;
148+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170154
esac
171155
fi
172156

@@ -175,9 +159,14 @@ save () {
175159
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176160
echo " "
177161
}
178-
APP_ARGS=`save "$@"`
162+
APP_ARGS=$(save "$@")
179163

180164
# Collect all arguments for the java command, following the shell quoting and substitution rules
181165
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182166

167+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169+
cd "$(dirname "$0")"
170+
fi
171+
183172
exec "$JAVACMD" "$@"

gradlew.bat

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
@rem
2-
@rem Copyright 2015 the original author or authors.
3-
@rem
4-
@rem Licensed under the Apache License, Version 2.0 (the "License");
5-
@rem you may not use this file except in compliance with the License.
6-
@rem You may obtain a copy of the License at
7-
@rem
8-
@rem https://www.apache.org/licenses/LICENSE-2.0
9-
@rem
10-
@rem Unless required by applicable law or agreed to in writing, software
11-
@rem distributed under the License is distributed on an "AS IS" BASIS,
12-
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
@rem See the License for the specific language governing permissions and
14-
@rem limitations under the License.
15-
@rem
16-
171
@if "%DEBUG%" == "" @echo off
182
@rem ##########################################################################
193
@rem
@@ -30,7 +14,7 @@ set APP_BASE_NAME=%~n0
3014
set APP_HOME=%DIRNAME%
3115

3216
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33-
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
17+
set DEFAULT_JVM_OPTS="-Xmx64m"
3418

3519
@rem Find java.exe
3620
if defined JAVA_HOME goto findJavaFromJavaHome

src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGeneratorTask.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import java.time.Duration
1818
import java.time.temporal.ChronoUnit.SECONDS
1919

2020

21-
open class OpenApiGeneratorTask: DefaultTask() {
21+
open class OpenApiGeneratorTask : DefaultTask() {
2222
@get:Input
2323
val apiDocsUrl: Property<String> = project.objects.property(String::class.java)
2424
@get:Input
@@ -51,7 +51,10 @@ open class OpenApiGeneratorTask: DefaultTask() {
5151
@TaskAction
5252
fun execute() {
5353
try {
54-
await ignoreException ConnectException::class withPollInterval Durations.ONE_SECOND atMost Duration.of(waitTimeInSeconds.get().toLong(), SECONDS) until {
54+
await ignoreException ConnectException::class withPollInterval Durations.ONE_SECOND atMost Duration.of(
55+
waitTimeInSeconds.get().toLong(),
56+
SECONDS
57+
) until {
5558
val statusCode = khttp.get(apiDocsUrl.get()).statusCode
5659
logger.trace("apiDocsUrl = {} status code = {}", apiDocsUrl.get(), statusCode)
5760
statusCode < 299
@@ -65,7 +68,10 @@ open class OpenApiGeneratorTask: DefaultTask() {
6568
outputFile.writeText(gson.toJson(googleJsonObject))
6669
} catch (e: ConditionTimeoutException) {
6770
taskError.set("Timeout occurred while trying to connect to ${apiDocsUrl.get()}")
68-
this.logger.error("Unable to connect to ${apiDocsUrl.get()} waited for ${waitTimeInSeconds.get()} seconds", e)
71+
this.logger.error(
72+
"Unable to connect to ${apiDocsUrl.get()} waited for ${waitTimeInSeconds.get()} seconds",
73+
e
74+
)
6975
}
7076
}
7177

src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGradlePlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.gradle.api.Plugin
66
import org.gradle.api.Project
77
import org.slf4j.LoggerFactory
88

9-
open class OpenApiGradlePlugin: Plugin<Project> {
9+
open class OpenApiGradlePlugin : Plugin<Project> {
1010
private val LOGGER = LoggerFactory.getLogger(OpenApiGradlePlugin::class.java)
1111

1212
override fun apply(project: Project) {
@@ -32,7 +32,7 @@ open class OpenApiGradlePlugin: Plugin<Project> {
3232
}
3333

3434
// This is my task. Before I can run it I have to run the dependent tasks
35-
val openApiGeneratorTask = project.tasks.register(OPEN__API_TASK_NAME, OpenApiGeneratorTask::class.java) { openApiGenTask ->
35+
project.tasks.register(OPEN__API_TASK_NAME, OpenApiGeneratorTask::class.java) { openApiGenTask ->
3636
openApiGenTask.dependsOn(forkedSpringBoot)
3737

3838
openApiGenTask.doLast {

0 commit comments

Comments
 (0)