Check Java interop in Maven IC tests
This commit is contained in:
+17
-1
@@ -21,7 +21,9 @@ public class IncrementalCompilationIT extends MavenITBase {
|
|||||||
"target/classes/test.properties",
|
"target/classes/test.properties",
|
||||||
"target/classes/A.class",
|
"target/classes/A.class",
|
||||||
"target/classes/UseAKt.class",
|
"target/classes/UseAKt.class",
|
||||||
"target/classes/Dummy.class"
|
"target/classes/Dummy.class",
|
||||||
|
"target/classes/JavaUtil.class",
|
||||||
|
"target/classes/JavaAUser.class"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,4 +75,18 @@ public class IncrementalCompilationIT extends MavenITBase {
|
|||||||
|
|
||||||
// todo rebuild and compare output
|
// todo rebuild and compare output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testJavaChanged() throws Exception {
|
||||||
|
MavenProject project = new MavenProject("kotlinSimple");
|
||||||
|
project.exec("package");
|
||||||
|
|
||||||
|
File aKt = project.file("src/main/java/JavaUtil.java");
|
||||||
|
MavenTestUtils.replaceFirstInFile(aKt, "CONST = 0", "CONST = 1");
|
||||||
|
|
||||||
|
project.exec("package")
|
||||||
|
.succeeded()
|
||||||
|
.filesExist(kotlinSimpleOutputPaths())
|
||||||
|
.compiledKotlin("src/main/kotlin/A.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -2,6 +2,7 @@ package org.jetbrains.kotlin.maven;
|
|||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
|
import kotlin.text.StringsKt;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
||||||
@@ -91,6 +92,8 @@ class MavenExecutionResult {
|
|||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
String[] compiledFiles = m.group(1).split(",");
|
String[] compiledFiles = m.group(1).split(",");
|
||||||
for (String path : compiledFiles) {
|
for (String path : compiledFiles) {
|
||||||
|
if (StringsKt.isBlank(path)) continue;
|
||||||
|
|
||||||
File file = new File(path.trim());
|
File file = new File(path.trim());
|
||||||
String relativePath = FileUtil.getRelativePath(workingDir, file);
|
String relativePath = FileUtil.getRelativePath(workingDir, file);
|
||||||
normalizedActualPaths.add(FileUtil.normalize(relativePath));
|
normalizedActualPaths.add(FileUtil.normalize(relativePath));
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
|
||||||
|
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -50,17 +48,50 @@
|
|||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>compile</id>
|
<id>compile</id>
|
||||||
<phase>process-sources</phase>
|
<goals> <goal>compile</goal> </goals>
|
||||||
<goals>
|
<configuration>
|
||||||
<goal>compile</goal>
|
<sourceDirs>
|
||||||
</goals>
|
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
|
||||||
|
<sourceDir>${project.basedir}/src/main/java</sourceDir>
|
||||||
|
</sourceDirs>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
<id>test-compile</id>
|
<id>test-compile</id>
|
||||||
<phase>process-test-sources</phase>
|
<goals> <goal>test-compile</goal> </goals>
|
||||||
<goals>
|
<configuration>
|
||||||
<goal>test-compile</goal>
|
<sourceDirs>
|
||||||
</goals>
|
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
|
||||||
|
<sourceDir>${project.basedir}/src/test/java</sourceDir>
|
||||||
|
</sourceDirs>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
<executions>
|
||||||
|
<!-- Replacing default-compile as it is treated specially by maven -->
|
||||||
|
<execution>
|
||||||
|
<id>default-compile</id>
|
||||||
|
<phase>none</phase>
|
||||||
|
</execution>
|
||||||
|
<!-- Replacing default-testCompile as it is treated specially by maven -->
|
||||||
|
<execution>
|
||||||
|
<id>default-testCompile</id>
|
||||||
|
<phase>none</phase>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>java-compile</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals> <goal>compile</goal> </goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>java-test-compile</id>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<goals> <goal>testCompile</goal> </goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
public class JavaAUser {
|
||||||
|
public static void useA(A a) {
|
||||||
|
a.foo("abc");
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
public class JavaUtil {
|
||||||
|
public static final int CONST = 0;
|
||||||
|
}
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
class A {
|
class A {
|
||||||
fun foo(s: String) = s + s
|
fun foo(s: String) = s + s
|
||||||
|
fun bar() = JavaUtil.CONST
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user