mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Implement startBitcoindRegtest Gradle Task
This commit is contained in:
parent
45c4d16a0c
commit
4575d2a229
17
build-logic/regtest/build.gradle
Normal file
17
build-logic/regtest/build.gradle
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
|
||||||
|
id 'org.gradle.kotlin.kotlin-dsl' version '2.4.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePlugin {
|
||||||
|
plugins {
|
||||||
|
simplePlugin {
|
||||||
|
id = 'bisq.gradle.regtest_plugin.RegtestPlugin'
|
||||||
|
implementationClass = 'bisq.gradle.regtest_plugin.RegtestPlugin'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package bisq.gradle.regtest_plugin
|
||||||
|
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.register
|
||||||
|
|
||||||
|
class RegtestPlugin : Plugin<Project> {
|
||||||
|
|
||||||
|
override fun apply(project: Project) {
|
||||||
|
val startBitcoindTask = project.tasks.register<StartBitcoindTask>("startBitcoindRegtest") {
|
||||||
|
dataDirectory.set(project.layout.projectDirectory.dir(".localnet/bitcoind"))
|
||||||
|
rpcUser.set("bisqdao")
|
||||||
|
rpcPassword.set("bsq")
|
||||||
|
blockNotifyArg.set(".localnet/bitcoind/blocknotify %s")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package bisq.gradle.regtest_plugin
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.file.DirectoryProperty
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.InputDirectory
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
abstract class StartBitcoindTask : DefaultTask() {
|
||||||
|
|
||||||
|
@get:InputDirectory
|
||||||
|
abstract val dataDirectory: DirectoryProperty
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
abstract val rpcUser: Property<String>
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
abstract val rpcPassword: Property<String>
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
abstract val blockNotifyArg: Property<String>
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun run() {
|
||||||
|
val processBuilder = ProcessBuilder(
|
||||||
|
"bitcoind",
|
||||||
|
"-datadir=${dataDirectory.asFile.get().absolutePath}",
|
||||||
|
"-regtest",
|
||||||
|
|
||||||
|
"-prune=0",
|
||||||
|
"-txindex=1",
|
||||||
|
"-peerbloomfilters=1",
|
||||||
|
"-server",
|
||||||
|
|
||||||
|
"-rpcuser=${rpcUser.get()}",
|
||||||
|
"-rpcpassword=${rpcPassword.get()}",
|
||||||
|
|
||||||
|
"-blocknotify= ${blockNotifyArg.get()}"
|
||||||
|
)
|
||||||
|
|
||||||
|
processBuilder.redirectErrorStream(true)
|
||||||
|
processBuilder.redirectOutput(ProcessBuilder.Redirect.DISCARD)
|
||||||
|
|
||||||
|
processBuilder.start()
|
||||||
|
}
|
||||||
|
}
|
@ -10,4 +10,5 @@ include 'app-start-plugin'
|
|||||||
include 'commons'
|
include 'commons'
|
||||||
include 'gradle-tasks'
|
include 'gradle-tasks'
|
||||||
include 'packaging'
|
include 'packaging'
|
||||||
|
include 'regtest'
|
||||||
include 'tor-binary'
|
include 'tor-binary'
|
||||||
|
@ -6,6 +6,10 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'bisq.gradle.regtest_plugin.RegtestPlugin'
|
||||||
|
}
|
||||||
|
|
||||||
if (hasProperty('buildScan')) {
|
if (hasProperty('buildScan')) {
|
||||||
buildScan {
|
buildScan {
|
||||||
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
|
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
|
||||||
|
Loading…
Reference in New Issue
Block a user