Minor: fix maven IC tests with custom local repository

This commit is contained in:
Alexey Tsvetkov
2017-04-06 15:12:39 +03:00
parent e7dc7ec005
commit 0a42a1c104
4 changed files with 35 additions and 4 deletions
@@ -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,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");
@@ -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());
}
};
}
@@ -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));