Minor: fix maven IC tests with custom local repository
This commit is contained in:
@@ -93,6 +93,10 @@
|
||||
<name>kotlin.version</name>
|
||||
<value>${project.version}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>maven.repo.local</name>
|
||||
<value>${maven.repo.local}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
+1
-2
@@ -1,10 +1,9 @@
|
||||
package org.jetbrains.kotlin.maven;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class IncrementalCompilationIT {
|
||||
public class IncrementalCompilationIT extends MavenITBase {
|
||||
@Test
|
||||
public void testSimpleCompile() throws Exception {
|
||||
MavenProject project = new MavenProject("kotlinSimple");
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package org.jetbrains.kotlin.maven;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
|
||||
public abstract class MavenITBase {
|
||||
@Rule
|
||||
public TestRule watcher = new TestWatcher() {
|
||||
protected void starting(Description description) {
|
||||
System.out.println("Running test: " + description.getDisplayName());
|
||||
}
|
||||
};
|
||||
}
|
||||
+15
-2
@@ -2,7 +2,9 @@ package org.jetbrains.kotlin.maven;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import kotlin.io.TextStreamsKt;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
@@ -66,8 +68,19 @@ class MavenProject {
|
||||
cmd.add("mvn");
|
||||
cmd.add("-Dkotlin.compiler.incremental.log.level=info");
|
||||
|
||||
String kotlinVersion = getNotNullSystemProperty("kotlin.version");
|
||||
cmd.add("-Dkotlin.version=" + kotlinVersion);
|
||||
String kotlinVersionProperty = "kotlin.version";
|
||||
cmd.add("-D" + kotlinVersionProperty + "=" + getNotNullSystemProperty(kotlinVersionProperty));
|
||||
|
||||
String mavenRepoLocalProperty = "maven.repo.local";
|
||||
String localRepoPath = System.getProperty(mavenRepoLocalProperty);
|
||||
try {
|
||||
if (localRepoPath != null && !StringsKt.isBlank(localRepoPath) && new File(localRepoPath).isDirectory()) {
|
||||
cmd.add("-D" + mavenRepoLocalProperty + "=" + localRepoPath);
|
||||
}
|
||||
}
|
||||
catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
cmd.addAll(Arrays.asList(args));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user