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

Upgrade Spotless minor version and reformat #167

Merged
merged 9 commits into from
Feb 18, 2023

Conversation

TWiStErRob
Copy link
Collaborator

@TWiStErRob TWiStErRob commented Feb 16, 2023

I updated the version and then ran gradlew spotlessApply continously.

I observed pinterest/ktlint#1786, but on second run it's ok.

Spotless upgraded Ktlint from 0.43.0 to 0.48.2 (actually 0.48.1, because can't go to latest), see https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md for each bump.

Trailing commas

In Ktlint 0.48.0 the default for trailing commas changed:
https://github.com/pinterest/ktlint/releases/tag/0.48.0
(see 2nd and 3rd points in "Changed" section at the bottom)

Latest version

Can't update straight to latest, and any further updates are blocked on reviewing CI approach (CI matrix -> Gradle task toolchains).

TWiStErRob added a commit to TWiStErRob/nexus-publish-gradle-plugin that referenced this pull request Feb 16, 2023
Also in gradle-nexus#167, but it's annoying not being able to get a green build locally.
Copy link
Contributor

@szpak szpak left a comment

Choose a reason for hiding this comment

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

Thanks! I left two questions inline.

@TWiStErRob
Copy link
Collaborator Author

So is this good to go, or need to do something?

@szpak
Copy link
Contributor

szpak commented Feb 16, 2023

It's a global change, so let's wait until tomorrow for comments, but I'm fine with it as is.

TWiStErRob added a commit to TWiStErRob/nexus-publish-gradle-plugin that referenced this pull request Feb 17, 2023
Also in gradle-nexus#167, but it's annoying not being able to get a green build locally.
because the language version Kotlin 1.3 did not implement this yet.

> Task :compileKotlin FAILED
e: /home/runner/work/publish-plugin/publish-plugin/src/main/kotlin/....kt: (0, 0): The feature "trailing commas" is only available since language version 1.4
From 6.13.0 to 6.14.0, Spotless casually dropped Java 8 support:
https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md#6140---2023-01-26

What is a major change, if inability to use is not 🙄?
…tforms.

Also add .editorconfig entries so IDE doesn't mess with the files.
szpak pushed a commit that referenced this pull request Feb 17, 2023
* Bump Gradle Wrapper to Gradle 8.0 (from 6.9)

* Remove outdated DSL: kotlinDslPluginOptions.experimentalWarning

> Configure project :buildSrc
e: P:\projects\contrib\github-nexus-publish-plugin\buildSrc\build.gradle.kts:14:5: Unresolved reference: experimentalWarning

> Configure project :buildSrc
The KotlinDslPluginOptions.experimentalWarning property has been deprecated. This is scheduled to be removed in Gradle 8.0. Flag has no effect since `kotlin-dsl` no longer relies on experimental features.
        at Build_gradle$3.execute(build.gradle.kts:14)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

* Update Shadow plugin, because 6.1.0 is not compatible with Gradle 7.x and Gradle 8.x

* What went wrong:
org/gradle/api/plugins/MavenPlugin

* Try:
> Run with --info or --debug option to get more log output.

* Exception is:
java.lang.NoClassDefFoundError: org/gradle/api/plugins/MavenPlugin
        at com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin$1.execute(ShadowJavaPlugin.groovy:101)

* Regenerate Gradle Wrapper with Gradle 8.0

* Bump Versions plugin, Gradle 7.x support is full-blown from 0.43.0

Gradle 7.4 fixes:
https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.42.0

Gradle 7 required:
https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.43.0

* Bump plugin-publish plugin to 1.x

pluginBundle was deprecated in Gradle 7.6 and removed in Gradle 8.0:
https://plugins.gradle.org/plugin/com.gradle.plugin-publish/1.0.0

maven-publish is auto-applied

* Lock in Java compilation version to the same as Kotlin, otherwise things can go wrong.

> Task :compileKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> 'compileJava' task (current target is 11) and 'compileKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

* ConfigureUtil is deprecated in Gradle 7.1 and started nagging in Gradle 7.6. Building with Gradle 8.0 will obviously also warn. Let's suppress it for now, this will be dealt with in #152

* Add support for Spotless on Windows

Also in #167, but it's annoying not being able to get a green build locally.

* Move sourceCompatibility to the existing java block

* Keep building Kotlin with 1.3 compatibility, otherwise there are failures on older Gradle versions.

For example: NexusPublishPluginTests.should close staging repository
```
> Task :closeSonatypeStagingRepository FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':closeSonatypeStagingRepository'.
> kotlin.jvm.internal.PropertyReference1Impl.<init>(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
```

* Silence unnecessary build warnings.

> Task :compileKotlin
w: API version 1.3 is deprecated and its support will be removed in a future version of Kotlin

> Task :compileTestKotlin
w: API version 1.3 is deprecated and its support will be removed in a future version of Kotlin

> Task :compileCompatTestKotlin
w: API version 1.3 is deprecated and its support will be removed in a future version of Kotlin

* Remove duplicate calls to withSourcesJar

It's done by the plugin-publish plugin too.
In the Gradle Metadata (.module) it duplicates artifacts if called multiple times.

* Remove unnecessary shadowed configuration

There is built-in support for standard configuration in plugin-publish and shadow plugins.

* Remove unidentified workaround

It doesn't change anything in the output publishToMavenLocal, it was probably for an older combination of Gradle / plugin-publish / shadow plugins.

* Work around unnecessary ClassPath in MANIFEST.MF

* Downgrade language version from Kotlin 1.8 to Kotlin 1.3 to generate compatible @kotlin.Metadata in the .class files.

* Remove unrelated change.

* Diagnose #168 (comment)

* Revert "Diagnose #168 (comment)"

This reverts commit c14acc5.

* Mention Kotlin 1.3 #168 (comment)

* Reduce CI load, re #168 (comment)

* Diagnose #168 (comment)

* Revert "Diagnose #168 (comment)"

This reverts commit 8488741.

* Add sha256 to wrapper
@szpak szpak added this to the 1.2.0 milestone Feb 17, 2023
@szpak szpak added this pull request to the merge queue Feb 18, 2023
Merged via the queue into gradle-nexus:master with commit 3216629 Feb 18, 2023
@TWiStErRob TWiStErRob deleted the spotless_upgrade branch February 19, 2023 10:13
@vlsi
Copy link
Contributor

vlsi commented Feb 19, 2023

This causes "all lines modified in gradlew.bat.

@TWiStErRob , have you done git add --renormalize . when creating the PR?

@TWiStErRob
Copy link
Collaborator Author

TWiStErRob commented Feb 19, 2023

Hmm, I don't remember doing that. Thanks for the fix in #180!

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

Successfully merging this pull request may close these issues.

None yet

3 participants