Writing incrementalCache attribute to <modules> element of xml module script
This commit is contained in:
@@ -42,6 +42,7 @@ import java.util.List;
|
||||
import static org.jetbrains.jet.cli.jvm.JVMConfigurationKeys.ANNOTATIONS_PATH_KEY;
|
||||
import static org.jetbrains.jet.cli.jvm.JVMConfigurationKeys.CLASSPATH_KEY;
|
||||
import static org.jetbrains.jet.cli.jvm.JVMConfigurationKeys.ENABLE_INLINE;
|
||||
import static org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentUtil.loadModuleDescriptions;
|
||||
|
||||
|
||||
/**
|
||||
@@ -230,8 +231,9 @@ public class BytecodeCompiler {
|
||||
@Nullable String[] externalAnnotationsPath, boolean enableInline
|
||||
) {
|
||||
try {
|
||||
List<Module> modules = CompileEnvironmentUtil.loadModuleDescriptions(getKotlinPathsForAntTask(), module,
|
||||
MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
CompileEnvironmentUtil.ModuleScriptData moduleScriptData =
|
||||
loadModuleDescriptions(getKotlinPathsForAntTask(), module, MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
List<Module> modules = moduleScriptData.getModules();
|
||||
List<String> sourcesRoots = new ArrayList<String>();
|
||||
for (Module m : modules) {
|
||||
sourcesRoots.addAll(m.getSourceFiles());
|
||||
|
||||
-14
@@ -42,9 +42,6 @@ public interface ModuleDescription {
|
||||
@NotNull
|
||||
List<String> getAnnotationsRoots();
|
||||
|
||||
@Nullable
|
||||
String getIncrementalCacheDir();
|
||||
|
||||
class Impl implements ModuleDescription {
|
||||
|
||||
private String name;
|
||||
@@ -52,7 +49,6 @@ public interface ModuleDescription {
|
||||
private final List<String> sources = new SmartList<String>();
|
||||
private final List<String> classpath = new SmartList<String>();
|
||||
private final List<String> annotations = new SmartList<String>();
|
||||
private String incrementalCacheDir;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
@@ -74,10 +70,6 @@ public interface ModuleDescription {
|
||||
annotations.add(path);
|
||||
}
|
||||
|
||||
public void setIncrementalCacheDir(String incrementalCacheDir) {
|
||||
this.incrementalCacheDir = incrementalCacheDir;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
@@ -108,12 +100,6 @@ public interface ModuleDescription {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getIncrementalCacheDir() {
|
||||
return incrementalCacheDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name +
|
||||
|
||||
+15
-11
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.cli.common.modules;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -47,7 +48,10 @@ public class ModuleXmlParser {
|
||||
public static final String EXTERNAL_ANNOTATIONS = "externalAnnotations";
|
||||
|
||||
@NotNull
|
||||
public static List<ModuleDescription> parse(@NotNull String xmlFile, @NotNull MessageCollector messageCollector) {
|
||||
public static Pair<List<ModuleDescription>, String> parseModuleDescriptionsAndIncrementalCacheDir(
|
||||
@NotNull String xmlFile,
|
||||
@NotNull MessageCollector messageCollector
|
||||
) {
|
||||
FileInputStream stream = null;
|
||||
try {
|
||||
stream = new FileInputStream(xmlFile);
|
||||
@@ -56,7 +60,7 @@ public class ModuleXmlParser {
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
MessageCollectorUtil.reportException(messageCollector, e);
|
||||
return Collections.emptyList();
|
||||
return Pair.create(Collections.<ModuleDescription>emptyList(), null);
|
||||
}
|
||||
finally {
|
||||
StreamUtil.closeStream(stream);
|
||||
@@ -64,7 +68,8 @@ public class ModuleXmlParser {
|
||||
}
|
||||
|
||||
private final MessageCollector messageCollector;
|
||||
private final List<ModuleDescription> result = new SmartList<ModuleDescription>();
|
||||
private String incrementalCacheDir;
|
||||
private final List<ModuleDescription> descriptions = new SmartList<ModuleDescription>();
|
||||
private DefaultHandler currentState;
|
||||
|
||||
private ModuleXmlParser(@NotNull MessageCollector messageCollector) {
|
||||
@@ -75,7 +80,7 @@ public class ModuleXmlParser {
|
||||
this.currentState = currentState;
|
||||
}
|
||||
|
||||
private List<ModuleDescription> parse(@NotNull InputStream xml) {
|
||||
private Pair<List<ModuleDescription>, String> parse(@NotNull InputStream xml) {
|
||||
try {
|
||||
setCurrentState(initial);
|
||||
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
|
||||
@@ -86,7 +91,7 @@ public class ModuleXmlParser {
|
||||
return currentState;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
return Pair.create(descriptions, incrementalCacheDir);
|
||||
}
|
||||
catch (ParserConfigurationException e) {
|
||||
MessageCollectorUtil.reportException(messageCollector, e);
|
||||
@@ -97,7 +102,7 @@ public class ModuleXmlParser {
|
||||
catch (IOException e) {
|
||||
MessageCollectorUtil.reportException(messageCollector, e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
return Pair.create(Collections.<ModuleDescription>emptyList(), null);
|
||||
}
|
||||
|
||||
private final DefaultHandler initial = new DefaultHandler() {
|
||||
@@ -107,6 +112,7 @@ public class ModuleXmlParser {
|
||||
throw createError(qName);
|
||||
}
|
||||
|
||||
incrementalCacheDir = attributes.getValue(INCREMENTAL_CACHE);
|
||||
setCurrentState(insideModules);
|
||||
}
|
||||
};
|
||||
@@ -120,8 +126,7 @@ public class ModuleXmlParser {
|
||||
|
||||
setCurrentState(new InsideModule(
|
||||
getAttribute(attributes, NAME, qName),
|
||||
getAttribute(attributes, OUTPUT_DIR, qName),
|
||||
attributes.getValue(INCREMENTAL_CACHE)
|
||||
getAttribute(attributes, OUTPUT_DIR, qName)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -136,12 +141,11 @@ public class ModuleXmlParser {
|
||||
private class InsideModule extends DefaultHandler {
|
||||
|
||||
private final ModuleDescription.Impl moduleDescription;
|
||||
private InsideModule(String name, String outputDir, String incrementalCacheDir) {
|
||||
private InsideModule(String name, String outputDir) {
|
||||
this.moduleDescription = new ModuleDescription.Impl();
|
||||
this.moduleDescription.setName(name);
|
||||
this.moduleDescription.setOutputDir(outputDir);
|
||||
this.moduleDescription.setIncrementalCacheDir(incrementalCacheDir);
|
||||
result.add(moduleDescription);
|
||||
descriptions.add(moduleDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -125,7 +125,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
|
||||
if (arguments.module != null) {
|
||||
MessageCollector sanitizedCollector = new FilteringMessageCollector(messageCollector, in(CompilerMessageSeverity.VERBOSE));
|
||||
List<Module> modules = CompileEnvironmentUtil.loadModuleDescriptions(paths, arguments.module, sanitizedCollector);
|
||||
CompileEnvironmentUtil.ModuleScriptData moduleScript = CompileEnvironmentUtil.loadModuleDescriptions(
|
||||
paths, arguments.module, sanitizedCollector);
|
||||
if (moduleScript.getIncrementalCacheDir() != null) {
|
||||
configuration.put(JVMConfigurationKeys.INCREMENTAL_CACHE_BASE_DIR, new File(moduleScript.getIncrementalCacheDir()));
|
||||
}
|
||||
|
||||
if (outputDir != null) {
|
||||
messageCollector.report(CompilerMessageSeverity.WARNING, "The '-output' option is ignored because '-module' is specified",
|
||||
@@ -133,7 +137,7 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
}
|
||||
|
||||
File directory = new File(arguments.module).getAbsoluteFile().getParentFile();
|
||||
KotlinToJVMBytecodeCompiler.compileModules(configuration, modules,
|
||||
KotlinToJVMBytecodeCompiler.compileModules(configuration, moduleScript.getModules(),
|
||||
directory, jar,
|
||||
arguments.includeRuntime);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
@@ -80,32 +81,38 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<Module> loadModuleDescriptions(KotlinPaths paths, String moduleDefinitionFile, MessageCollector messageCollector) {
|
||||
public static ModuleScriptData loadModuleDescriptions(KotlinPaths paths, String moduleDefinitionFile, MessageCollector messageCollector) {
|
||||
File file = new File(moduleDefinitionFile);
|
||||
if (!file.exists()) {
|
||||
messageCollector.report(ERROR, "Module definition file does not exist: " + moduleDefinitionFile, NO_LOCATION);
|
||||
return Collections.emptyList();
|
||||
return new ModuleScriptData(Collections.<Module>emptyList(), null);
|
||||
}
|
||||
String extension = FileUtilRt.getExtension(moduleDefinitionFile);
|
||||
if ("ktm".equalsIgnoreCase(extension)) {
|
||||
return loadModuleScript(paths, moduleDefinitionFile, messageCollector);
|
||||
}
|
||||
if ("xml".equalsIgnoreCase(extension)) {
|
||||
return ContainerUtil.map(
|
||||
ModuleXmlParser.parse(moduleDefinitionFile, messageCollector),
|
||||
Pair<List<ModuleDescription>, String> moduleDescriptionsAndIncrementalCacheDir =
|
||||
ModuleXmlParser.parseModuleDescriptionsAndIncrementalCacheDir(moduleDefinitionFile, messageCollector);
|
||||
List<ModuleDescription> moduleDescriptions = moduleDescriptionsAndIncrementalCacheDir.first;
|
||||
String incrementalCacheDir = moduleDescriptionsAndIncrementalCacheDir.second;
|
||||
List<Module> modules = ContainerUtil.map(
|
||||
moduleDescriptions,
|
||||
new Function<ModuleDescription, Module>() {
|
||||
@Override
|
||||
public Module fun(ModuleDescription description) {
|
||||
return new DescriptionToModuleAdapter(description);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
return new ModuleScriptData(modules, incrementalCacheDir);
|
||||
}
|
||||
messageCollector.report(ERROR, "Unknown module definition type: " + moduleDefinitionFile, NO_LOCATION);
|
||||
return Collections.emptyList();
|
||||
return new ModuleScriptData(Collections.<Module>emptyList(), null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<Module> loadModuleScript(KotlinPaths paths, String moduleScriptFile, MessageCollector messageCollector) {
|
||||
private static ModuleScriptData loadModuleScript(KotlinPaths paths, String moduleScriptFile, MessageCollector messageCollector) {
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
File runtimePath = paths.getRuntimePath();
|
||||
if (runtimePath.exists()) {
|
||||
@@ -143,7 +150,7 @@ public class CompileEnvironmentUtil {
|
||||
if (modules.isEmpty()) {
|
||||
throw new CompileEnvironmentException("No modules where defined by " + moduleScriptFile);
|
||||
}
|
||||
return modules;
|
||||
return new ModuleScriptData(modules, null);
|
||||
}
|
||||
|
||||
private static List<Module> runDefineModules(KotlinPaths paths, ClassFileFactory factory) {
|
||||
@@ -324,7 +331,30 @@ public class CompileEnvironmentUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
static class DescriptionToModuleAdapter implements Module {
|
||||
public static class ModuleScriptData {
|
||||
@Nullable
|
||||
private final String incrementalCacheDir;
|
||||
|
||||
@NotNull
|
||||
public List<Module> getModules() {
|
||||
return modules;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getIncrementalCacheDir() {
|
||||
return incrementalCacheDir;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private final List<Module> modules;
|
||||
|
||||
ModuleScriptData(@NotNull List<Module> modules, @Nullable String incrementalCacheDir) {
|
||||
this.incrementalCacheDir = incrementalCacheDir;
|
||||
this.modules = modules;
|
||||
}
|
||||
}
|
||||
|
||||
private static class DescriptionToModuleAdapter implements Module {
|
||||
private final ModuleDescription description;
|
||||
|
||||
public DescriptionToModuleAdapter(ModuleDescription description) {
|
||||
@@ -360,10 +390,5 @@ public class CompileEnvironmentUtil {
|
||||
public List<String> getAnnotationsRoots() {
|
||||
return description.getAnnotationsRoots();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getIncrementalCacheDir() {
|
||||
return description.getIncrementalCacheDir();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,14 +169,6 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
configuration.add(JVMConfigurationKeys.MODULE_IDS, module.getModuleName());
|
||||
}
|
||||
|
||||
Module anyModule = chunk.get(0);
|
||||
if (anyModule instanceof CompileEnvironmentUtil.DescriptionToModuleAdapter) {
|
||||
String incrementalCacheDir = ((CompileEnvironmentUtil.DescriptionToModuleAdapter) anyModule).getIncrementalCacheDir();
|
||||
if (incrementalCacheDir != null) {
|
||||
configuration.put(JVMConfigurationKeys.INCREMENTAL_CACHE_BASE_DIR, new File(incrementalCacheDir));
|
||||
}
|
||||
}
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
incrementalCacheDir=/incremental/cache/dir
|
||||
|
||||
name
|
||||
outputDir=out
|
||||
sources=[foo]
|
||||
classpath=[bar]
|
||||
annotations=[]
|
||||
name2
|
||||
outputDir=out2
|
||||
sources=[2foo]
|
||||
classpath=[2bar]
|
||||
annotations=[]
|
||||
@@ -0,0 +1,10 @@
|
||||
<modules incrementalCache="/incremental/cache/dir">
|
||||
<module name="name" outputDir="out">
|
||||
<sources path="foo"/>
|
||||
<classpath path="bar"/>
|
||||
</module>
|
||||
<module name="name2" outputDir="out2">
|
||||
<sources path="2foo"/>
|
||||
<classpath path="2bar"/>
|
||||
</module>
|
||||
</modules>
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.modules.xml;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -36,7 +37,7 @@ public abstract class AbstractModuleXmlParserTest extends TestCase {
|
||||
protected void doTest(String xmlPath) throws IOException {
|
||||
File txtFile = new File(FileUtil.getNameWithoutExtension(xmlPath) + ".txt");
|
||||
|
||||
List<ModuleDescription> result = ModuleXmlParser.parse(xmlPath, new MessageCollector() {
|
||||
Pair<List<ModuleDescription>, String> result = ModuleXmlParser.parseModuleDescriptionsAndIncrementalCacheDir(xmlPath, new MessageCollector() {
|
||||
@Override
|
||||
public void report(
|
||||
@NotNull CompilerMessageSeverity severity, @NotNull String message, @NotNull CompilerMessageLocation location
|
||||
@@ -46,7 +47,11 @@ public abstract class AbstractModuleXmlParserTest extends TestCase {
|
||||
});
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (ModuleDescription description : result) {
|
||||
if (result.second != null) {
|
||||
sb.append("incrementalCacheDir=").append(result.second).append("\n\n");
|
||||
}
|
||||
|
||||
for (ModuleDescription description : result.first) {
|
||||
sb.append(description).append("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ public class ModuleXmlParserTestGenerated extends AbstractModuleXmlParserTest {
|
||||
doTest("compiler/testData/modules.xml/emptyModule.xml");
|
||||
}
|
||||
|
||||
@TestMetadata("incrementalCacheDir.xml")
|
||||
public void testIncrementalCacheDir() throws Exception {
|
||||
doTest("compiler/testData/modules.xml/incrementalCacheDir.xml");
|
||||
}
|
||||
|
||||
@TestMetadata("manyTimes.xml")
|
||||
public void testManyTimes() throws Exception {
|
||||
doTest("compiler/testData/modules.xml/manyTimes.xml");
|
||||
|
||||
+3
-1
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.jetbrains.jet.compiler.runner;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -25,7 +28,6 @@ public interface KotlinModuleDescriptionBuilder {
|
||||
KotlinModuleDescriptionBuilder addModule(
|
||||
String moduleName,
|
||||
String outputDir,
|
||||
String incrementalCacheDir,
|
||||
DependencyProvider dependencyProvider,
|
||||
List<File> sourceFiles,
|
||||
boolean tests,
|
||||
|
||||
+1
-1
@@ -17,6 +17,6 @@
|
||||
package org.jetbrains.jet.compiler.runner;
|
||||
|
||||
public interface KotlinModuleDescriptionBuilderFactory {
|
||||
KotlinModuleDescriptionBuilder create();
|
||||
KotlinModuleDescriptionBuilder create(String incrementalCacheDir);
|
||||
String getFileExtension();
|
||||
}
|
||||
|
||||
+1
-2
@@ -32,7 +32,7 @@ public class KotlinModuleScriptBuilderFactory implements KotlinModuleDescription
|
||||
private KotlinModuleScriptBuilderFactory() {}
|
||||
|
||||
@Override
|
||||
public KotlinModuleDescriptionBuilder create() {
|
||||
public KotlinModuleDescriptionBuilder create(String incrementalCacheDir) {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ public class KotlinModuleScriptBuilderFactory implements KotlinModuleDescription
|
||||
public KotlinModuleDescriptionBuilder addModule(
|
||||
String moduleName,
|
||||
String outputDir,
|
||||
String incrementalCacheDir,
|
||||
DependencyProvider dependencyProvider,
|
||||
List<File> sourceFiles,
|
||||
boolean tests,
|
||||
|
||||
+11
-8
@@ -36,8 +36,8 @@ public class KotlinModuleXmlBuilderFactory implements KotlinModuleDescriptionBui
|
||||
private KotlinModuleXmlBuilderFactory() {}
|
||||
|
||||
@Override
|
||||
public KotlinModuleDescriptionBuilder create() {
|
||||
return new Builder();
|
||||
public KotlinModuleDescriptionBuilder create(String incrementalCacheDir) {
|
||||
return new Builder(incrementalCacheDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,15 +50,19 @@ public class KotlinModuleXmlBuilderFactory implements KotlinModuleDescriptionBui
|
||||
private final Printer p = new Printer(xml);
|
||||
private boolean done = false;
|
||||
|
||||
{
|
||||
openTag(p, MODULES);
|
||||
public Builder(String incrementalCacheDir) {
|
||||
if (incrementalCacheDir == null) {
|
||||
openTag(p, MODULES);
|
||||
}
|
||||
else {
|
||||
openTag(p, MODULES + " " + INCREMENTAL_CACHE + "=\"" + getEscapedPath(new File(incrementalCacheDir)) + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public KotlinModuleDescriptionBuilder addModule(
|
||||
String moduleName,
|
||||
String outputDir,
|
||||
String incrementalCacheDir,
|
||||
DependencyProvider dependencyProvider,
|
||||
List<File> sourceFiles,
|
||||
boolean tests,
|
||||
@@ -75,9 +79,8 @@ public class KotlinModuleXmlBuilderFactory implements KotlinModuleDescriptionBui
|
||||
|
||||
p.println("<", MODULE, " ",
|
||||
NAME, "=\"", escapeXml(moduleName), "\" ",
|
||||
OUTPUT_DIR, "=\"", getEscapedPath(new File(outputDir)), "\"",
|
||||
incrementalCacheDir != null ? " " + INCREMENTAL_CACHE + "=\"" + getEscapedPath(new File(incrementalCacheDir)) + "\" " : "",
|
||||
">");
|
||||
OUTPUT_DIR, "=\"", getEscapedPath(new File(outputDir)), "\">"
|
||||
);
|
||||
p.pushIndent();
|
||||
|
||||
for (File sourceFile : sourceFiles) {
|
||||
|
||||
@@ -168,10 +168,9 @@ public class K2JvmTranslatingCompiler implements TranslatingCompiler {
|
||||
if (!tests) {
|
||||
outputDirectoriesToFilter.add(moduleOutputDirectory);
|
||||
}
|
||||
CharSequence script = KotlinModuleScriptBuilderFactory.INSTANCE.create().addModule(
|
||||
CharSequence script = KotlinModuleScriptBuilderFactory.INSTANCE.create(null).addModule(
|
||||
moduleName,
|
||||
moduleOutputDirectory.getAbsolutePath(),
|
||||
null,
|
||||
getDependencyProvider(chunk, tests, mainOutput),
|
||||
sourceFiles,
|
||||
tests,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<modules incrementalCache="/path/to/incremental/cache">
|
||||
<!-- Module script for production -->
|
||||
<module name="name" outputDir="output">
|
||||
<sources path="s1"/>
|
||||
</module>
|
||||
</modules>
|
||||
@@ -28,10 +28,9 @@ import java.util.Collections;
|
||||
|
||||
public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
public void testBasic() throws Exception {
|
||||
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create().addModule(
|
||||
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create(null).addModule(
|
||||
"name",
|
||||
"output",
|
||||
null,
|
||||
new KotlinModuleDescriptionBuilder.DependencyProvider() {
|
||||
@Override
|
||||
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
|
||||
@@ -46,10 +45,9 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testFiltered() throws Exception {
|
||||
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create().addModule(
|
||||
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create(null).addModule(
|
||||
"name",
|
||||
"output",
|
||||
null,
|
||||
new KotlinModuleDescriptionBuilder.DependencyProvider() {
|
||||
@Override
|
||||
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
|
||||
@@ -64,11 +62,10 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testMultiple() throws Exception {
|
||||
KotlinModuleDescriptionBuilder builder = KotlinModuleXmlBuilderFactory.INSTANCE.create();
|
||||
KotlinModuleDescriptionBuilder builder = KotlinModuleXmlBuilderFactory.INSTANCE.create(null);
|
||||
builder.addModule(
|
||||
"name",
|
||||
"output",
|
||||
null,
|
||||
new KotlinModuleDescriptionBuilder.DependencyProvider() {
|
||||
@Override
|
||||
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
|
||||
@@ -82,7 +79,6 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
builder.addModule(
|
||||
"name2",
|
||||
"output2",
|
||||
null,
|
||||
new KotlinModuleDescriptionBuilder.DependencyProvider() {
|
||||
@Override
|
||||
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
|
||||
@@ -96,4 +92,20 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
String actual = builder.asText().toString();
|
||||
JetTestUtils.assertEqualsToFile(new File("idea/testData/modules.xml/multiple.xml"), actual);
|
||||
}
|
||||
|
||||
public void testIncrementalCache() throws Exception {
|
||||
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create("/path/to/incremental/cache").addModule(
|
||||
"name",
|
||||
"output",
|
||||
new KotlinModuleDescriptionBuilder.DependencyProvider() {
|
||||
@Override
|
||||
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
|
||||
}
|
||||
},
|
||||
Arrays.asList(new File("s1")),
|
||||
false,
|
||||
Collections.<File>emptySet()).asText().toString();
|
||||
JetTestUtils.assertEqualsToFile(new File("idea/testData/modules.xml/incrementalCache.xml"), actual);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class KotlinBuilderModuleScriptGenerator {
|
||||
)
|
||||
throws IOException
|
||||
{
|
||||
KotlinModuleDescriptionBuilder builder = FACTORY.create();
|
||||
KotlinModuleDescriptionBuilder builder = FACTORY.create(getIncrementalCacheDir(context).getAbsolutePath());
|
||||
|
||||
boolean noSources = true;
|
||||
|
||||
@@ -91,7 +91,6 @@ public class KotlinBuilderModuleScriptGenerator {
|
||||
builder.addModule(
|
||||
target.getId(),
|
||||
outputDir.getAbsolutePath(),
|
||||
getIncrementalCacheDir(context).getAbsolutePath(),
|
||||
getKotlinModuleDependencies(context, target),
|
||||
sourceFiles,
|
||||
target.isTests(),
|
||||
|
||||
Reference in New Issue
Block a user