mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tests for groovy compiler in jps mode
This commit is contained in:
@@ -573,11 +573,11 @@ public class CompileDriver {
|
||||
);
|
||||
CompilerCacheManager.getInstance(myProject).flushCaches();
|
||||
|
||||
//final Set<File> outputs = new HashSet<File>();
|
||||
//for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) {
|
||||
// outputs.add(new File(path));
|
||||
//}
|
||||
//CompilerUtil.refreshIODirectories(outputs);
|
||||
final Set<File> outputs = new HashSet<File>();
|
||||
for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) {
|
||||
outputs.add(new File(path));
|
||||
}
|
||||
CompilerUtil.refreshIOFiles(outputs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -376,8 +376,7 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
return getMockJdk17("java 1.7");
|
||||
}
|
||||
public static Sdk getMockJdk17(String name) {
|
||||
File mockJdkCEPath = getPathForJdkNamed("mockJDK-1.7");
|
||||
return createMockJdk(mockJdkCEPath.getPath(), name, getInstance());
|
||||
return createMockJdk(getMockJdk17Path().getPath(), name, getInstance());
|
||||
}
|
||||
public static Sdk getMockJdk14() {
|
||||
File mockJdkCEPath = getMockJdk14Path();
|
||||
@@ -387,6 +386,9 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
public static File getMockJdk14Path() {
|
||||
return getPathForJdkNamed("mockJDK-1.4");
|
||||
}
|
||||
public static File getMockJdk17Path() {
|
||||
return getPathForJdkNamed("mockJDK-1.7");
|
||||
}
|
||||
|
||||
public static Sdk getWebMockJdk17() {
|
||||
Sdk jdk = getMockJdk17();
|
||||
|
||||
@@ -324,7 +324,7 @@ public class IdeaProjectLoader {
|
||||
Set<String> allContentRoots = project.modules.values().collect { it.contentRoots }.flatten() as Set
|
||||
project.modules.values().each { module ->
|
||||
Set<File> myRoots = module.contentRoots.collect { new File(it) } as Set
|
||||
Collection<String> newExcludes = (allContentRoots - module.contentRoots).findAll { PathUtil.isUnder(myRoots, new File(it)) }
|
||||
Collection<String> newExcludes = (allContentRoots - module.contentRoots).findAll { PathUtil.isUnder(myRoots, new File(it)) }.collect { FileUtil.toCanonicalPath(it) }
|
||||
module.excludes.addAll(newExcludes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class GroovycRunner {
|
||||
options.put("keepStubs", Boolean.TRUE);
|
||||
config.setJointCompilationOptions(options);
|
||||
|
||||
config.setTargetBytecode(CompilerConfiguration.POST_JDK5);
|
||||
config.setTargetBytecode(CompilerConfiguration.PRE_JDK5);
|
||||
}
|
||||
|
||||
System.out.println(PRESENTABLE_MESSAGE + "Groovyc: loading sources...");
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class GppCompilerTest extends GroovyCompilerTestCase {
|
||||
public abstract class GppCompilerTest extends GroovyCompilerTestCase {
|
||||
@Override protected void setUp() {
|
||||
super.setUp();
|
||||
PsiTestUtil.addLibrary myFixture.module, "gpp", TestUtils.absoluteTestDataPath + "/realGroovypp/", "groovy-all-1.8.2.jar", "groovypp-all-0.9.0_1.8.2.jar"
|
||||
@@ -115,4 +115,15 @@ class A {
|
||||
assertOutput "B", "239"
|
||||
}
|
||||
|
||||
public static class IdeaMode extends GppCompilerTest {
|
||||
@Override
|
||||
protected boolean useJps() { false }
|
||||
}
|
||||
|
||||
public static class JpsMode extends GppCompilerTest {
|
||||
@Override
|
||||
protected boolean useJps() { true }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+21
-6
@@ -26,7 +26,7 @@ import junit.framework.AssertionFailedError
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
public abstract class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
@Override protected void setUp() {
|
||||
super.setUp();
|
||||
addGroovyLibrary(myModule);
|
||||
@@ -49,7 +49,7 @@ public class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
" 239" +
|
||||
" }" +
|
||||
"}");
|
||||
assertEmpty(make());
|
||||
make();
|
||||
assertOutput("Foo", "239");
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
"}");
|
||||
final String barText = "class Bar {" + " def foo() { 239 }" + "}";
|
||||
final PsiFile file = myFixture.addFileToProject("Bar.groovy", barText);
|
||||
assertEmpty(make());
|
||||
make()
|
||||
assertOutput("Foo", "239");
|
||||
|
||||
setFileText(file, "class Bar {}");
|
||||
@@ -76,7 +76,7 @@ public class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
}
|
||||
|
||||
setFileText(file, barText);
|
||||
assertEmpty(make());
|
||||
make();
|
||||
assertOutput("Foo", "239");
|
||||
}
|
||||
|
||||
@@ -90,12 +90,12 @@ public class GroovyCompilerTest extends GroovyCompilerTestCase {
|
||||
final PsiFile bar =
|
||||
myFixture.addFileToProject("Bar.groovy", "public class Bar {" + "public int foo() { " + " return 239;" + "}" + "}");
|
||||
|
||||
assertEmpty(make());
|
||||
make();
|
||||
assertOutput("Foo", "239");
|
||||
|
||||
setFileName bar, "Bar.java"
|
||||
|
||||
assertEmpty(make());
|
||||
make();
|
||||
assertOutput("Foo", "239");
|
||||
}
|
||||
|
||||
@@ -416,5 +416,20 @@ class Usage {
|
||||
assertEmpty make()
|
||||
}
|
||||
|
||||
public void testGroovyAnnotations() {
|
||||
myFixture.addClass 'public @interface Anno { Class[] value(); }'
|
||||
myFixture.addFileToProject 'Foo.groovy', '@Anno([String]) class Foo {}'
|
||||
myFixture.addFileToProject 'Bar.java', 'class Bar extends Foo {}'
|
||||
|
||||
assertEmpty make()
|
||||
}
|
||||
|
||||
public static class IdeaMode extends GroovyCompilerTest {
|
||||
@Override protected boolean useJps() { false }
|
||||
}
|
||||
|
||||
public static class JpsMode extends GroovyCompilerTest {
|
||||
@Override protected boolean useJps() { true }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -58,9 +58,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestCase {
|
||||
private TempDirTestFixture myMainOutput;
|
||||
|
||||
private static boolean useJps() {
|
||||
return false;
|
||||
}
|
||||
protected abstract boolean useJps();
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -93,7 +91,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
|
||||
@Override
|
||||
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception {
|
||||
moduleBuilder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
|
||||
moduleBuilder.addJdk(JavaSdkImpl.getMockJdk14Path().getPath());
|
||||
moduleBuilder.addJdk(JavaSdkImpl.getMockJdk17Path().getPath());
|
||||
super.tuneFixture(moduleBuilder);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user