forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Gradle 7.6 to build Gradle plugin (OpenAPITools#13860)
* Upgrade Gradle plugin Gradle build to Gradle 7.5.1 * Update Travis workflow file to support new tasks * Update Maven POM with Gradle 7.5.1 * Capitalize many occurrences of "Gradle" in the Gradle plugin README * Update Gradle version in appveyor.yml and shippable.yml * Update comments * Update Gradle wrapper to 7.5.1 * Capitalize Gradle in shippable.yml * Leave Open API * Upgrade Gradle plugin build to Gradle 7.6 * Upgrade wrapper to Gradle 7.6
- Loading branch information
1 parent
a92afd2
commit 792d44d
Showing
13 changed files
with
299 additions
and
296 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
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,84 +1,56 @@ | ||
buildscript { | ||
ext.kotlin_version = '1.3.30' | ||
repositories { | ||
mavenLocal() | ||
maven { url "https://repo1.maven.org/maven2" } | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
maven { | ||
url "https://oss.sonatype.org/content/repositories/releases/" | ||
} | ||
maven { | ||
url "https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
} | ||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
classpath "gradle.plugin.org.gradle.kotlin:gradle-kotlin-dsl-plugins:1.1.3" | ||
classpath "com.gradle.publish:plugin-publish-plugin:0.11.0" | ||
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.20.0" | ||
classpath "de.marcphilipp.gradle:nexus-publish-plugin:0.2.0" | ||
} | ||
} | ||
import io.github.gradlenexus.publishplugin.CloseNexusStagingRepository | ||
import io.github.gradlenexus.publishplugin.ReleaseNexusStagingRepository | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("com.gradle.plugin-publish") version "1.0.0" | ||
id("io.github.gradle-nexus.publish-plugin") version "1.1.0" | ||
id("java-gradle-plugin") | ||
id("maven-publish") | ||
id("org.gradle.kotlin.kotlin-dsl") version "2.4.1" | ||
id("org.jetbrains.kotlin.jvm") version "1.7.10" | ||
id("signing") | ||
} | ||
|
||
group = "org.openapitools" | ||
version = "$openApiGeneratorVersion" | ||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT") | ||
|
||
group 'org.openapitools' | ||
// Shared OpenAPI Generator version be passed via command line arg as -PopenApiGeneratorVersion=VERSION | ||
version "$openApiGeneratorVersion" | ||
description = """ | ||
This plugin supports common functionality found in Open API Generator CLI as a gradle plugin. | ||
This plugin supports common functionality found in Open API Generator CLI as a Gradle plugin. | ||
This gives you the ability to generate client SDKs, documentation, new generators, and to validate Open API 2.0 and 3.x | ||
specifications as part of your build. Other tasks are available as command line tasks. | ||
""" | ||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT") | ||
|
||
apply plugin: 'com.gradle.plugin-publish' | ||
apply plugin: 'java-gradle-plugin' | ||
apply plugin: 'signing' | ||
apply plugin: 'kotlin' | ||
apply plugin: "org.gradle.kotlin.kotlin-dsl" | ||
apply plugin: 'io.codearte.nexus-staging' | ||
apply plugin: "de.marcphilipp.nexus-publish" | ||
|
||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
maven { url "https://repo1.maven.org/maven2" } | ||
maven { | ||
url "https://oss.sonatype.org/content/repositories/releases/" | ||
} | ||
mavenCentral() | ||
maven { | ||
name = "Sonatype Snapshots" | ||
url "https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
compile gradleApi() | ||
// Shared OpenAPI Generator version be passed via command line arg as -PopenApiGeneratorVersion=VERSION | ||
compile "org.openapitools:openapi-generator:$openApiGeneratorVersion" | ||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | ||
|
||
testCompile 'org.testng:testng:6.9.6', | ||
"org.jetbrains.kotlin:kotlin-test:$kotlin_version" | ||
|
||
testCompile "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version" | ||
implementation("org.openapitools:openapi-generator:$openApiGeneratorVersion") | ||
testImplementation("org.jetbrains.kotlin:kotlin-test-testng:1.7.10") | ||
} | ||
|
||
test { | ||
tasks.named("test", Test).configure { | ||
useTestNG() | ||
testClassesDirs = files(project.tasks.compileTestKotlin.destinationDir) | ||
testLogging.showStandardStreams = false | ||
|
||
beforeTest { descriptor -> | ||
logger.lifecycle("Running test: " + descriptor) | ||
} | ||
|
||
failFast = true | ||
|
||
onOutput { descriptor, event -> | ||
// SLF4J may complain about multiple bindings depending on how this is run. | ||
// This is just a warning, but can make test output less readable. So we ignore it specifically. | ||
|
@@ -88,133 +60,105 @@ test { | |
} | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
from javadoc | ||
classifier = 'javadoc' | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from sourceSets.main.allSource | ||
classifier = 'sources' | ||
} | ||
|
||
artifacts { | ||
archives javadocJar, sourcesJar | ||
tasks.withType(KotlinCompile).configureEach { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
artifact javadocJar | ||
pom { | ||
name = 'OpenAPI-Generator Contributors' | ||
description = project.description | ||
url = 'https://openapi-generator.tech' | ||
organization { | ||
name = 'org.openapitools' | ||
url = 'https://github.com/OpenAPITools' | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache Software License, Version 2.0" | ||
url = "https://www.apache.org/licenses/LICENSE-2.0.txt" | ||
distribution = "repo" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "openapitools" | ||
name = "OpenAPI-Generator Contributors" | ||
email = "[email protected]" | ||
} | ||
} | ||
scm { | ||
url = 'https://github.com/OpenAPITools/openapi-generator' | ||
connection = 'scm:git:git://github.com/OpenAPITools/openapi-generator.git' | ||
developerConnection = 'scm:git:ssh://[email protected]:OpenAPITools/openapi-generator.git' | ||
} | ||
issueManagement { | ||
system = 'GitHub' | ||
url = 'https://github.com/OpenAPITools/openapi-generator/issues' | ||
} | ||
} | ||
} | ||
tasks.withType(Javadoc).configureEach { | ||
if (JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption("html5", true) | ||
} | ||
} | ||
|
||
nexusStaging { | ||
username = project.properties["ossrhUsername"] | ||
password = project.properties["ossrhPassword"] | ||
tasks.withType(CloseNexusStagingRepository).configureEach { | ||
onlyIf { nexusPublishing.useStaging.get() } | ||
} | ||
|
||
nexusPublishing { | ||
// To retrieve: ./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="$SIGNING_SECRET" getStagingProfile --no-daemon | ||
stagingProfileId = "456297f829bbbe" | ||
tasks.withType(ReleaseNexusStagingRepository).configureEach { | ||
onlyIf { nexusPublishing.useStaging.get() } | ||
} | ||
|
||
gradlePlugin { | ||
website = "https://openapi-generator.tech/" | ||
vcsUrl = "https://github.com/OpenAPITools/openapi-generator" | ||
plugins { | ||
openApiGenerator { | ||
id = 'org.openapi.generator' | ||
implementationClass = 'org.openapitools.generator.gradle.plugin.OpenApiGeneratorPlugin' | ||
id = "org.openapi.generator" | ||
description = "OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)." | ||
displayName = "OpenAPI Generator Gradle Plugin" | ||
implementationClass = "org.openapitools.generator.gradle.plugin.OpenApiGeneratorPlugin" | ||
tags.addAll("openapi-3.0", "openapi-2.0", "openapi", "swagger", "codegen", "sdk") | ||
} | ||
} | ||
} | ||
|
||
pluginBundle { | ||
// These settings are set for the whole plugin bundle | ||
website = 'https://openapi-generator.tech/' | ||
vcsUrl = 'https://github.com/OpenAPITools/openapi-generator' | ||
description = 'OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)' | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
username = project.properties["ossrhUsername"] | ||
password = project.properties["ossrhPassword"] | ||
|
||
plugins { | ||
// first plugin | ||
openApiGenerator { | ||
id = 'org.openapi.generator' | ||
displayName = 'OpenAPI Generator Gradle Plugin' | ||
tags = ['openapi-3.0', 'openapi-2.0', 'openapi', 'swagger', 'codegen', 'sdk'] | ||
version = "$openApiGeneratorVersion" | ||
group = "org.openapitools" | ||
// To retrieve: ./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="$SIGNING_SECRET" getStagingProfile | ||
stagingProfileId = "456297f829bbbe" | ||
} | ||
} | ||
} | ||
|
||
// signing will require three keys to be defined: signing.keyId, signing.password, and signing.secretKeyRingFile. | ||
// These can be passed to the gradle command: | ||
// Signing requires three keys to be defined: signing.keyId, signing.password, and signing.secretKeyRingFile. | ||
// These can be passed to the Gradle command: | ||
// ./gradlew -Psigning.keyId=yourid | ||
// or stored as key=value pairs in ~/.gradle/gradle.properties | ||
// You can also apply them in CI via environment variables. See Gradle's docs for details. | ||
signing { | ||
required { isReleaseVersion && (gradle.taskGraph.hasTask("publishPluginMavenPublicationToNexusRepository") ) } | ||
sign publishing.publications.mavenJava | ||
} | ||
|
||
compileKotlin { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
compileTestKotlin { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
required { isReleaseVersion && gradle.taskGraph.hasTask("publishPluginMavenPublicationToSonatypeRepository") } | ||
sign(publishing.publications) | ||
} | ||
|
||
javadoc { | ||
if(JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption('html5', true) | ||
// afterEvaluate is necessary because java-gradle-plugin | ||
// creates its publications in an afterEvaluate callback | ||
afterEvaluate { | ||
tasks.named("publishToSonatype").configure { | ||
dependsOn("check") | ||
} | ||
} | ||
|
||
tasks { | ||
closeRepository { | ||
onlyIf { nexusPublishing.useStaging.get() } | ||
} | ||
releaseRepository{ | ||
onlyIf { nexusPublishing.useStaging.get() } | ||
publishing { | ||
publications { | ||
pluginMaven { | ||
pom { | ||
name = "OpenAPI-Generator Contributors" | ||
description = project.description | ||
url = "https://openapi-generator.tech" | ||
organization { | ||
name = "org.openapitools" | ||
url = "https://github.com/OpenAPITools" | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache Software License, Version 2.0" | ||
url = "https://www.apache.org/licenses/LICENSE-2.0.txt" | ||
distribution = "repo" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "openapitools" | ||
name = "OpenAPI-Generator Contributors" | ||
email = "[email protected]" | ||
} | ||
} | ||
scm { | ||
url = "https://github.com/OpenAPITools/openapi-generator" | ||
connection = "scm:git:git://github.com/OpenAPITools/openapi-generator.git" | ||
developerConnection = "scm:git:ssh://[email protected]:OpenAPITools/openapi-generator.git" | ||
} | ||
issueManagement { | ||
system = "GitHub" | ||
url = "https://github.com/OpenAPITools/openapi-generator/issues" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishToNexus.dependsOn 'check' |
Binary file modified
BIN
+5.82 KB
(110%)
modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion
3
modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
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,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.