Zak Taccardi
11/09/2024, 1:47 AMTask, what would be the right way to check if a configuration contains a specific local ProjectDependency?
I want to write a verification task that fails the build if that Configuration contains a subproject we don't publish externallyMartin
11/09/2024, 3:56 PMconfiguration.dependencies.any { it is ProjectDependency && it.dependencyProject.path == ":foo" }Vampire
11/09/2024, 4:01 PMVampire
11/09/2024, 4:01 PMMartin
11/09/2024, 4:01 PMMartin
11/09/2024, 4:01 PMVampire
11/09/2024, 4:03 PMMartin
11/09/2024, 4:35 PMval allGood: Provider<Boolean> = configuration.incoming.resolutionResult.rootComponent.map {
it.dependencies.any {
(it is ResolvedDependencyResult) && (it.selected.id as? ProjectComponentIdentifier)?.projectPath?.contains("foobar") == true
}
}
(edited to make it a bit more compact but can't beat the artifactView)Vampire
11/09/2024, 4:44 PMval allGood: Provider<Boolean> = configuration.incoming.artifactView {
componentFilter {
(it is ProjectComponentIdentifier) && (it.projectPath == ":what:ever")
}
}.artifacts.resolvedArtifacts.map { it.isEmpty() }