reformat: indent size fixed

This commit is contained in:
nik
2014-08-06 16:20:29 +04:00
parent 971c898015
commit 6ae57d2bc5
@@ -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().first { 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)
}