Simplify code in module script/xml generation

Pass classpath and annotation roots explicitly instead of wrapped in a callback
This commit is contained in:
Alexander Udalov
2015-01-22 17:16:06 +03:00
parent fa2116040e
commit 3ea59117ac
8 changed files with 97 additions and 134 deletions
+3 -3
View File
@@ -5,11 +5,11 @@
<sources path="s2"/>
<!-- Java source roots -->
<classpath path="java"/>
<!-- Classpath -->
<classpath path="cp1"/>
<classpath path="cp2"/>
<!-- External annotations -->
<externalAnnotations path="a1/f1"/>
<externalAnnotations path="a2"/>
<!-- s1 -->
<classpath path="cp1"/>
<classpath path="cp2"/>
</module>
</modules>
+4 -4
View File
@@ -3,14 +3,14 @@
<module name="name" outputDir="output">
<sources path="s1"/>
<sources path="s2"/>
<!-- External annotations -->
<externalAnnotations path="a1/f1"/>
<externalAnnotations path="a2"/>
<!-- s1 -->
<!-- Classpath -->
<!-- Output directory, commented out -->
<!--
<classpath path="cp1"/>
-->
<classpath path="cp2"/>
<!-- External annotations -->
<externalAnnotations path="a1/f1"/>
<externalAnnotations path="a2"/>
</module>
</modules>
+8 -8
View File
@@ -3,28 +3,28 @@
<module name="name" outputDir="output">
<sources path="s1"/>
<sources path="s2"/>
<!-- External annotations -->
<externalAnnotations path="a1/f1"/>
<externalAnnotations path="a2"/>
<!-- s1 -->
<!-- Classpath -->
<!-- Output directory, commented out -->
<!--
<classpath path="cp1"/>
-->
<classpath path="cp2"/>
<!-- External annotations -->
<externalAnnotations path="a1/f1"/>
<externalAnnotations path="a2"/>
</module>
<!-- Module script for tests -->
<module name="name2" outputDir="output2">
<sources path="s12"/>
<sources path="s22"/>
<!-- External annotations -->
<externalAnnotations path="a12/f12"/>
<externalAnnotations path="a22"/>
<!-- s12 -->
<!-- Classpath -->
<!-- Output directory, commented out -->
<!--
<classpath path="cp12"/>
-->
<classpath path="cp22"/>
<!-- External annotations -->
<externalAnnotations path="a12/f12"/>
<externalAnnotations path="a22"/>
</module>
</modules>
@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.modules;
import junit.framework.TestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.test.JetTestUtils;
import java.io.File;
@@ -29,15 +28,10 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create().addModule(
"name",
"output",
new KotlinModuleDescriptionBuilder.DependencyProvider() {
@Override
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
processor.processAnnotationRoots(Arrays.asList(new File("a1/f1"), new File("a2")));
processor.processClassPathSection("s1", Arrays.asList(new File("cp1"), new File("cp2")));
}
},
Arrays.asList(new File("s1"), new File("s2")),
Collections.singletonList(new File("java")),
Arrays.asList(new File("cp1"), new File("cp2")),
Arrays.asList(new File("a1/f1"), new File("a2")),
false,
Collections.<File>emptySet()
).asText().toString();
@@ -48,15 +42,10 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
String actual = KotlinModuleXmlBuilderFactory.INSTANCE.create().addModule(
"name",
"output",
new KotlinModuleDescriptionBuilder.DependencyProvider() {
@Override
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
processor.processAnnotationRoots(Arrays.asList(new File("a1/f1"), new File("a2")));
processor.processClassPathSection("s1", Arrays.asList(new File("cp1"), new File("cp2")));
}
},
Arrays.asList(new File("s1"), new File("s2")),
Collections.<File>emptyList(),
Arrays.asList(new File("cp1"), new File("cp2")),
Arrays.asList(new File("a1/f1"), new File("a2")),
false,
Collections.singleton(new File("cp1"))
).asText().toString();
@@ -68,30 +57,20 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
builder.addModule(
"name",
"output",
new KotlinModuleDescriptionBuilder.DependencyProvider() {
@Override
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
processor.processAnnotationRoots(Arrays.asList(new File("a1/f1"), new File("a2")));
processor.processClassPathSection("s1", Arrays.asList(new File("cp1"), new File("cp2")));
}
},
Arrays.asList(new File("s1"), new File("s2")),
Collections.<File>emptyList(),
Arrays.asList(new File("cp1"), new File("cp2")),
Arrays.asList(new File("a1/f1"), new File("a2")),
false,
Collections.singleton(new File("cp1"))
);
builder.addModule(
"name2",
"output2",
new KotlinModuleDescriptionBuilder.DependencyProvider() {
@Override
public void processClassPath(@NotNull KotlinModuleDescriptionBuilder.DependencyProcessor processor) {
processor.processAnnotationRoots(Arrays.asList(new File("a12/f12"), new File("a22")));
processor.processClassPathSection("s12", Arrays.asList(new File("cp12"), new File("cp22")));
}
},
Arrays.asList(new File("s12"), new File("s22")),
Collections.<File>emptyList(),
Arrays.asList(new File("cp12"), new File("cp22")),
Arrays.asList(new File("a12/f12"), new File("a22")),
true,
Collections.singleton(new File("cp12"))
);