aboutsummaryrefslogtreecommitdiff
path: root/integration-tests/cli
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/cli')
-rw-r--r--integration-tests/cli/build.gradle.kts5
-rw-r--r--integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt1
-rw-r--r--integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt51
3 files changed, 2 insertions, 55 deletions
diff --git a/integration-tests/cli/build.gradle.kts b/integration-tests/cli/build.gradle.kts
index 5fdf0ff5..60d3a298 100644
--- a/integration-tests/cli/build.gradle.kts
+++ b/integration-tests/cli/build.gradle.kts
@@ -12,10 +12,6 @@ evaluationDependsOn(":plugins:base")
dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("test-junit"))
-
- val coroutines_version: String by project
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
-
}
/* Create a fat base plugin jar for cli tests */
@@ -35,6 +31,7 @@ val basePluginShadowJar by tasks.register("basePluginShadowJar", ShadowJar::clas
}
tasks.integrationTest {
+ inputs.dir((file("projects")))
val cliJar = tasks.getByPath(":runners:cli:shadowJar") as ShadowJar
environment("CLI_JAR_PATH", cliJar.archiveFile.get())
environment("BASE_PLUGIN_JAR_PATH", basePluginShadowJar.archiveFile.get())
diff --git a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt
index 49030c73..9f83c869 100644
--- a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt
+++ b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.it.cli
+import org.jetbrains.dokka.it.awaitProcessResult
import java.io.File
import kotlin.test.BeforeTest
import kotlin.test.Test
diff --git a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt b/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt
deleted file mode 100644
index d2fa3b31..00000000
--- a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.jetbrains.dokka.it.cli
-
-import kotlinx.coroutines.CompletableDeferred
-import kotlinx.coroutines.async
-import kotlinx.coroutines.runBlocking
-import kotlin.concurrent.thread
-
-class ProcessResult(
- val exitCode: Int,
- val output: String
-)
-
-fun Process.awaitProcessResult() = runBlocking {
- val exitCode = async { awaitExitCode() }
- val output = async { awaitOutput() }
- ProcessResult(
- exitCode.await(),
- output.await()
- )
-}
-
-private suspend fun Process.awaitExitCode(): Int {
- val deferred = CompletableDeferred<Int>()
- thread {
- try {
- deferred.complete(this.waitFor())
- } catch (e: Throwable) {
- deferred.completeExceptionally(e)
- }
- }
-
- return deferred.await()
-}
-
-private suspend fun Process.awaitOutput(): String {
- val deferred = CompletableDeferred<String>()
- thread {
- try {
- var string = ""
- this.inputStream.bufferedReader().forEachLine { line ->
- println(line)
- string += line + System.lineSeparator()
- }
- deferred.complete(string)
- } catch (e: Throwable) {
- deferred.completeExceptionally(e)
- }
- }
-
- return deferred.await()
-}