summaryrefslogtreecommitdiff
path: root/jps/jps-builders/testSrc/org/jetbrains
diff options
context:
space:
mode:
Diffstat (limited to 'jps/jps-builders/testSrc/org/jetbrains')
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/JavacFileEncodingTest.kt (renamed from jps/jps-builders/testSrc/org/jetbrains/jps/builders/JavacFileEncodingTest.groovy)7
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java6
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt98
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ArtifactRebuildTest.kt (renamed from jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ArtifactRebuildTest.groovy)70
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.groovy98
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.kt86
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ModuleRebuildTest.kt (renamed from jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ModuleRebuildTest.groovy)14
7 files changed, 182 insertions, 197 deletions
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JavacFileEncodingTest.groovy b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JavacFileEncodingTest.kt
index 80770ee36359..a3017b2bc2dd 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JavacFileEncodingTest.groovy
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JavacFileEncodingTest.kt
@@ -16,13 +16,14 @@
package org.jetbrains.jps.builders
import org.jetbrains.jps.builders.rebuild.JpsRebuildTestCase
+import org.jetbrains.jps.builders.rebuild.fs
/**
* @author nik
*/
-class JavacFileEncodingTest extends JpsRebuildTestCase {
- public void test() {
- doTest("javacFileEncoding/javacFileEncoding.ipr", {
+class JavacFileEncodingTest: JpsRebuildTestCase() {
+ fun test() {
+ doTest("javacFileEncoding/javacFileEncoding.ipr", fs {
dir("production") {
dir("javacFileEncoding") {
file("MyClass.class")
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
index 2c3fca029cd9..eb9b42a3904d 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
@@ -225,7 +225,7 @@ public abstract class JpsBuildTestCase extends UsefulTestCase {
Map<String, String> allPathVariables = new HashMap<String, String>(pathVariables.size() + 1);
allPathVariables.putAll(pathVariables);
allPathVariables.put(PathMacroUtil.APPLICATION_HOME_DIR, PathManager.getHomePath());
- addPathVariables(allPathVariables);
+ allPathVariables.putAll(getAdditionalPathVariables());
JpsProjectLoader.loadProject(myProject, allPathVariables, fullProjectPath);
}
catch (IOException e) {
@@ -233,7 +233,9 @@ public abstract class JpsBuildTestCase extends UsefulTestCase {
}
}
- protected void addPathVariables(Map<String, String> pathVariables) {
+ @NotNull
+ protected Map<String, String> getAdditionalPathVariables() {
+ return Collections.emptyMap();
}
@Nullable
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
index b76196eba947..cabb841db7f4 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
@@ -30,68 +30,68 @@ import org.junit.Assert
* @author nik
*/
public class ModuleClasspathTest(): JpsBuildTestCase() {
- override fun setUp() {
- super.setUp()
- addJdk("1.6", "/jdk.jar")
- addJdk("1.5", "/jdk15.jar")
- loadProject("moduleClasspath/moduleClasspath.ipr")
- }
+ override fun setUp() {
+ super.setUp()
+ addJdk("1.6", "/jdk.jar")
+ addJdk("1.5", "/jdk15.jar")
+ loadProject("moduleClasspath/moduleClasspath.ipr")
+ }
- private fun getProjectPath(): String {
- return FileUtil.toSystemIndependentName(getTestDataRootPath()) + "/moduleClasspath/moduleClasspath.ipr"
- }
+ private fun getProjectPath(): String {
+ return FileUtil.toSystemIndependentName(getTestDataRootPath()) + "/moduleClasspath/moduleClasspath.ipr"
+ }
- override fun getTestDataRootPath(): String {
- return FileUtil.toCanonicalPath(PathManagerEx.findFileUnderCommunityHome("jps/jps-builders/testData/output")!!.getAbsolutePath(), '/')!!
- }
+ override fun getTestDataRootPath(): String {
+ return FileUtil.toCanonicalPath(PathManagerEx.findFileUnderCommunityHome("jps/jps-builders/testData/output")!!.getAbsolutePath(), '/')!!
+ }
- public fun testSimpleClasspath() {
- assertClasspath("util", false, listOf("util/lib/exported.jar", "/jdk15.jar"))
- }
+ public fun testSimpleClasspath() {
+ assertClasspath("util", false, listOf("util/lib/exported.jar", "/jdk15.jar"))
+ }
- public fun testScopes() {
- assertClasspath("test-util", false, listOf("/jdk.jar", "test-util/lib/provided.jar"))
- assertClasspath("test-util", true, listOf("/jdk.jar", "test-util/lib/provided.jar", "test-util/lib/test.jar", "out/production/test-util"))
- }
+ public fun testScopes() {
+ assertClasspath("test-util", false, listOf("/jdk.jar", "test-util/lib/provided.jar"))
+ assertClasspath("test-util", true, listOf("/jdk.jar", "test-util/lib/provided.jar", "test-util/lib/test.jar", "out/production/test-util"))
+ }
- public fun testDepModules() {
- assertClasspath("main", false, listOf("util/lib/exported.jar", "out/production/util", "/jdk.jar", "main/lib/service.jar"))
- assertClasspath("main", true, listOf("out/production/main", "util/lib/exported.jar", "out/test/util", "out/production/util", "/jdk.jar", "out/test/test-util", "out/production/test-util", "main/lib/service.jar"))
- }
+ public fun testDepModules() {
+ assertClasspath("main", false, listOf("util/lib/exported.jar", "out/production/util", "/jdk.jar", "main/lib/service.jar"))
+ assertClasspath("main", true, listOf("out/production/main", "util/lib/exported.jar", "out/test/util", "out/production/util", "/jdk.jar", "out/test/test-util", "out/production/test-util", "main/lib/service.jar"))
+ }
- public fun testCompilationClasspath() {
- val chunk = createChunk("main")
- assertClasspath(listOf("util/lib/exported.jar", "out/production/util", "/jdk.jar"), getPathsList(ProjectPaths.getPlatformCompilationClasspath(chunk, true)))
- assertClasspath(listOf("main/lib/service.jar"), getPathsList(ProjectPaths.getCompilationClasspath(chunk, true)))
- }
+ public fun testCompilationClasspath() {
+ val chunk = createChunk("main")
+ assertClasspath(listOf("util/lib/exported.jar", "out/production/util", "/jdk.jar"), getPathsList(ProjectPaths.getPlatformCompilationClasspath(chunk, true)))
+ assertClasspath(listOf("main/lib/service.jar"), getPathsList(ProjectPaths.getCompilationClasspath(chunk, true)))
+ }
- private fun assertClasspath(moduleName: String, includeTests: Boolean, expected: List<String>) {
- val classpath = getPathsList(ProjectPaths.getCompilationClasspathFiles(createChunk(moduleName), includeTests, true, true))
- assertClasspath(expected, toSystemIndependentPaths(classpath))
- }
+ private fun assertClasspath(moduleName: String, includeTests: Boolean, expected: List<String>) {
+ val classpath = getPathsList(ProjectPaths.getCompilationClasspathFiles(createChunk(moduleName), includeTests, true, true))
+ assertClasspath(expected, toSystemIndependentPaths(classpath))
+ }
- private fun createChunk(moduleName: String): ModuleChunk {
- val module = myProject.getModules().firstOrNull { it.getName() == moduleName }
- return ModuleChunk(setOf(ModuleBuildTarget(module!!, JavaModuleBuildTargetType.PRODUCTION)))
- }
+ private fun createChunk(moduleName: String): ModuleChunk {
+ val module = myProject.getModules().first { it.getName() == moduleName }
+ return ModuleChunk(setOf(ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION)))
+ }
- private fun assertClasspath(expected: List<String>, classpath: List<String>) {
- val basePath = FileUtil.toSystemIndependentName(File(getProjectPath()).getParentFile()!!.getAbsolutePath()) + "/"
- val actual = toSystemIndependentPaths(classpath).map { StringUtil.trimStart(it, basePath) }
- Assert.assertEquals(expected.join("\n"), actual.join("\n"))
- }
+ private fun assertClasspath(expected: List<String>, classpath: List<String>) {
+ val basePath = FileUtil.toSystemIndependentName(File(getProjectPath()).getParentFile()!!.getAbsolutePath()) + "/"
+ val actual = toSystemIndependentPaths(classpath).map { StringUtil.trimStart(it, basePath) }
+ Assert.assertEquals(expected.join("\n"), actual.join("\n"))
+ }
- private fun toSystemIndependentPaths(classpath: List<String>): List<String> {
- return classpath.map(FileUtil::toSystemIndependentName)
- }
+ private fun toSystemIndependentPaths(classpath: List<String>): List<String> {
+ return classpath.map(FileUtil::toSystemIndependentName)
+ }
- public fun getPathsList(files: Collection<File>): List<String> {
- return files.map(::getCanonicalPath)
- }
+ public fun getPathsList(files: Collection<File>): List<String> {
+ return files.map(::getCanonicalPath)
+ }
}
private fun getCanonicalPath(file: File): String {
- val path = file.getPath()
- return if (path.contains(".")) FileUtil.toCanonicalPath(path)!! else FileUtil.toSystemIndependentName(path)
+ val path = file.getPath()
+ return if (path.contains(".")) FileUtil.toCanonicalPath(path)!! else FileUtil.toSystemIndependentName(path)
}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ArtifactRebuildTest.groovy b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ArtifactRebuildTest.kt
index 5f4de621d724..0a3a49d559e4 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ArtifactRebuildTest.groovy
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ArtifactRebuildTest.kt
@@ -20,14 +20,19 @@ import com.intellij.util.io.ZipUtil
import java.util.jar.Attributes
import java.util.jar.Manifest
+import java.io.File
+import java.io.FileInputStream
+import kotlin.test.assertTrue
+import kotlin.test.assertEquals
+
/**
* @author nik
*/
-class ArtifactRebuildTest extends JpsRebuildTestCase {
- public void testArtifactIncludesArchiveArtifact() {
- def name = "artifactIncludesArchiveArtifact"
+class ArtifactRebuildTest: JpsRebuildTestCase() {
+ fun testArtifactIncludesArchiveArtifact() {
+ val name = "artifactIncludesArchiveArtifact"
try {
- doTest("$name/${name}.ipr", {
+ doTest("$name/${name}.ipr", fs {
dir("artifacts") {
dir("data") {
archive("a.jar") {
@@ -38,16 +43,16 @@ class ArtifactRebuildTest extends JpsRebuildTestCase {
})
}
finally {
- FileUtil.delete(new File(FileUtil.toSystemDependentName(getTestDataRootPath() + "/$name/data/a.jar")))
+ FileUtil.delete(File(FileUtil.toSystemDependentName(getTestDataRootPath() + "/$name/data/a.jar")))
}
}
- public void testArtifactWithoutOutput() {
- def outDir = FileUtil.createTempDirectory("output", "").absolutePath
- loadProject("artifactWithoutOutput/artifactWithoutOutput.ipr", ["OUTPUT_DIR":outDir])
+ fun testArtifactWithoutOutput() {
+ val outDir = FileUtil.createTempDirectory("output", "").getAbsolutePath()
+ loadProject("artifactWithoutOutput/artifactWithoutOutput.ipr", mapOf("OUTPUT_DIR" to outDir))
rebuild()
- assertOutput(outDir, {
+ assertOutput(outDir, fs {
dir("artifacts") {
dir("main") {
file("data.txt")
@@ -57,8 +62,8 @@ class ArtifactRebuildTest extends JpsRebuildTestCase {
})
}
- public void testExtractDir() {
- doTest("extractDirTest/extractDirTest.ipr", {
+ fun testExtractDir() {
+ doTest("extractDirTest/extractDirTest.ipr", fs {
dir("artifacts") {
dir("extractDir") {
file("b.txt", "b")
@@ -88,20 +93,20 @@ class ArtifactRebuildTest extends JpsRebuildTestCase {
})
}
- public void testManifestInArtifact() {
- loadAndRebuild("manifestInArtifact/manifest.ipr", [:])
- File jarFile = new File(myOutputDirectory, "artifacts/simple/simple.jar")
- junit.framework.Assert.assertTrue(jarFile.exists())
- File extracted = FileUtil.createTempDirectory("build-manifest", "")
+ fun testManifestInArtifact() {
+ loadAndRebuild("manifestInArtifact/manifest.ipr", mapOf())
+ val jarFile = File(myOutputDirectory, "artifacts/simple/simple.jar")
+ assertTrue(jarFile.exists())
+ val extracted = FileUtil.createTempDirectory("build-manifest", "")
ZipUtil.extract(jarFile, extracted, null)
- File manifestFile = new File(extracted, "META-INF/MANIFEST.MF")
- junit.framework.Assert.assertTrue(manifestFile.exists())
- Manifest manifest = new Manifest(new FileInputStream(manifestFile))
- junit.framework.Assert.assertEquals("MyClass", manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS))
+ val manifestFile = File(extracted, "META-INF/MANIFEST.MF")
+ assertTrue(manifestFile.exists())
+ val manifest = Manifest(FileInputStream(manifestFile))
+ assertEquals("MyClass", manifest.getMainAttributes()!!.getValue(Attributes.Name.MAIN_CLASS))
}
- public void testOverwriteArtifacts() {
- doTest("overwriteTest/overwriteTest.ipr", {
+ fun testOverwriteArtifacts() {
+ doTest("overwriteTest/overwriteTest.ipr", fs {
dir("artifacts") {
dir("classes") {
file("a.xml", "<root2/>")
@@ -128,9 +133,9 @@ class ArtifactRebuildTest extends JpsRebuildTestCase {
})
}
- public void testPathVariablesInArtifact() {
- String externalDir = "${getTestDataRootPath()}/pathVariables/external"
- doTest("pathVariables/pathVariables.ipr", ["EXTERNAL_DIR": externalDir], {
+ fun testPathVariablesInArtifact() {
+ val externalDir = "${getTestDataRootPath()}/pathVariables/external"
+ doTest("pathVariables/pathVariables.ipr", mapOf("EXTERNAL_DIR" to externalDir), fs {
dir("artifacts") {
dir("fileCopy") {
dir("dir") {
@@ -141,8 +146,8 @@ class ArtifactRebuildTest extends JpsRebuildTestCase {
})
}
- public void testModuleTestOutputElement() {
- doTest("moduleTestOutput/moduleTestOutput.ipr", {
+ fun testModuleTestOutputElement() {
+ doTest("moduleTestOutput/moduleTestOutput.ipr", fs {
dir("artifacts") {
dir("tests") {
file("MyTest.class")
@@ -160,15 +165,4 @@ class ArtifactRebuildTest extends JpsRebuildTestCase {
}
})
}
-
- //todo[nik] fix
- public void _testSourceRootUnderOutput() throws Exception {
- loadProject("sourceFolderUnderOutput/sourceFolderUnderOutput.ipr", [:])
- try {
- rebuild()
- junit.framework.Assert.fail("Cleaning should fail")
- }
- catch (Exception ignored) {
- }
- }
}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.groovy b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.groovy
deleted file mode 100644
index 7c102399e989..000000000000
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.groovy
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2000-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.jps.builders.rebuild
-import com.intellij.openapi.application.ex.PathManagerEx
-import com.intellij.openapi.util.io.FileUtil
-import com.intellij.util.io.TestFileSystemBuilder
-import org.jetbrains.annotations.NotNull
-import org.jetbrains.jps.util.JpsPathUtil
-import org.jetbrains.jps.builders.JpsBuildTestCase
-import org.jetbrains.jps.model.java.JpsJavaExtensionService
-/**
- * @author nik
- */
-abstract class JpsRebuildTestCase extends JpsBuildTestCase {
- protected File myOutputDirectory;
-
- @Override
- protected void setUp() {
- super.setUp()
- addJdk("1.6")
- }
-
- def doTest(String projectPath, Closure expectedOutput) {
- doTest(projectPath, [:], expectedOutput)
- }
-
- def doTest(String projectPath, Map<String, String> pathVariables, Closure expectedOutput) {
- loadAndRebuild(projectPath, pathVariables)
- assertOutput(getOrCreateOutputDirectory().getAbsolutePath(), expectedOutput);
- }
-
- def protected assertOutput(@NotNull String targetFolder, Closure expectedOutput) {
- def root = TestFileSystemBuilder.fs()
- initFileSystemItem(root, expectedOutput)
- root.build().assertDirectoryEqual(new File(FileUtil.toSystemDependentName(targetFolder)))
- }
-
- protected void loadAndRebuild(String projectPath, Map<String, String> pathVariables) {
- loadProject(projectPath, pathVariables)
- rebuild()
- }
-
- protected void rebuild() {
- JpsJavaExtensionService.getInstance().getOrCreateProjectExtension(myProject).outputUrl = JpsPathUtil.pathToUrl(FileUtil.toSystemIndependentName(getOrCreateOutputDirectory().getAbsolutePath()))
- rebuildAll()
- }
-
- private File getOrCreateOutputDirectory() {
- if (myOutputDirectory == null) {
- myOutputDirectory = FileUtil.createTempDirectory("jps-build-output", "")
- }
- myOutputDirectory
- }
-
- @Override
- protected void addPathVariables(Map<String, String> pathVariables) {
- pathVariables.put("ARTIFACTS_OUT", FileUtil.toSystemIndependentName(getOrCreateOutputDirectory().absolutePath) + "/artifacts")
- }
-
- @Override
- protected String getTestDataRootPath() {
- return PathManagerEx.findFileUnderCommunityHome("jps/jps-builders/testData/output").absolutePath
- }
-
- def initFileSystemItem(TestFileSystemBuilder item, Closure initializer) {
- def meta = new Expando()
- meta.dir = {String name, Closure content ->
- initFileSystemItem(item.dir(name), content)
- }
- meta.archive = {String name, Closure content ->
- initFileSystemItem(item.archive(name), content)
- }
- meta.file = {Object[] args ->
- item.file((String)args[0], (String)args.length > 1 ? args[1] : null)
- }
-
- initializer.delegate = meta
- initializer.setResolveStrategy Closure.DELEGATE_FIRST
- initializer()
- }
-
- def File createTempFile() {
- return FileUtil.createTempFile("jps-build-file", "");
- }
-}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.kt b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.kt
new file mode 100644
index 000000000000..dae4cb005e1d
--- /dev/null
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/JpsRebuildTestCase.kt
@@ -0,0 +1,86 @@
+package org.jetbrains.jps.builders.rebuild;
+
+import com.intellij.openapi.application.ex.PathManagerEx;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.util.io.TestFileSystemBuilder;
+import org.jetbrains.jps.builders.JpsBuildTestCase;
+import org.jetbrains.jps.model.java.JpsJavaExtensionService;
+import org.jetbrains.jps.util.JpsPathUtil;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import kotlin.properties.Delegates
+import com.intellij.util.io.TestFileSystemItem
+
+/**
+ * @author nik
+ */
+public abstract class JpsRebuildTestCase: JpsBuildTestCase() {
+ protected val myOutputDirectory: File by Delegates.lazy {
+ FileUtil.createTempDirectory("jps-build-output", "")
+ }
+
+ override fun setUp() {
+ super.setUp()
+ addJdk("1.6");
+ }
+
+ fun doTest(projectPath: String, expectedOutput: TestFileSystemItem) {
+ doTest(projectPath, LinkedHashMap<String, String>(), expectedOutput);
+ }
+
+ fun doTest(projectPath: String, pathVariables: Map<String, String>, expectedOutput: TestFileSystemItem) {
+ loadAndRebuild(projectPath, pathVariables);
+ assertOutput(myOutputDirectory.getAbsolutePath(), expectedOutput);
+ }
+
+ fun assertOutput(targetFolder: String, expectedOutput: TestFileSystemItem) {
+ expectedOutput.assertDirectoryEqual(File(FileUtil.toSystemDependentName(targetFolder)));
+ }
+
+ fun loadAndRebuild(projectPath: String, pathVariables: Map<String, String>) {
+ loadProject(projectPath, pathVariables);
+ rebuild();
+ }
+
+ fun rebuild() {
+ JpsJavaExtensionService.getInstance()!!.getOrCreateProjectExtension(myProject)
+ .setOutputUrl(JpsPathUtil.pathToUrl(FileUtil.toSystemIndependentName(myOutputDirectory.getAbsolutePath())));
+ rebuildAll();
+ }
+
+ override fun getAdditionalPathVariables(): MutableMap<String, String> =
+ hashMapOf("ARTIFACTS_OUT" to FileUtil.toSystemIndependentName(myOutputDirectory.getAbsolutePath()) + "/artifacts")
+
+ protected override fun getTestDataRootPath(): String {
+ return PathManagerEx.findFileUnderCommunityHome("jps/jps-builders/testData/output")!!.getAbsolutePath();
+ }
+}
+
+fun fs(init: TestFileSystemBuilderBuilder.() -> Unit): TestFileSystemItem {
+ val builder = TestFileSystemBuilder.fs()
+ TestFileSystemBuilderBuilder(builder).init()
+ return builder.build()
+}
+
+class TestFileSystemBuilderBuilder(private val current: TestFileSystemBuilder) {
+ fun file(name: String) {
+ current.file(name)
+ }
+
+ fun file(name: String, content: String) {
+ current.file(name, content)
+ }
+
+ fun dir(name: String, init: TestFileSystemBuilderBuilder.() -> Unit) {
+ val dir = current.dir(name)
+ TestFileSystemBuilderBuilder(dir).init()
+ dir.end()
+ }
+
+ fun archive(name: String, init: TestFileSystemBuilderBuilder.() -> Unit) {
+ val dir = current.archive(name)
+ TestFileSystemBuilderBuilder(dir).init()
+ dir.end()
+ }
+} \ No newline at end of file
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ModuleRebuildTest.groovy b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ModuleRebuildTest.kt
index 36e03eb0890b..09e72b77cf2a 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ModuleRebuildTest.groovy
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/rebuild/ModuleRebuildTest.kt
@@ -17,9 +17,9 @@ package org.jetbrains.jps.builders.rebuild
/**
* @author nik
*/
-public class ModuleRebuildTest extends JpsRebuildTestCase {
- public void testModuleCycle() {
- doTest("moduleCycle/moduleCycle.ipr", {
+public class ModuleRebuildTest: JpsRebuildTestCase() {
+ fun testModuleCycle() {
+ doTest("moduleCycle/moduleCycle.ipr", fs {
dir("production") {
dir("module1") {
file("Bar1.class")
@@ -34,8 +34,8 @@ public class ModuleRebuildTest extends JpsRebuildTestCase {
})
}
- public void testOverlappingSourceRoots() {
- doTest("overlappingSourceRoots/overlappingSourceRoots.ipr", {
+ fun testOverlappingSourceRoots() {
+ doTest("overlappingSourceRoots/overlappingSourceRoots.ipr", fs {
dir("production") {
dir("inner") {
dir("y") {
@@ -52,8 +52,8 @@ public class ModuleRebuildTest extends JpsRebuildTestCase {
})
}
- public void testResourceCopying() {
- doTest("resourceCopying/resourceCopying.ipr", {
+ fun testResourceCopying() {
+ doTest("resourceCopying/resourceCopying.ipr", fs {
dir("production") {
dir("resourceCopying") {
dir("copy") {