mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Make Kotlin compileTest incremental.
This commit is contained in:
parent
e451eb8661
commit
e7f844ab7f
1 changed files with 18 additions and 3 deletions
|
@ -1,14 +1,16 @@
|
||||||
package com.beust.kobalt.plugin.kotlin
|
package com.beust.kobalt.plugin.kotlin
|
||||||
|
|
||||||
|
import com.beust.kobalt.IncrementalTaskInfo
|
||||||
import com.beust.kobalt.TaskResult
|
import com.beust.kobalt.TaskResult
|
||||||
import com.beust.kobalt.api.*
|
import com.beust.kobalt.api.*
|
||||||
import com.beust.kobalt.api.annotation.Directive
|
import com.beust.kobalt.api.annotation.Directive
|
||||||
import com.beust.kobalt.api.annotation.Task
|
import com.beust.kobalt.api.annotation.IncrementalTask
|
||||||
import com.beust.kobalt.internal.JvmCompiler
|
import com.beust.kobalt.internal.JvmCompiler
|
||||||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||||
import com.beust.kobalt.maven.DepFactory
|
import com.beust.kobalt.maven.DepFactory
|
||||||
import com.beust.kobalt.maven.DependencyManager
|
import com.beust.kobalt.maven.DependencyManager
|
||||||
import com.beust.kobalt.maven.LocalRepo
|
import com.beust.kobalt.maven.LocalRepo
|
||||||
|
import com.beust.kobalt.maven.Md5
|
||||||
import com.beust.kobalt.maven.dependency.FileDependency
|
import com.beust.kobalt.maven.dependency.FileDependency
|
||||||
import com.beust.kobalt.maven.dependency.MavenDependency
|
import com.beust.kobalt.maven.dependency.MavenDependency
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
@ -73,8 +75,21 @@ class KotlinPlugin @Inject constructor(
|
||||||
// return TaskResult(success)
|
// return TaskResult(success)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Task(name = TASK_COMPILE_TEST, description = "Compile the tests", runAfter = arrayOf(TASK_COMPILE))
|
@IncrementalTask(name = TASK_COMPILE_TEST, description = "Compile the tests", runAfter = arrayOf(TASK_COMPILE))
|
||||||
fun taskCompileTest(project: Project): TaskResult {
|
fun taskCompileTest(project: Project): IncrementalTaskInfo {
|
||||||
|
val inputChecksum = Md5.toMd5Directories(project.sourceDirectoriesTest.map {
|
||||||
|
File(project.directory, it)
|
||||||
|
})
|
||||||
|
return IncrementalTaskInfo(
|
||||||
|
inputChecksum = inputChecksum,
|
||||||
|
outputChecksum = {
|
||||||
|
Md5.toMd5Directories(listOf(KFiles.makeOutputTestDir(project)))
|
||||||
|
},
|
||||||
|
task = { project -> doTaskCompileTest(project) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun doTaskCompileTest(project: Project) : TaskResult {
|
||||||
copyResources(project, JvmCompilerPlugin.SOURCE_SET_TEST)
|
copyResources(project, JvmCompilerPlugin.SOURCE_SET_TEST)
|
||||||
val projectDir = File(project.directory)
|
val projectDir = File(project.directory)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue