-
Notifications
You must be signed in to change notification settings - Fork 29
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
ConfigureUtil deprecation warning #152
Comments
I've also started seeing this after upgrading to Gradle 7.6. |
Looks like |
I've also noticed the same since I bumped the wrapper to 7.6 inside one of my company's project 👀
If useful, here the |
8.0-rc-1 is out now. This issue will become a blocker pretty soon. |
There's another callsite in the same file (curtesy of Mockito using this plugin):
|
Note: Gradle recommends to work around the need for ConfigureUtil by following this approach: https://docs.gradle.org/7.6/javadoc/org/gradle/util/ConfigureUtil.html |
Luckily, they seem to postpone the removal to 9.0 ;-).
Anyway (from #157, part full-faced by me):
@nedtwigg If you provide a simple and elegant solution, preferably keeping Gradle 6+ compatibility, I will do my best to review your PR in a timely manner :-). Key places in code: publish-plugin/src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishExtension.kt Line 53 in ab77ce3
and: Lines 27 to 43 in ab77ce3
|
Do you know why? Because the plugin authors are not moving and Gradle don't want to break/overload end users. 😉 I also did a background investigation for a similar deprecated API which was quite a rollercoaster of commits. 😅 |
Thanks @nedtwigg. To be honest, before I wrote my comment, I've just removed the methods with Closure, but it broke functional tests (Gradle 6, AFAIR also 7). As it is mentioned in the linked documentation:
which is nice, however, we create As you see in the CI build reports, both builds fail on CI :-/. To test it locally with functional tests, you can call WDYT? |
maybe you can use Groovy closures from Kotlin? |
There's no point in doing that.
|
… internal APIs. This method is implemented from NamedDomainObjectContainer, which we implement by delegation, so we should keep configuring the original collection. This container only exists to slap some more methods onto the original class.
@nedtwigg @szpak using There are two issues here (two distinct usages of
|
Raised gradle/gradle#23874 to maybe get help with removing |
Thanks guys. I've merged #162 and will wait a while for any response in gradle/gradle#23874 before "copy-pasting" |
…le 7.6. Building with Gradle 8.0 will obviously also warn. Let's suppress it for now, this will be dealt with in gradle-nexus#152
A quick update on this (and guidance for @szpak to navigate my contributions):
@szpak, also while doing the above I found a few other opportunities for reducing tech debt:
|
In my view, the best thing is to remove If keeping Closure for pre-7.0 Groovy users is important to you, I think the fix in #160 is the best way. But definitely bumping the minimum to Gradle 7 and removing the |
I would prefer to release one more version supporting Gradle 6+. To do so, I would sway for #160 (copy paste WDYT about this plan? |
Works for me! |
My latest invention is backwards and forwards compatible on all supported versions. It doesn't matter what Gradle the build is using, only the jar it produces. So using the internal API temporarily is a good stopgap to support any version range. So there's no need to copy-paste and then delete it. Note: I can make a quick fix out of this without needing Gradle 7/8 upgrade too, because the class/interface is well-known, so reflection is fine. |
By the time this becomes an issue again, hopefully we'll get some response from Gradle, but we can always fall back to copy-paste. |
I would disagree here. I incline that solution I propose in gradle/gradle#23874 (comment) is a low-hanging fruit. At the end of the day, they could expose
+1 |
Oh, I missed that fact that it requires 7.1, but should work also with 6.x. Nice. I locally cherry-picked that change to master (and Gradle migration to 7.1) and from the regression tests, it works with Gradle 6.8+ [1], which is enough. However, I'm more a Groovy guy than a Kotlin one. Do you think, Gradle 7 and its migration to Kotlin 1.4 could affect 6.x users? Or we should rather use a reflection and still build that next release with Gradle 6.9? [1] - FYI. For lower Gradle versions (<6.8) I had:
and:
|
Sorry if I got smth wrong, but what prevents you from using |
Gradle migration to 7.1 is also non-trivial, you'll still need most of the changes in the Gradle 8 PR. Let's just merge that one and get through, @szpak.
The PR (TWiStErRob#5) is against the Gradle 8 branch for a reason. The errors you've seen I went through and fixed each in the Gradle 8 PR.
If you merge the Gradle 8 PR, this project will build with Gradle 8, but it'll be compatible with all the Gradle 5-8 versions with all their Kotlin 1.3-1.8 range (it's similar to building with Java 17, but also
Re @remal, actually I'll have to recheck, because I might've looked on Gradle 6.9 APIs, which could be missing an overload we need (that was added in Gradle 7.1), but Gradle 8 PR will still be necessary to be able to at least conditionally call the replacement API, if it exists. |
@szpak re errors, have a read of the individual commit messages in the Gradle 8 PR, I tried to list all the problems and solutions I encountered. |
@TWiStErRob, as I can see, I've written a bunch of Gradle plugins but never used Kotlin's |
@remal I've tried to use Do you have an example where you've written a |
…le 7.6. Building with Gradle 8.0 will obviously also warn. Let's suppress it for now, this will be dealt with in gradle-nexus#152
@remal , In other words, if the target object "implements Configurable", then Gradle uses the implemented |
* 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
@TWiStErRob Could you rebase TWiStErRob#5 and create it as a regular PR (in this repo)? WE could merge it next (as #168 is done). |
Raised #172 as rebase of TWiStErRob#5 + fix for #164's ignore. (no testing locally, I'll let the CI do the honors) Edit: too confident 😅, investigating. |
Fixed, how good that we merged #164, huh? 😁 |
* Workaround to "remove" the last usage of ConfigureUtil. * Remove condition so that strict checking stays the default.
Hopefully, the deprecation warning is addressed for the time being. I still hope to get some response from the Gradle team about gradle/gradle#23874, with #165 as a non backward compatible idea as a fallback. Big thanks to @TWiStErRob @vlsi @nedtwigg for theirs PRs and the others for suggestions and nagging ;). Btw, I enabled Discussions for the project which would a probably a better place to discuss different things, also related with the incoming release of 1.2.0. |
fyi I noticed this in a build scan,
publish-plugin/src/main/kotlin/io/github/gradlenexus/publishplugin/DefaultNexusRepositoryContainer.kt
Line 32 in 0aea955
The text was updated successfully, but these errors were encountered: