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:
parent
0e2e946884
commit
c27ec46e73
13 changed files with 24 additions and 18 deletions
|
@ -4,11 +4,12 @@
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
|
<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/main/resources" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||||
<orderEntry type="library" name="kobalt (Compile)" level="project" />
|
<orderEntry type="library" name="kobalt (Compile)" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="kobalt (Test)" level="project" />
|
<orderEntry type="library" scope="TEST" name="kobalt (Test)" level="project" />
|
||||||
<orderEntry type="module" module-name="kobalt-plugin-api" />
|
<orderEntry type="module" module-name="kobalt-plugin-api" />
|
||||||
|
|
|
@ -9,5 +9,6 @@
|
||||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="kobalt.jar" level="project" />
|
<orderEntry type="library" name="kobalt.jar" level="project" />
|
||||||
|
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -64,7 +64,7 @@ val kobaltPluginApi = project {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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.okhttp:okhttp:2.5.0",
|
||||||
"com.squareup.okio:okio:1.6.0",
|
"com.squareup.okio:okio:1.6.0",
|
||||||
|
@ -111,7 +111,7 @@ val kobaltApp = project(kobaltPluginApi, wrapper) {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Used by the plugins
|
// 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
|
// Used by the main app
|
||||||
compile("com.github.spullara.mustache.java:compiler:0.9.1",
|
compile("com.github.spullara.mustache.java:compiler:0.9.1",
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="kobalt (Compile)" level="project" />
|
<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" name="kobalt-plugin-api (Compile)" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="kobalt-plugin-api (Test)" level="project" />
|
<orderEntry type="library" scope="TEST" name="kobalt-plugin-api (Test)" level="project" />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.io.File
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
fun homeDir(vararg dirs: String) : String = SystemProperties.homeDir +
|
fun homeDir(vararg dirs: String) : String = SystemProperties.homeDir +
|
||||||
File.separator + dirs.toArrayList().joinToString(File.separator)
|
File.separator + dirs.toMutableList().joinToString(File.separator)
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
fun localMavenRepo() = homeDir(".m2" + File.separator + "repository/")
|
fun localMavenRepo() = homeDir(".m2" + File.separator + "repository/")
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider<Tas
|
||||||
: List<Pair<Method, T>> {
|
: List<Pair<Method, T>> {
|
||||||
val result = arrayListOf<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.
|
// 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.
|
// When a task is read from a build file, ScriptCompiler adds it right away to plugin.methodTasks.
|
||||||
|
|
|
@ -105,12 +105,12 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
||||||
|
|
||||||
private fun findBuildTypeBuildConfig(project: Project, variant: Variant?) : BuildConfig? {
|
private fun findBuildTypeBuildConfig(project: Project, variant: Variant?) : BuildConfig? {
|
||||||
val buildTypeName = variant?.buildType?.name
|
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? {
|
private fun findProductFlavorBuildConfig(project: Project, variant: Variant?) : BuildConfig? {
|
||||||
val buildTypeName = variant?.productFlavor?.name
|
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"))
|
val result = KFiles.makeDir(KFiles.generatedSourceDir(project, this, "buildConfig"))
|
||||||
// Make sure the generatedSourceDirectory doesn't contain the project.directory since
|
// 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
|
// 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 outputGeneratedSourceDirectory = File(result, pkg.replace('.', File.separatorChar))
|
||||||
val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors)
|
val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors)
|
||||||
val outputDir = File(outputGeneratedSourceDirectory,
|
val outputDir = File(outputGeneratedSourceDirectory,
|
||||||
|
|
|
@ -38,7 +38,7 @@ abstract class GenericTestRunner : ITestRunnerContributor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun toClassPaths(paths: List<String>): ArrayList<String> =
|
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
|
* @return true if all the tests passed
|
||||||
|
|
|
@ -14,5 +14,5 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) {
|
||||||
public val lastModified : Long
|
public val lastModified : Long
|
||||||
get() = Files.readAttributes(realPath, BasicFileAttributes::class.java).lastModifiedTime().toMillis()
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class KFiles {
|
||||||
/**
|
/**
|
||||||
* Join the paths elements with the file separator.
|
* 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
|
* The paths elements are expected to be a directory. Make that directory and join the
|
||||||
|
@ -176,14 +176,16 @@ class KFiles {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// We cannot break for loop from inside a lambda, so we have to use an exception here
|
// 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 (!src.exists()) {
|
||||||
if (onError(src, NoSuchFileException(file = src, reason = "The source file doesn't exist")) ==
|
if (onError(src, NoSuchFileException(file = src, reason = "The source file doesn't exist")) ==
|
||||||
OnErrorAction.TERMINATE)
|
OnErrorAction.TERMINATE)
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
val relPath = src.relativeTo(from)
|
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 (dstFile.exists() && !replaceExisting && !(src.isDirectory && dstFile.isDirectory)) {
|
||||||
if (onError(dstFile, FileAlreadyExistsException(file = src,
|
if (onError(dstFile, FileAlreadyExistsException(file = src,
|
||||||
other = dstFile,
|
other = dstFile,
|
||||||
|
@ -195,7 +197,8 @@ class KFiles {
|
||||||
if (Features.USE_TIMESTAMPS && dstFile.exists() && Md5.toMd5(src) == Md5.toMd5(dstFile)) {
|
if (Features.USE_TIMESTAMPS && dstFile.exists() && Md5.toMd5(src) == Md5.toMd5(dstFile)) {
|
||||||
log(2, " Identical files, not copying $src to $dstFile")
|
log(2, " Identical files, not copying $src to $dstFile")
|
||||||
} else {
|
} else {
|
||||||
if (src.copyTo(dstFile, true) != src.length()) {
|
val target = src.copyTo(dstFile, true)
|
||||||
|
if (target.length() != src.length()) {
|
||||||
if (onError(src,
|
if (onError(src,
|
||||||
IOException("src.length() != dst.length()")) == OnErrorAction.TERMINATE)
|
IOException("src.length() != dst.length()")) == OnErrorAction.TERMINATE)
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Topological<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addEdge(t: T, others: Array<out T>) {
|
fun addEdge(t: T, others: Array<out T>) {
|
||||||
dependingOn.putAll(t, others.toArrayList())
|
dependingOn.putAll(t, others.toMutableList())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,7 @@ abstract class BuildGenerator : IInitContributor<File> {
|
||||||
}
|
}
|
||||||
|
|
||||||
val properties = pom.properties
|
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) }))
|
map.put("properties", properties.entries.map({ Pair(mapped[it.key], it.value) }))
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class KotlinCompiler @Inject constructor(
|
||||||
val executors: KobaltExecutors,
|
val executors: KobaltExecutors,
|
||||||
val jvmCompiler: JvmCompiler) {
|
val jvmCompiler: JvmCompiler) {
|
||||||
companion object {
|
companion object {
|
||||||
val KOTLIN_VERSION = "1.0.0-beta-4584"
|
val KOTLIN_VERSION = "1.0.0-rc-1036"
|
||||||
}
|
}
|
||||||
|
|
||||||
val compilerAction = object: ICompilerAction {
|
val compilerAction = object: ICompilerAction {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue