diff --git a/kobalt.iml b/kobalt.iml index 4d0d4495..07f2665c 100644 --- a/kobalt.iml +++ b/kobalt.iml @@ -4,11 +4,12 @@ - - + + + diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml index 2f22cf63..15ff1f88 100644 --- a/kobalt/Build.kt.iml +++ b/kobalt/Build.kt.iml @@ -9,5 +9,6 @@ + \ No newline at end of file diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 1abdfef8..712ae607 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -64,7 +64,7 @@ val kobaltPluginApi = project { } dependencies { - compile("org.jetbrains.kotlinx:kotlinx.dom:0.0.4", + compile("org.jetbrains.kotlinx:kotlinx.dom:0.0.8", "com.squareup.okhttp:okhttp:2.5.0", "com.squareup.okio:okio:1.6.0", @@ -111,7 +111,7 @@ val kobaltApp = project(kobaltPluginApi, wrapper) { dependencies { // Used by the plugins - compile("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.0-beta-4584") + compile("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.0-rc-1036") // Used by the main app compile("com.github.spullara.mustache.java:compiler:0.9.1", diff --git a/modules/kobalt-plugin-api/kobalt-plugin-api.iml b/modules/kobalt-plugin-api/kobalt-plugin-api.iml index 5562e359..1e739234 100644 --- a/modules/kobalt-plugin-api/kobalt-plugin-api.iml +++ b/modules/kobalt-plugin-api/kobalt-plugin-api.iml @@ -7,6 +7,7 @@ + diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BuildScript.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BuildScript.kt index f22bb567..ac242117 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BuildScript.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BuildScript.kt @@ -9,7 +9,7 @@ import java.io.File @Directive fun homeDir(vararg dirs: String) : String = SystemProperties.homeDir + - File.separator + dirs.toArrayList().joinToString(File.separator) + File.separator + dirs.toMutableList().joinToString(File.separator) @Directive fun localMavenRepo() = homeDir(".m2" + File.separator + "repository/") diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt index fdae0167..651289c7 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt @@ -86,7 +86,7 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider> { val result = arrayListOf>() - var currentClass : Class = plugin.javaClass + var currentClass : Class? = plugin.javaClass // Tasks can come from two different places: plugin classes and build files. // When a task is read from a build file, ScriptCompiler adds it right away to plugin.methodTasks. diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt index f112f121..e02a8769 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt @@ -105,12 +105,12 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null, private fun findBuildTypeBuildConfig(project: Project, variant: Variant?) : BuildConfig? { val buildTypeName = variant?.buildType?.name - return project.buildTypes.getRaw(buildTypeName)?.buildConfig ?: null + return project.buildTypes[buildTypeName]?.buildConfig ?: null } private fun findProductFlavorBuildConfig(project: Project, variant: Variant?) : BuildConfig? { val buildTypeName = variant?.productFlavor?.name - return project.productFlavors.getRaw(buildTypeName)?.buildConfig ?: null + return project.productFlavors[buildTypeName]?.buildConfig ?: null } /** @@ -145,7 +145,7 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null, val result = KFiles.makeDir(KFiles.generatedSourceDir(project, this, "buildConfig")) // Make sure the generatedSourceDirectory doesn't contain the project.directory since // that directory will be added when trying to find recursively all the sources in it - generatedSourceDirectory = File(result.relativeTo(File(project.directory))) + generatedSourceDirectory = File(result.relativeTo(File(project.directory)).absolutePath) val outputGeneratedSourceDirectory = File(result, pkg.replace('.', File.separatorChar)) val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors) val outputDir = File(outputGeneratedSourceDirectory, diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt index 0df61b78..944b5827 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt @@ -38,7 +38,7 @@ abstract class GenericTestRunner : ITestRunnerContributor { } private fun toClassPaths(paths: List): ArrayList = - paths.map { if (it.endsWith("class")) it else it + "class" }.toArrayList() + paths.map { if (it.endsWith("class")) it else it + "class" }.toCollection(ArrayList()) /** * @return true if all the tests passed diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt index 6e7a8976..d77cb56a 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt @@ -14,5 +14,5 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) { public val lastModified : Long get() = Files.readAttributes(realPath, BasicFileAttributes::class.java).lastModifiedTime().toMillis() - public val directory : File get() = path.toFile().directory + public val directory : File get() = path.toFile().parentFile } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt index b49db1ec..3d9028fb 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt @@ -78,7 +78,7 @@ class KFiles { /** * Join the paths elements with the file separator. */ - fun joinDir(vararg ts: String): String = ts.toArrayList().joinToString(File.separator) + fun joinDir(vararg ts: String): String = ts.toMutableList().joinToString(File.separator) /** * The paths elements are expected to be a directory. Make that directory and join the @@ -176,14 +176,16 @@ class KFiles { } try { // We cannot break for loop from inside a lambda, so we have to use an exception here - for (src in from.walkTopDown().fail { f, e -> if (onError(f, e) == OnErrorAction.TERMINATE) throw TerminateException(f) }) { + for (src in from.walkTopDown().onFail { f, e -> + if (onError(f, e) == OnErrorAction.TERMINATE) throw TerminateException(f) + }) { if (!src.exists()) { if (onError(src, NoSuchFileException(file = src, reason = "The source file doesn't exist")) == OnErrorAction.TERMINATE) return false } else { val relPath = src.relativeTo(from) - val dstFile = File(dst, relPath) + val dstFile = File(KFiles.joinDir(dst.path, relPath.path)) if (dstFile.exists() && !replaceExisting && !(src.isDirectory && dstFile.isDirectory)) { if (onError(dstFile, FileAlreadyExistsException(file = src, other = dstFile, @@ -195,7 +197,8 @@ class KFiles { if (Features.USE_TIMESTAMPS && dstFile.exists() && Md5.toMd5(src) == Md5.toMd5(dstFile)) { log(2, " Identical files, not copying $src to $dstFile") } else { - if (src.copyTo(dstFile, true) != src.length()) { + val target = src.copyTo(dstFile, true) + if (target.length() != src.length()) { if (onError(src, IOException("src.length() != dst.length()")) == OnErrorAction.TERMINATE) return false diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Topological.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Topological.kt index 0003b4a4..b0a92315 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Topological.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Topological.kt @@ -16,7 +16,7 @@ class Topological { } fun addEdge(t: T, others: Array) { - dependingOn.putAll(t, others.toArrayList()) + dependingOn.putAll(t, others.toMutableList()) } /** diff --git a/src/main/kotlin/com/beust/kobalt/app/BuildGenerator.kt b/src/main/kotlin/com/beust/kobalt/app/BuildGenerator.kt index 2873c7f5..8c9c7359 100644 --- a/src/main/kotlin/com/beust/kobalt/app/BuildGenerator.kt +++ b/src/main/kotlin/com/beust/kobalt/app/BuildGenerator.kt @@ -37,7 +37,7 @@ abstract class BuildGenerator : IInitContributor { } val properties = pom.properties - val mapped = properties.entries.toMapBy({ it.key }, { ProjectGenerator.toIdentifier(it.key) }) + val mapped = properties.entries.associateBy({ it.key }, { ProjectGenerator.toIdentifier(it.key) }) map.put("properties", properties.entries.map({ Pair(mapped[it.key], it.value) })) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt index 8729eb9b..5d12f50b 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt @@ -32,7 +32,7 @@ class KotlinCompiler @Inject constructor( val executors: KobaltExecutors, val jvmCompiler: JvmCompiler) { companion object { - val KOTLIN_VERSION = "1.0.0-beta-4584" + val KOTLIN_VERSION = "1.0.0-rc-1036" } val compilerAction = object: ICompilerAction {