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

Don't crash in the Gradle plugin assigning isCanBeConsumed #2681

Closed
wants to merge 1 commit into from

Conversation

swankjesse
Copy link
Collaborator

@swankjesse swankjesse commented Oct 16, 2023

This PR is attempting to prevent this crash:

org.gradle.api.GradleException: Cannot change the allowed usage of configuration ':protos:protoSourceCopy', as it was locked upon creation to the role: 'Custom Role'.
This role permits the following usage:
        Consumable - this configuration can be selected by another project as a dependency (but this behavior is marked deprecated)
        Resolvable - this configuration can be resolved by this project to a set of files
        Declarable Against - this configuration can have dependencies added to it
Ideally, each configuration should be used for a single purpose.
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.assertUsageIsMutable(DefaultConfiguration.java:1787)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.preventIllegalMutation(DefaultConfiguration.java:1556)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:1510)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.setCanBeConsumed(DefaultConfiguration.java:1866)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.setCanBeConsumed(Unknown Source)
        at com.squareup.wire.gradle.WirePlugin.setupWireTasks(WirePlugin.kt:147)

I believe the root cause is a regression fixed in Gradle 8.4 gradle/gradle@edc8ab0

This PR is attempting to prevent this crash:
    org.gradle.api.GradleException: Cannot change the allowed usage of configuration ':protos:protoSourceCopy', as it was locked upon creation to the role: 'Custom Role'.
    This role permits the following usage:
            Consumable - this configuration can be selected by another project as a dependency (but this behavior is marked deprecated)
            Resolvable - this configuration can be resolved by this project to a set of files
            Declarable Against - this configuration can have dependencies added to it
    Ideally, each configuration should be used for a single purpose.
            at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.assertUsageIsMutable(DefaultConfiguration.java:1787)
            at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.preventIllegalMutation(DefaultConfiguration.java:1556)
            at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:1510)
            at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.setCanBeConsumed(DefaultConfiguration.java:1866)
            at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.setCanBeConsumed(Unknown Source)
            at com.squareup.wire.gradle.WirePlugin.setupWireTasks(WirePlugin.kt:147)

I believe the root cause is a regression fixed in Gradle 8.4
gradle/gradle@edc8ab0
@swankjesse
Copy link
Collaborator Author

I’m gonna check if upgrading to Gradle 8.4 fixes this so I don’t need to take further action.

@swankjesse
Copy link
Collaborator Author

This is unnecessary. Upgrading to Gradle 8.4 is sufficient.

@swankjesse swankjesse closed this Oct 16, 2023
@oldergod
Copy link
Member

Related to #2676

@oldergod oldergod deleted the jwilson.1016.dont_crash branch October 17, 2023 08:02
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.

3 participants