-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regtest: Implement seednode start tasks
- Loading branch information
Showing
2 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
build-logic/regtest/src/main/kotlin/bisq/gradle/regtest_plugin/StartSeedNodeTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package bisq.gradle.regtest_plugin | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.ListProperty | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.InputDirectory | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
abstract class StartSeedNodeTask : DefaultTask() { | ||
|
||
@get:InputFile | ||
abstract val startScriptFile: RegularFileProperty | ||
|
||
@get:Input | ||
abstract val arguments: ListProperty<String> | ||
|
||
@get:InputDirectory | ||
abstract val workingDirectory: DirectoryProperty | ||
|
||
@get:Internal | ||
abstract val logFile: RegularFileProperty | ||
|
||
@TaskAction | ||
fun run() { | ||
val processBuilder = ProcessBuilder( | ||
"bash", startScriptFile.asFile.get().absolutePath, arguments.get().joinToString(" ") | ||
) | ||
|
||
processBuilder.directory(workingDirectory.asFile.get()) | ||
processBuilder.redirectErrorStream(true) | ||
processBuilder.redirectOutput(logFile.asFile.get()) | ||
|
||
processBuilder.start() | ||
} | ||
} |