mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
watch for ".gradle" scripts, not "gradle" dirs IDEA-193631
This commit is contained in:
+2
-2
@@ -49,11 +49,11 @@ public class GradleAutoImportAware implements ExternalSystemAutoImportAware {
|
||||
@Nullable
|
||||
@Override
|
||||
public String getAffectedExternalProjectPath(@NotNull String changedFileOrDirPath, @NotNull Project project) {
|
||||
if (!changedFileOrDirPath.endsWith(GradleConstants.EXTENSION)) {
|
||||
if (!changedFileOrDirPath.endsWith("." + GradleConstants.EXTENSION)) {
|
||||
return null;
|
||||
}
|
||||
File file = new File(changedFileOrDirPath);
|
||||
if(file.isDirectory()) {
|
||||
if (file.isDirectory()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.gradle.importing;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.plugins.gradle.service.project.GradleAutoImportAware;
|
||||
import org.junit.Test;
|
||||
|
||||
public class GradleAutoImportAwareTest extends GradleImportingTestCase {
|
||||
|
||||
@Test
|
||||
public void testDirectoriesNotWatched() throws Exception {
|
||||
createProjectSubFile("src/main/java/my/pack/gradle/A.java");
|
||||
final VirtualFile file = createProjectSubFile("buildScripts/myScript.gradle");
|
||||
importProjectUsingSingeModulePerGradleProject("apply plugin: 'java'");
|
||||
|
||||
assertModules("project");
|
||||
|
||||
final GradleAutoImportAware gradleAutoImportAware = new GradleAutoImportAware();
|
||||
|
||||
final Module module = ModuleManager.getInstance(myProject).getModules()[0];
|
||||
final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
|
||||
final String outputPath = VfsUtilCore.urlToPath(compilerModuleExtension.getCompilerOutputUrl() + "/my/pack/gradle");
|
||||
|
||||
assertNull(gradleAutoImportAware.getAffectedExternalProjectPath(outputPath, myProject));
|
||||
assertNotNull(gradleAutoImportAware.getAffectedExternalProjectPath(file.getPath(), myProject));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user