Skip to content

Conversation

danhyun
Copy link
Contributor

@danhyun danhyun commented Apr 5, 2018

Configuration#getResolvedConfiguration() set to be deprecated in favor of using DependencyResult

Future releases will have a direct method to find all unresolved deps in a more straightforward manner.

@philwebb
Copy link
Member

philwebb commented Apr 6, 2018

@wilkinsona 2.1 or 2.x?

@wilkinsona
Copy link
Member

Ideally neither in its current form as it introduces the use of an internal type. I need to take some time to understand the problem and consider any alternatives.

@wilkinsona
Copy link
Member

I've pushed a branch that takes a slightly different approach and avoids the use of any internal API. However, it does still introduce the use of some incubating API:

  • org.gradle.api.artifacts.component.ComponentSelector
  • org.gradle.api.artifacts.component.ModuleComponentSelector
  • org.gradle.api.artifacts.result.UnresolvedDependencyResult

By contrast, the current code doesn't use any internal or incubating API. So, while I think the code in my branch is slightly better than the code proposed in this pull request, it does still add some risk compared to what we currently have.

@danhyun Can you please help me to understand why you've proposed this change? Can you point me to Gradle's plans for deprecating Configuration#getResolvedConfiguration? If it's going away, I would hope that the alternatives are going to graduate from incubation.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Apr 6, 2018
@danhyun
Copy link
Contributor Author

danhyun commented Apr 6, 2018

@wilkinsona thanks for the work!
I'm afraid all I can offer is the equivalent of a hallway conversation.

Another motivation for this PR is that plugin interactions causes Gradle to go into a tailspin, specifically interaction between Nebula's resolution/alignment functionality and the use of configuration.getResolvedConfiguration().

I spoke with some of the folks at Gradle about the usage of getResolvedConfiguration() and that's where they revealed the intention to take it out of incubating and even add getUnresolvedDependencies() to the DependencyResult in upcoming 5.X line.

This PR is an attempt to let users continue to consume Nebula plugin along with Spring Boot 2 plugin in a future forward looking manner.

I prefer your branch over mine for the same objection of using internals (yuck), I didn't even stop to check that that was what I was doing. (Would be a good time to add a lint rule to leave that as a warning although I've heard plugin maintainers argue that they can't get what they need otherwise :| ). I'm in favor of closing this PR if you'll include that other branch in the next release.

@wilkinsona
Copy link
Member

@danhyun I'm still rather reluctant to move onto incubating API, certainly until we've eliminated other possibilities. I tried using your minimal sample to reproduce the problem and failed to do so. Could you please point me in the right direction? Looking at the StackOverflowError, I'm wondering if keeping track of the configurations that have already been seen would be sufficient to break the cycle.

@danhyun
Copy link
Contributor Author

danhyun commented Apr 9, 2018

@wilkinsona we do keep track of configurations that we have seen, there's an issue with how a given config is created by the time it comes back to Nebula.

If you step through the debugger you'll find that the configuration name doesn't match up with what it is supposed to be, namely that it's being reported as the original config when in fact we're looking at a copy of that configuration.

I'll do a bit more digging to make sure that we've exhausted our options from Nebula's perspective.

Here's a reliable way to reproduce what I've been seeing.

boom.gradle

plugins {
  id "nebula.resolution-rules" version "5.1.1"
  id 'org.springframework.boot' version '2.0.1.RELEASE'
}

apply plugin: 'java'

repositories {
  jcenter()
}

dependencies {
  resolutionRules 'com.netflix.nebula:gradle-resolution-rules:latest.release'
  implementation 'javax.inject:javax.inject:1.0'
}

To reproduce:
gradle -s -b boom.gradle dependencies

@danhyun danhyun changed the title Use DependencyResult to determine unresolved deps Ensure that we're strictly checking the incoming resolvable dependencies that we've meant to check for dangling modules Apr 9, 2018
@danhyun danhyun closed this Apr 9, 2018
@danhyun danhyun reopened this Apr 9, 2018
@danhyun
Copy link
Contributor Author

danhyun commented Apr 9, 2018

I've switched gears a bit.
New strategy here is to check that we're analyzing the unresolved modules for the proper config.
It's possible that Gradle will emit resolved events for copies of the original configuration that will trigger the action that we've registered for that original hook.

We ran into the same thing in Nebula and added a check such as:

https://github.com/nebula-plugins/nebula-gradle-interop/blob/master/src/main/kotlin/com/netflix/nebula/interop/configurations.kt

To ensure that we don't spiral out of control.

@wilkinsona
Copy link
Member

Very nice! Thanks, @danhyun.

@wilkinsona wilkinsona added type: task A general task type: bug A general bug and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged type: task A general task labels Apr 10, 2018
@wilkinsona wilkinsona added this to the 2.0.x milestone Apr 10, 2018
@danhyun
Copy link
Contributor Author

danhyun commented Apr 10, 2018

Thanks! I'm guessing this will get out with the 2.0.2 release next month? https://github.com/spring-projects/spring-boot/milestone/109

@wilkinsona wilkinsona changed the title Ensure that we're strictly checking the incoming resolvable dependencies that we've meant to check for dangling modules Gradle plugin may check the unresolved dependencies of a configuration's copy, resulting in a StackOverflowError when combined with the nebula.resolution-rules plugin Apr 10, 2018
@danhyun
Copy link
Contributor Author

danhyun commented Apr 17, 2018

Are all items in 2.0.x milestone expected to ship with the next patch?
Just curious about when we can expect this to land.

@wilkinsona
Copy link
Member

An issue assigned to 2.0.x will be fixed in a 2.0.something release, but we haven't yet committed to fixing it in the next patch release.

@wilkinsona wilkinsona self-assigned this Apr 23, 2018
@wilkinsona wilkinsona modified the milestones: 2.0.x, 2.0.2 Apr 23, 2018
wilkinsona added a commit that referenced this pull request Apr 23, 2018
* gh-12784:
  Polish “Only analyze configurations that we've registered to check”
  Only analyze configurations that we've registered to check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants