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

@ -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())
}
/**