gradle: handle transitive dependency for project dependencies with non default configuration (IDEA-150058)

This commit is contained in:
Vladislav.Soroka
2016-04-07 14:30:46 +03:00
parent f16a1d9dca
commit 059abe72ad
2 changed files with 45 additions and 5 deletions
@@ -125,6 +125,46 @@ public class GradleDependenciesImportingTest extends GradleImportingTestCase {
}
}
@Test
@TargetVersions("2.0+")
public void testProvidedDependencyScopeMerge() throws Exception {
createSettingsFile("include 'web'\n" +
"include 'user'");
importProject(
"subprojects {\n" +
" apply plugin: 'java'\n" +
" configurations {\n" +
" provided\n" +
" }\n" +
"}\n" +
"\n" +
"project(':web') {\n" +
" dependencies {\n" +
" provided 'junit:junit:4.11'\n" +
" }\n" +
"}\n" +
"project(':user') {\n" +
" apply plugin: 'war'\n" +
" dependencies {\n" +
" compile project(':web')\n" +
" providedCompile project(path: ':web', configuration: 'provided')\n" +
" }\n" +
"}"
);
assertModules("project", "web", "web_main", "web_test", "user", "user_main", "user_test");
assertModuleLibDeps("web");
assertModuleLibDeps("web_main");
assertModuleLibDeps("web_test");
assertModuleModuleDeps("user_main", "web_main");
assertModuleModuleDepScope("user_main", "web_main", DependencyScope.COMPILE);
assertModuleLibDepScope("user_main", "Gradle: org.hamcrest:hamcrest-core:1.3", DependencyScope.PROVIDED);
assertModuleLibDepScope("user_main", "Gradle: junit:junit:4.11", DependencyScope.PROVIDED);
}
@Test
public void testCustomSourceSetsDependencies() throws Exception {
createSettingsFile("include 'api', 'impl' ");
@@ -773,11 +773,11 @@ class DependencyResolverImpl implements DependencyResolver {
dependency.projectDependencyArtifacts = artifactMap.get(componentResult.moduleVersion).collect { it.file }
dependency.projectDependencyArtifacts.each { resolvedDepsFiles.add(it) }
// if (componentResult != dependencyResult.from) {
// dependency.dependencies.addAll(
// transform(componentResult.dependencies)
// )
// }
if (componentResult != dependencyResult.from) {
dependency.dependencies.addAll(
transform(componentResult.dependencies)
)
}
dependencies.add(dependency)
def files = []