mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-169388 Resources not copied to output folder if Gradle project name is 'test'
This commit is contained in:
+6
-3
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.gradle.model.DefaultExternalProject;
|
||||
import org.jetbrains.plugins.gradle.model.ExternalProject;
|
||||
import org.jetbrains.plugins.gradle.model.ExternalSourceSet;
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
@@ -101,13 +102,15 @@ public class ExternalProjectDataCache {
|
||||
@NotNull
|
||||
public Map<String, ExternalSourceSet> findExternalProject(@NotNull ExternalProject parentProject, @NotNull Module module) {
|
||||
String externalProjectId = ExternalSystemApiUtil.getExternalProjectId(module);
|
||||
return externalProjectId != null ? findExternalProject(parentProject, externalProjectId)
|
||||
boolean isSourceSet = GradleConstants.GRADLE_SOURCE_SET_MODULE_TYPE_KEY.equals(ExternalSystemApiUtil.getExternalModuleType(module));
|
||||
return externalProjectId != null ? findExternalProject(parentProject, externalProjectId, isSourceSet)
|
||||
: Collections.emptyMap();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Map<String, ExternalSourceSet> findExternalProject(@NotNull ExternalProject parentProject,
|
||||
@NotNull String externalProjectId) {
|
||||
@NotNull String externalProjectId,
|
||||
boolean isSourceSet) {
|
||||
Queue<ExternalProject> queue = ContainerUtil.newLinkedList();
|
||||
queue.add(parentProject);
|
||||
|
||||
@@ -119,7 +122,7 @@ public class ExternalProjectDataCache {
|
||||
for (Map.Entry<String, ExternalSourceSet> sourceSetEntry : externalProject.getSourceSets().entrySet()) {
|
||||
final String sourceSetName = sourceSetEntry.getKey();
|
||||
final String sourceSetId = projectId + ":" + sourceSetName;
|
||||
if (isRelatedProject || externalProjectId.equals(sourceSetId)) {
|
||||
if (isRelatedProject || (isSourceSet && externalProjectId.equals(sourceSetId))) {
|
||||
result.put(sourceSetName, sourceSetEntry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
+23
@@ -302,6 +302,29 @@ public class GradleResourceProcessingTest extends GradleCompilingTestCase {
|
||||
assertCopiedResources();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModuleWithNameTestResourceCopying() throws Exception {
|
||||
createProjectSubFile("bar/foo/src/main/resources/dir/file.properties");
|
||||
createProjectSubFile("bar/foo/src/test/resources/dir/file-test.properties");
|
||||
createProjectSubFile("bar/test/src/main/resources/dir/file.properties");
|
||||
createProjectSubFile("bar/test/src/test/resources/dir/file-test.properties");
|
||||
createSettingsFile("include ':bar:foo'\n" +
|
||||
"include ':bar:test'");
|
||||
|
||||
importProjectUsingSingeModulePerGradleProject(
|
||||
"subprojects {\n" +
|
||||
" apply plugin: 'java'\n" +
|
||||
"}\n"
|
||||
);
|
||||
assertModules("project", "bar", "foo", "test");
|
||||
compileModules("project", "bar", "foo", "test");
|
||||
|
||||
assertCopied("bar/foo/build/resources/main/dir/file.properties");
|
||||
assertCopied("bar/foo/build/resources/test/dir/file-test.properties");
|
||||
assertCopied("bar/test/build/resources/main/dir/file.properties");
|
||||
assertCopied("bar/test/build/resources/test/dir/file-test.properties");
|
||||
}
|
||||
|
||||
private void createFilesForIncludesAndExcludesTest() throws IOException {
|
||||
createProjectSubFile("src/main/resources/dir/file.xxx");
|
||||
createProjectSubFile("src/main/resources/dir/file.yyy");
|
||||
|
||||
Reference in New Issue
Block a user