Fixed redeclaration from incremental compilation. Added workaround for JPS bug.

Original commit: 3226093fa6
This commit is contained in:
Evgeny Gerashchenko
2014-08-27 18:15:05 +04:00
parent 4d42783383
commit 81fabc90f9
7 changed files with 70 additions and 1 deletions
@@ -49,6 +49,11 @@ public class KotlinSourceFileCollector {
dirtyFilesHolder.processDirtyFiles(new FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget>() {
@Override
public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor root) throws IOException {
//TODO this is a workaround for bug in JPS: the latter erroneously calls process with invalid parameters
if (!root.getTarget().equals(target)) {
return true;
}
if (isKotlinSourceFile(file)) {
result.putValue(target, file);
}
@@ -28,12 +28,31 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("jps-plugin/testData/incremental")
@InnerTestClasses({IncrementalJpsTestGenerated.PureKotlin.class})
@InnerTestClasses({IncrementalJpsTestGenerated.CircularDependency.class, IncrementalJpsTestGenerated.PureKotlin.class})
public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
public void testAllFilesPresentInIncremental() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental"), Pattern.compile("^([^\\.]+)$"), true);
}
@TestMetadata("jps-plugin/testData/incremental/circularDependency")
@InnerTestClasses({})
public static class CircularDependency extends AbstractIncrementalJpsTest {
public void testAllFilesPresentInCircularDependency() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/circularDependency"), Pattern.compile("^([^\\.]+)$"), true);
}
@TestMetadata("simple")
public void testSimple() throws Exception {
doTest("jps-plugin/testData/incremental/circularDependency/simple/");
}
public static Test innerSuite() {
TestSuite suite = new TestSuite("CircularDependency");
suite.addTestSuite(CircularDependency.class);
return suite;
}
}
@TestMetadata("jps-plugin/testData/incremental/pureKotlin")
@InnerTestClasses({})
public static class PureKotlin extends AbstractIncrementalJpsTest {
@@ -231,6 +250,7 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
public static Test suite() {
TestSuite suite = new TestSuite("IncrementalJpsTestGenerated");
suite.addTestSuite(IncrementalJpsTestGenerated.class);
suite.addTest(CircularDependency.innerSuite());
suite.addTest(PureKotlin.innerSuite());
return suite;
}
@@ -0,0 +1,15 @@
Cleaning output files:
out/production/module2/b/BPackage-module2_b-*.class
out/production/module2/b/BPackage.class
End of files
Compiling files:
module2/src/module2_b.kt
End of files
Cleaning output files:
out/production/module1/a/A.class
out/production/module1/a/APackage-module1_a-*.class
out/production/module1/a/APackage.class
End of files
Compiling files:
module1/src/module1_a.kt
End of files
@@ -0,0 +1,2 @@
module1->module2
module2->module1
@@ -0,0 +1,9 @@
package a
class A
fun a() {
// TODO: this call is compiled via package facade or package part depending on if callee comes from compiled or source
// Must be uncommented when modules are supported in compiler
//b.b()
}
@@ -0,0 +1,7 @@
package b
fun b() {
// TODO: this call is compiled via package facade or package part depending on if callee comes from compiled or source
// Must be uncommented when modules are supported in compiler
// a.a()
}
@@ -0,0 +1,11 @@
package b
fun b() {
// TODO: this call is compiled via package facade or package part depending on if callee comes from compiled or source
// Must be uncommented when modules are supported in compiler
// a.a()
}
fun bb() {
}