mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
gradle: do not confuse main module artifacts with test artifacts
This commit is contained in:
+6
-2
@@ -196,8 +196,12 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
if (defaultArtifacts != null) {
|
||||
artifacts.addAll(defaultArtifacts);
|
||||
}
|
||||
final Set<File> archivesArtifacts = externalProject.getArtifactsByConfiguration().get("archives");
|
||||
if (archivesArtifacts != null) {
|
||||
if (externalProject.getArtifactsByConfiguration().get("archives") != null) {
|
||||
final Set<File> archivesArtifacts = ContainerUtil.newHashSet(externalProject.getArtifactsByConfiguration().get("archives"));
|
||||
final Set<File> testsArtifacts = externalProject.getArtifactsByConfiguration().get("tests");
|
||||
if (testsArtifacts != null) {
|
||||
archivesArtifacts.removeAll(testsArtifacts);
|
||||
}
|
||||
artifacts.addAll(archivesArtifacts);
|
||||
}
|
||||
} else if("test".equals(sourceSet.getName())) {
|
||||
|
||||
+38
@@ -206,4 +206,42 @@ public class GradleDependenciesImportingTest extends GradleImportingTestCase {
|
||||
assertModuleLibDep("project_main", depName, "file://" + path);
|
||||
assertModuleLibDepScope("project_main", depName, DependencyScope.RUNTIME);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProjectArtifactDependencyInTestAndArchivesConfigurations() throws Exception {
|
||||
createSettingsFile("include 'api', 'impl' ");
|
||||
|
||||
importProject(
|
||||
"allprojects {\n" +
|
||||
" apply plugin: 'java'\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"project(\"api\") {\n" +
|
||||
" configurations {\n" +
|
||||
" tests\n" +
|
||||
" }\n" +
|
||||
" task testJar(type: Jar, dependsOn: testClasses, description: \"archive the testClasses\") {\n" +
|
||||
" baseName = \"${project.archivesBaseName}-tests\"\n" +
|
||||
" classifier = \"tests\"\n" +
|
||||
" from sourceSets.test.output\n" +
|
||||
" }\n" +
|
||||
" artifacts {\n" +
|
||||
" tests testJar\n" +
|
||||
" archives testJar\n" +
|
||||
" }\n" +
|
||||
"}\n" +
|
||||
"project(\"impl\") {\n" +
|
||||
" dependencies {\n" +
|
||||
" testCompile project(path: ':api', configuration: 'tests')\n" +
|
||||
" }\n" +
|
||||
"}\n"
|
||||
);
|
||||
|
||||
assertModules("project", "project_main", "project_test", "api", "api_main", "api_test", "impl", "impl_main", "impl_test");
|
||||
|
||||
assertModuleModuleDepScope("project_test", "project_main", DependencyScope.COMPILE);
|
||||
assertModuleModuleDepScope("api_test", "api_main", DependencyScope.COMPILE);
|
||||
assertModuleModuleDepScope("impl_test", "impl_main", DependencyScope.COMPILE);
|
||||
assertModuleModuleDepScope("impl_test", "api_test", DependencyScope.COMPILE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user