dropbox / dependency-guard

A Gradle plugin that guards against unintentional dependency changes.
Apache License 2.0
406 stars 15 forks source link

Tree format requires Gradle 7.4 or higher #40

Closed mezpahlan closed 2 years ago

mezpahlan commented 2 years ago

Hi team!

I wanted to play around with the tree format described in the README and came across the following error:

java.lang.NoClassDefFoundError: org/gradle/configurationcache/extensions/CharSequenceExtensionsKt
    at com.dropbox.gradle.plugins.dependencyguard.internal.DependencyTreeDiffTaskNames.createDependencyTreeTaskNameForConfiguration(DependencyTreeDiffTaskNames.kt:8)
    at com.dropbox.gradle.plugins.dependencyguard.DependencyGuardPlugin$registerTreeDiffTasks$1.execute(DependencyGuardPlugin.kt:108)
    at com.dropbox.gradle.plugins.dependencyguard.DependencyGuardPlugin$registerTreeDiffTasks$1.execute(DependencyGuardPlugin.kt:16)

I'm using version 0.3.0 of the plugin with Gradle 7.2 in our project.

I think this is because it relies on the CharSequence.capitalized() extension defined in /src/main/kotlin/org/gradle/configurationcache/extensions/CharSequenceExtensions.kt which only landed in Gradle 7.4.

image

Perhaps a small update to the README to point this out might be useful? Alternatively there is probably a Kotlin extension that does something similar?

Cheers.

handstandsam commented 2 years ago

Interesting. Thanks for calling this out. If it's an easy if/else I'm happy to take a fix. Otherwise, I think 7.4+ for this option seems reasonable. (since it's non-default)

Thoughts?

handstandsam commented 2 years ago

I downgraded to 7.2 and am able to replicate:


e: /Users/samedwards/src/dependency-guard/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/DependencyTreeDiffTaskNames.kt: (3, 49): Unresolved reference: capitalized
e: /Users/samedwards/src/dependency-guard/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/DependencyTreeDiffTaskNames.kt: (8, 55): Unresolved reference: capitalized
e: /Users/samedwards/src/dependency-guard/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/DependencyTreeDiffTaskNames.kt: (12, 63): Unresolved reference: capitalized
e: /Users/samedwards/src/dependency-guard/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/utils/Tasks.kt: (9, 13): Unresolved reference: doNotTrackState
e: /Users/samedwards/src/dependency-guard/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/utils/Tasks.kt: (16, 13): Unresolved reference: notCompatibleWithConfigurationCache```
mezpahlan commented 2 years ago

Sorry, I'm late picking up these messages. Yup, I'm in full agreement with your PR fix.

Many thanks for the quick turn around ☺️.