Avoid removing target/classes dir during IC in Maven

#KT-21581 fixed
This commit is contained in:
Alexey Tsvetkov
2018-02-12 20:34:02 +03:00
parent fa3ca0cddb
commit 42c433f950
9 changed files with 198 additions and 12 deletions
@@ -9,7 +9,8 @@ public class IncrementalCompilationIT extends MavenITBase {
MavenProject project = new MavenProject("kotlinSimple");
project.exec("package")
.succeeded()
.compiledKotlin("src/A.kt", "src/useA.kt", "src/Dummy.kt");
.fileExists("target/classes/test.properties")
.compiledKotlin("src/main/kotlin/A.kt", "src/main/kotlin/useA.kt", "src/main/kotlin/Dummy.kt");
}
@Test
@@ -27,7 +28,7 @@ public class IncrementalCompilationIT extends MavenITBase {
MavenProject project = new MavenProject("kotlinSimple");
project.exec("package");
File aKt = project.file("src/A.kt");
File aKt = project.file("src/main/kotlin/A.kt");
String original = "class A";
String replacement = "private class A";
MavenTestUtils.replaceFirstInFile(aKt, original, replacement);
@@ -39,7 +40,7 @@ public class IncrementalCompilationIT extends MavenITBase {
MavenTestUtils.replaceFirstInFile(aKt, replacement, original);
project.exec("package")
.succeeded()
.compiledKotlin("src/A.kt", "src/useA.kt");
.compiledKotlin("src/main/kotlin/A.kt", "src/main/kotlin/useA.kt");
}
@@ -48,12 +49,12 @@ public class IncrementalCompilationIT extends MavenITBase {
MavenProject project = new MavenProject("kotlinSimple");
project.exec("package");
File aKt = project.file("src/A.kt");
File aKt = project.file("src/main/kotlin/A.kt");
MavenTestUtils.replaceFirstInFile(aKt, "fun foo", "internal fun foo");
project.exec("package")
.succeeded()
.compiledKotlin("src/A.kt", "src/useA.kt");
.compiledKotlin("src/main/kotlin/A.kt", "src/main/kotlin/useA.kt");
// todo rebuild and compare output
}
@@ -110,4 +110,14 @@ class MavenExecutionResult {
}
});
}
MavenExecutionResult fileExists(@NotNull final String path) throws Exception {
return check(new Action<MavenExecutionResult>() {
@Override
public void run(MavenExecutionResult execResult) {
File file = new File(workingDir, path);
Assert.assertTrue(file + " does not exist", file.exists());
}
});
}
}
@@ -21,6 +21,8 @@
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
@@ -40,7 +42,6 @@
</plugins>
</pluginManagement>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>