-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
debug.gradle.kts
53 lines (45 loc) · 1.75 KB
/
debug.gradle.kts
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
48
49
50
51
52
53
import java.io.ByteArrayOutputStream
evaluationDependsOn(":client")
gradle.projectsEvaluated {
tasks.register<JavaExec>("checkDockerClient") {
main = "de.gesellix.docker.client.LocalDocker"
val clientSourceSets = project(":client").extensions.getByType(SourceSetContainer::class)
classpath = clientSourceSets["main"].runtimeClasspath + clientSourceSets["test"].runtimeClasspath
standardOutput = ByteArrayOutputStream()
val environmentVariables = listOf(
"DOCKER_HOST",
"DOCKER_TLS_VERIFY"
)
val systemProperties = listOf(
"java.version",
"java.vendor",
"os.name",
"os.arch",
"os.version"
)
fun summary(): String {
val result = listOf("\nenvironment:\n") + environmentVariables.map {
"- $it: ${environment[it]}"
} + systemProperties.map {
"- $it: ${System.getProperty(it)}"
}
return result.joinToString("\n")
}
doFirst {
logger.lifecycle("running availability check...")
}
doLast {
val log = standardOutput.toString()
if (log.contains("connection success")) {
logger.info(log)
logger.lifecycle("\n* success * ${summary()}")
} else {
logger.lifecycle(log)
logger.lifecycle("\n* failed * ${summary()}")
}
logger.lifecycle("" +
"\nThank you for testing, please leave some feedback at https://github.com/gesellix/docker-client/issues/26" +
"\nIf possible, please also share the log output above!")
}
}
}