1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Update to RC.

This commit is contained in:
Cedric Beust 2016-02-05 22:52:12 +04:00
parent 0e2e946884
commit c27ec46e73
13 changed files with 24 additions and 18 deletions

View file

@ -4,11 +4,12 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="library" name="kobalt (Compile)" level="project" />
<orderEntry type="library" scope="TEST" name="kobalt (Test)" level="project" />
<orderEntry type="module" module-name="kobalt-plugin-api" />

View file

@ -9,5 +9,6 @@
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kobalt.jar" level="project" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>

View file

@ -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",

View file

@ -7,6 +7,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kobalt (Compile)" level="project" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="library" name="kobalt-plugin-api (Compile)" level="project" />
<orderEntry type="library" scope="TEST" name="kobalt-plugin-api (Test)" level="project" />
</component>

View file

@ -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/")

View file

@ -86,7 +86,7 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider<Tas
: List<Pair<Method, T>> {
val result = arrayListOf<Pair<Method, T>>()
var currentClass : Class<in Any> = plugin.javaClass
var currentClass : Class<in Any>? = 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.

View file

@ -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,

View file

@ -38,7 +38,7 @@ abstract class GenericTestRunner : ITestRunnerContributor {
}
private fun toClassPaths(paths: List<String>): ArrayList<String> =
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

View file

@ -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
}

View file

@ -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

View file

@ -16,7 +16,7 @@ class Topological<T> {
}
fun addEdge(t: T, others: Array<out T>) {
dependingOn.putAll(t, others.toArrayList())
dependingOn.putAll(t, others.toMutableList())
}
/**

View file

@ -37,7 +37,7 @@ abstract class BuildGenerator : IInitContributor<File> {
}
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) }))

View file

@ -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 {