+5
-1
@@ -26,6 +26,8 @@ import kotlin.io.IoPackage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.builders.BuildTargetType;
|
||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
|
||||
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
|
||||
import org.jetbrains.jps.builders.logging.ProjectBuilderLogger;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
@@ -82,6 +84,8 @@ public class KotlinBuilderModuleScriptGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
BuildTargetType<?> targetType = target.getTargetType();
|
||||
assert targetType instanceof JavaModuleBuildTargetType;
|
||||
builder.addModule(
|
||||
target.getId(),
|
||||
outputDir.getAbsolutePath(),
|
||||
@@ -89,7 +93,7 @@ public class KotlinBuilderModuleScriptGenerator {
|
||||
findSourceRoots(context, target),
|
||||
findClassPathRoots(target),
|
||||
findAnnotationRoots(target),
|
||||
target.isTests(),
|
||||
(JavaModuleBuildTargetType) targetType,
|
||||
// this excludes the output directories from the class path, to be removed for true incremental compilation
|
||||
outputDirs
|
||||
);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.modules;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation;
|
||||
import org.jetbrains.kotlin.utils.Printer;
|
||||
|
||||
@@ -45,12 +46,12 @@ public class KotlinModuleXmlBuilder {
|
||||
List<File> javaSourceRoots,
|
||||
Collection<File> classpathRoots,
|
||||
List<File> annotationRoots,
|
||||
boolean tests,
|
||||
JavaModuleBuildTargetType targetType,
|
||||
Set<File> directoriesToFilterOut
|
||||
) {
|
||||
assert !done : "Already done";
|
||||
|
||||
if (tests) {
|
||||
if (targetType.isTests()) {
|
||||
p.println("<!-- Module script for tests -->");
|
||||
}
|
||||
else {
|
||||
@@ -59,6 +60,7 @@ public class KotlinModuleXmlBuilder {
|
||||
|
||||
p.println("<", MODULE, " ",
|
||||
NAME, "=\"", escapeXml(moduleName), "\" ",
|
||||
TYPE, "=\"", escapeXml(targetType.getTypeId()), "\" ",
|
||||
OUTPUT_DIR, "=\"", getEscapedPath(new File(outputDir)), "\">"
|
||||
);
|
||||
p.pushIndent();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.jvm.compiler
|
||||
|
||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType
|
||||
import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder
|
||||
import org.jetbrains.kotlin.test.JetTestUtils
|
||||
import org.jetbrains.kotlin.test.MockLibraryUtil
|
||||
@@ -45,7 +46,7 @@ public class ClasspathOrderTest : TestCaseWithTmpdir() {
|
||||
listOf(sourceDir),
|
||||
listOf(PathUtil.getKotlinPathsForDistDirectory().getRuntimePath()),
|
||||
listOf(),
|
||||
false,
|
||||
JavaModuleBuildTargetType.PRODUCTION,
|
||||
setOf()
|
||||
).asText().toString()
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.modules;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
|
||||
import org.jetbrains.kotlin.test.JetTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -32,7 +33,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Collections.singletonList(new File("java")),
|
||||
Arrays.asList(new File("cp1"), new File("cp2")),
|
||||
Arrays.asList(new File("a1/f1"), new File("a2")),
|
||||
false,
|
||||
JavaModuleBuildTargetType.PRODUCTION,
|
||||
Collections.<File>emptySet()
|
||||
).asText().toString();
|
||||
JetTestUtils.assertEqualsToFile(new File("idea/testData/modules.xml/basic.xml"), actual);
|
||||
@@ -46,7 +47,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Collections.<File>emptyList(),
|
||||
Arrays.asList(new File("cp1"), new File("cp2")),
|
||||
Arrays.asList(new File("a1/f1"), new File("a2")),
|
||||
false,
|
||||
JavaModuleBuildTargetType.PRODUCTION,
|
||||
Collections.singleton(new File("cp1"))
|
||||
).asText().toString();
|
||||
JetTestUtils.assertEqualsToFile(new File("idea/testData/modules.xml/filtered.xml"), actual);
|
||||
@@ -61,7 +62,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Collections.<File>emptyList(),
|
||||
Arrays.asList(new File("cp1"), new File("cp2")),
|
||||
Arrays.asList(new File("a1/f1"), new File("a2")),
|
||||
false,
|
||||
JavaModuleBuildTargetType.PRODUCTION,
|
||||
Collections.singleton(new File("cp1"))
|
||||
);
|
||||
builder.addModule(
|
||||
@@ -71,7 +72,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Collections.<File>emptyList(),
|
||||
Arrays.asList(new File("cp12"), new File("cp22")),
|
||||
Arrays.asList(new File("a12/f12"), new File("a22")),
|
||||
true,
|
||||
JavaModuleBuildTargetType.TEST,
|
||||
Collections.singleton(new File("cp12"))
|
||||
);
|
||||
String actual = builder.asText().toString();
|
||||
|
||||
Reference in New Issue
Block a user