Fix opt-in related bootstrap problem in kotlin-native/build-tools

This commit is contained in:
Mikhail Glukhikh
2022-11-22 11:52:08 +01:00
committed by Space Team
parent bf4d48e208
commit 774bed875a
4 changed files with 10 additions and 4 deletions
@@ -53,7 +53,7 @@ private fun Executor.service(project: Project) = object: ExecutorService {
val execSpec = project.objects.newInstance<DefaultExecSpec>().apply {
action.execute(this)
}
val request = ExecuteRequest(
val request = executeRequest(
executableAbsolutePath = execSpec.executable,
args = execSpec.args,
).apply {
@@ -10,7 +10,6 @@ import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.getByType
import org.gradle.process.ExecOperations
import org.gradle.workers.WorkAction
import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
@@ -51,7 +50,7 @@ private abstract class RunGTestJob : WorkAction<RunGTestJob.Parameters> {
with(parameters) {
reportFileUnprocessed.asFile.get().parentFile.mkdirs()
executor.execute(ExecuteRequest(this@with.executable.asFile.get().absolutePath).apply {
executor.execute(executeRequest(this@with.executable.asFile.get().absolutePath).apply {
this.args.add("--gtest_output=xml:${reportFileUnprocessed.asFile.get().absolutePath}")
filter.orNull?.also {
this.args.add("--gtest_filter=${it}")
@@ -61,6 +61,13 @@ data class ExecuteRequest(
inline fun copying(block: ExecuteRequest.() -> Unit): ExecuteRequest = copy().apply(block)
}
/**
* Helper for [ExecuteRequest] creation.
* Allows to create it without opting in [kotlin.time.ExperimentalTime] for API < 1.6.
*/
fun executeRequest(executableAbsolutePath: String, args: MutableList<String> = mutableListOf()): ExecuteRequest =
ExecuteRequest(executableAbsolutePath, args)
data class ExecuteResponse(
/**
* Process exit code if it exited by itself, or `null` if it was killed by a timeout.
@@ -17,7 +17,7 @@ private fun defaultDeviceName(target: KonanTarget) = when (target.family) {
}
private fun Executor.run(executableAbsolutePath: String, vararg args: String) = ByteArrayOutputStream().let {
this.execute(ExecuteRequest(executableAbsolutePath).apply {
this.execute(executeRequest(executableAbsolutePath).apply {
this.args.addAll(args)
stdout = it
workingDirectory = File("").absoluteFile