blob: 912d1df17b4832804a09144a3aa1bbd6e7d75fa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package org.jetbrains.dokka.dokkatoo.utils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.BuildTask
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.internal.DefaultGradleRunner
/** Edit environment variables in the Gradle Runner */
@Deprecated("Windows does not support withEnvironment - https://github.com/gradle/gradle/issues/23959")
fun GradleRunner.withEnvironment(build: MutableMap<String, String?>.() -> Unit): GradleRunner {
val env = environment ?: mutableMapOf()
env.build()
return withEnvironment(env)
}
inline fun GradleRunner.build(
handleResult: BuildResult.() -> Unit
): Unit = build().let(handleResult)
inline fun GradleRunner.buildAndFail(
handleResult: BuildResult.() -> Unit
): Unit = buildAndFail().let(handleResult)
fun GradleRunner.withJvmArguments(
vararg jvmArguments: String
): GradleRunner = (this as DefaultGradleRunner).withJvmArguments(*jvmArguments)
/**
* Helper function to _append_ [arguments] to any existing
* [GradleRunner arguments][GradleRunner.getArguments].
*/
fun GradleRunner.addArguments(
vararg arguments: String
): GradleRunner =
withArguments(this@addArguments.arguments + arguments)
/**
* Get the name of the task, without the leading [BuildTask.getPath].
*/
val BuildTask.name: String
get() = path.substringAfterLast(':')
|