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

NamedDomainObjectContainer<T>.invoke(kotlin.Function1) has been deprecated #526

Closed
oehme opened this issue Oct 7, 2021 · 3 comments
Closed

Comments

@oehme
Copy link
Contributor

oehme commented Oct 7, 2021

Use NamedDomainObjectContainer<T>.invoke(Action) instead. Otherwise the plugin triggers deprecation warnings on Gradle 7 and will fail on Gradle 8. The problematic call is here.

@voidzcy
Copy link
Collaborator

voidzcy commented Oct 12, 2021

Duplicate of #444. We aren't able to migrate to the new API unless Gradle publishes artifacts of org.gradle:gradle-kotlin-dsl containing the API. See gradle/gradle#16884.

@oehme
Copy link
Contributor Author

oehme commented Oct 12, 2021

Plugins shouldn't be calling these methods at all, they are added to domain objects automatically by Gradle. ProtobufConfigurator/GenerateProtoTask should have Action-taking methods rather than Closure-taking methods. Gradle will automatically generate what Groovy and Kotlin need by runtime-subclassing ProtobufConfigurator. This works for project extensions, tasks and any other object created through project.objects.newInstance.

Also, you should remove ProtobufConvention. Instead, add the ProtobufConfigurator via project.extensions.create("protobuf", ProtobufConfigurator).

Finally, you should only use gradleApi, not depend on gradle-kotlin-dsl, which was never intended for consumption by plugins. It was an internal detail that the Kotlin DSL used to be in a different repository. It is now part of the Gradle monorepo, which is why it is no longer published.

@voidzcy
Copy link
Collaborator

voidzcy commented Jan 4, 2022

This should have been resolved by #531.

@voidzcy voidzcy closed this as completed Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants