Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Gradle 7.6 to build Gradle plugin #13860

Merged
merged 11 commits into from
Nov 30, 2022

Conversation

erichaagdev
Copy link
Contributor

@erichaagdev erichaagdev commented Oct 30, 2022

This PR updates the openapi-generator-gradle-plugin project to build with Gradle 7.6, the latest.

All plugin versions have been updated to their latest versions. The plugins io.codearte.nexus-staging and de.marcphilipp.nexus-publish have been replaced by io.github.gradle-nexus.publish-plugin as recommended by the original plugin authors. Aside from the configuration, the only notable difference is that "Nexus" has been replaced with "Sonatype" in the names of the relevant publish tasks.

I'm not sure why previously there existed both a mavenJava and pluginMaven publication. For a Gradle plugin, the only publication needed is pluginMaven created by the java-gradle-plugin plugin. I've removed the mavenJava publication. Only pluginMaven is published to Sonatype.

I am unable to test publishing to Sonatype. However, I compared the before and after output of publishToMavenLocal and saw no notable differences.

I did not update the sample project as it does not depend on the version of Gradle used to build the plugin itself. I also did not want to make this PR any larger.

Gradle Build Scan: https://gradle.com/s/d4jzctozh7gem
Gradle 7.6 Release Notes: https://docs.gradle.org/7.6/release-notes.html

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@@ -160,24 +160,24 @@ after_success:
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishMavenJavaPublicationToNexusRepository closeAndReleaseRepository --no-daemon;
echo "Finished ./gradlew publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository";
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToSonatypeRepository closeAndReleaseRepository;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not figure out why previously the publishMavenJavaPublicationToNexusRepository task was called in the first if condition, but the publishPluginMavenPublicationToNexusRepository task was called in the second. I came to the conclusion this was probably not intentional.

In any case, there is no longer a mavenJava publication so publishPluginMavenPublicationToSonatypeRepository is called in both places.

@erichaagdev
Copy link
Contributor Author

@wing328 could you please review this PR? Thank you!

@erichaagdev
Copy link
Contributor Author

@sorin-florea I'd be honored to have you review this PR as well. 😄

@erichaagdev
Copy link
Contributor Author

@saschpe a review from you would be appreciated too.

@erichaagdev
Copy link
Contributor Author

@cbornet @jmini @etherealjoy @spacether could I get a review? Thank you!

@wing328
Copy link
Member

wing328 commented Nov 8, 2022

@erichaagdev thanks for the PR. Can you please PM me via Slack for a few quick questions when you've time?

@erichaagdev erichaagdev changed the title Use Gradle 7.5.1 to build Gradle plugin Use Gradle 7.6 to build Gradle plugin Nov 26, 2022
@erichaagdev erichaagdev force-pushed the upgrade-gradle-7.5.1 branch 4 times, most recently from 9815ee5 to 927818d Compare November 26, 2022 16:48
- unzip -d /opt/gradle gradle-5.6.4-bin.zip
- export PATH=/opt/gradle/gradle-5.6.4/bin:$PATH
- unzip -d /opt/gradle gradle-7.6-bin.zip
- export PATH=/opt/gradle/gradle-7.6/bin:$PATH
- gradle -v
- java -version
# ensure all modifications created by 'mature' generators are in the git repo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI. thanks for updating it but we no longer use Shippable CI.

I'll file another PR to clean up this file later.

@wing328
Copy link
Member

wing328 commented Nov 30, 2022

CircleCI node 1 failure not related to this change.

@wing328 wing328 merged commit 792d44d into OpenAPITools:master Nov 30, 2022
@erichaagdev erichaagdev deleted the upgrade-gradle-7.5.1 branch November 30, 2022 13:50
@erichaagdev erichaagdev mentioned this pull request Nov 30, 2022
5 tasks
popd;
fi;
if [ -n $TRAVIS_TAG ] && [[ "$TRAVIS_TAG" =~ ^[v][0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Publishing the gradle plugin to Gradle Portal on tag $TRAVIS_TAG (only)";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" publishPlugins -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET --no-daemon;
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" publishPlugins -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erichaagdev we're working on v6.3.0 release but Travis CI shows the following errors:

For more details see https://docs.gradle.org/7.6/release-notes.html


> Configure project :
Signing plugin detected. Will automatically sign the published artifacts.

> Task :pluginDescriptors UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :sourcesJar UP-TO-DATE
> Task :generatePomFileForPluginMavenPublication
> Task :generatePomFileForOpenApiGeneratorPluginMarkerMavenPublication
> Task :signOpenApiGeneratorPluginMarkerMavenPublication FAILED

> Task :compileKotlin
w: /home/travis/build/OpenAPITools/openapi-generator/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt: (805, 48): 'getter for config: CodegenConfig!' is deprecated. Deprecated in Java
w: /home/travis/build/OpenAPITools/openapi-generator/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt: (811, 40): 'getter for config: CodegenConfig!' is deprecated. Deprecated in Java

FAILURE: Build failed with an exception.

* What went wrong:
Could not evaluate onlyIf predicate for task ':signOpenApiGeneratorPluginMarkerMavenPublication'.
> Could not evaluate spec for 'Signing is required, or signatory is set'.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 9s
7 actionable tasks: 4 executed, 3 up-to-date

Do you know what may have caused this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants