Skip to content

Commit

Permalink
Ignore all empty resolved configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Jul 14, 2023
1 parent 22bd80a commit 04cb3c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class MultiProjectDependencyExtractorTest extends BaseExtractorTest {
])
}


def "extracts dependencies from buildSrc project"() {
given:
file("buildSrc/settings.gradle") << "rootProject.name = 'buildSrc'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ abstract class DependencyExtractor :
) {
val repositoryLookup = RepositoryUrlLookup(details, result)
val rootComponent = result.rootComponent
val projectIdentityPath = (rootComponent.id as? DefaultProjectComponentIdentifier)?.identityPath?.path

if (projectIdentityPath == null && rootComponent.dependencies.isEmpty()) {
// Not a project configuration, and no dependencies to extract: can safely ignore
if (rootComponent.dependencies.isEmpty()) {
// No dependencies to extract: can safely ignore
return
}

// TODO: At this point, any resolution not bound to a particular project will be assigned to the root "build :"
// This is because `details.buildPath` is always ':', which isn't correct in a composite build.
// It is possible to do better. By tracking the current build operation context, we can assign more precisely.
// See the Gradle Enterprise Build Scan Plugin: `ConfigurationResolutionCapturer_5_0`
val projectIdentityPath = (rootComponent.id as? DefaultProjectComponentIdentifier)?.identityPath?.path
val rootPath = projectIdentityPath ?: details.buildPath
val rootId = if (projectIdentityPath == null) "build $rootPath" else componentId(rootComponent)
val resolutionRoot = ResolutionRoot(rootId, rootPath)
Expand Down

0 comments on commit 04cb3c1

Please sign in to comment.