Skip to content

Non-reproducible behavior around dependency verification with Spotless plugin #815

Closed

Description

@JLLeitschuh

Activity

  1. nedtwigg commented on Apr 20, 2021

    @nedtwigg
    Member

    Seems like this is becoming an issue for more people, so I'll outline some fixes.

    Easy surface fix

    One thing which might work is to switch from detached configurations to named configurations.

    Configuration config = project.getRootProject().getBuildscript().getConfigurations().detachedConfiguration(deps);
    config.setDescription(mavenCoords.toString());
    config.setTransitive(withTransitives);
    return config.resolve();

    I would do this by generating a name like spotless<Hash> using GradleProvisioner.Request::hashCode. This is pretty easy to try, and it might completely fix the issues linked above.

    Hard deep fix

    A harder thing to do is to rip up the entire FormatterStep abstraction to somehow add a way to expose the maven coordinates needed by that FormatterStep. This would be a major effort, but would unblock #834, #724, and maybe #644 too.

    This deeper fix should be slower than what we're doing now. Rather than resolving google-java-format (or whatever) one time in the root project, we would be resolving it over and over in every subproject. But what we are doing now seems to be swimming upstream from Gradle, so maybe it would actually be faster.

    Implementing

    Doing the easy fix is easy, but it's not gonna make the top of my todo. If anyone wants to submit a PR, I'd be happy to merge and release.

    Doing the deeper fix is hard. If somebody wants to try, by all means feel free to take a shot. If you build something that works and fixes all the problems, I'll be happy to merge and release quickly. But there will certainly be lots of breaking changes in the lib and lib-extra projects, and probably lots of getting stuck. I'll try to help you get unstuck, but I can't make any SLA guarantees :)

  2. nedtwigg commented on Apr 21, 2021

    @nedtwigg
    Member

    In plugin-gradle 5.12.4, I implemented the shallow fix. We'll see if that solves the immediate issue...

  3. JLLeitschuh commented on Apr 21, 2021

    @JLLeitschuh
    MemberAuthor

    Rather than resolving google-java-format (or whatever) one time in the root project, we would be resolving it over and over in every subproject. But what we are doing now seems to be swimming upstream from Gradle, so maybe it would actually be faster.

    I have a hunch that Gradle's heavy use of caching won't have a huge impact on performance.

  4. nedtwigg commented on Nov 9, 2021

    @nedtwigg
    Member

    According to my testing, fixed by gradle/gradle#18915

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions