2022-02-17 22:49:35 +01:00
|
|
|
import org.gradle.util.GradleVersion
|
|
|
|
|
2022-01-04 05:36:12 +01:00
|
|
|
plugins {
|
|
|
|
id 'java'
|
|
|
|
id 'application'
|
2022-02-17 22:49:35 +01:00
|
|
|
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
|
2024-08-28 11:59:49 +02:00
|
|
|
id 'org.graalvm.buildtools.native' version '0.10.2' apply false
|
2022-01-04 05:36:12 +01:00
|
|
|
}
|
|
|
|
|
2022-02-17 22:49:35 +01:00
|
|
|
def annotationProcessorMinVersion = GradleVersion.version("4.6")
|
2024-09-25 18:58:52 +02:00
|
|
|
boolean hasAnnotationProcessor = GradleVersion.current() >= annotationProcessorMinVersion
|
2022-04-14 00:05:58 +02:00
|
|
|
def junit5MinVersion = GradleVersion.version("4.6")
|
2024-09-25 18:58:52 +02:00
|
|
|
boolean hasJunit5 = GradleVersion.current() >= junit5MinVersion
|
2022-02-17 22:49:35 +01:00
|
|
|
|
2023-09-20 18:23:23 +02:00
|
|
|
def graalVMMinVersion = GradleVersion.version("7.4") // Toolchains with selection by vendor
|
2024-09-25 18:58:52 +02:00
|
|
|
boolean hasGraalVM = GradleVersion.current() >= graalVMMinVersion
|
2022-05-02 20:57:59 +02:00
|
|
|
|
2022-01-04 05:36:12 +01:00
|
|
|
dependencies {
|
|
|
|
implementation project(':bitcoinj-core')
|
2024-05-08 12:52:19 +02:00
|
|
|
implementation 'info.picocli:picocli:4.7.6'
|
2024-08-03 09:40:20 +02:00
|
|
|
implementation 'org.slf4j:slf4j-jdk14:2.0.13'
|
2022-02-17 22:49:35 +01:00
|
|
|
if (hasAnnotationProcessor) {
|
2024-05-08 12:52:19 +02:00
|
|
|
annotationProcessor 'info.picocli:picocli-codegen:4.7.6'
|
2022-02-17 22:49:35 +01:00
|
|
|
} else {
|
2024-05-08 12:52:19 +02:00
|
|
|
compileOnly 'info.picocli:picocli-codegen:4.7.6'
|
2022-02-17 22:49:35 +01:00
|
|
|
}
|
2022-04-14 00:05:58 +02:00
|
|
|
|
2024-08-03 09:52:53 +02:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3"
|
|
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3"
|
2022-04-14 00:05:58 +02:00
|
|
|
|
2024-08-03 09:40:20 +02:00
|
|
|
testImplementation 'org.slf4j:slf4j-jdk14:2.0.13'
|
2022-01-04 05:36:12 +01:00
|
|
|
}
|
|
|
|
|
2024-08-29 22:56:59 +02:00
|
|
|
tasks.withType(JavaCompile) {
|
2024-08-29 08:42:20 +02:00
|
|
|
options.compilerArgs.addAll(['--release', '17'])
|
2022-04-18 19:42:38 +02:00
|
|
|
options.compilerArgs << '-Xlint:deprecation'
|
2024-08-29 22:56:59 +02:00
|
|
|
options.encoding = 'UTF-8'
|
2022-01-04 05:36:12 +01:00
|
|
|
}
|
|
|
|
|
2024-08-29 22:56:59 +02:00
|
|
|
javadoc.options.encoding = 'UTF-8'
|
|
|
|
|
2022-01-04 05:36:12 +01:00
|
|
|
mainClassName = "org.bitcoinj.wallettool.WalletTool"
|
|
|
|
applicationName = "wallet-tool"
|
2022-02-17 22:49:35 +01:00
|
|
|
|
2022-04-14 00:05:58 +02:00
|
|
|
// wallettool is using JUnit 5 for testing, if it's not available no tests will be run
|
|
|
|
if (hasJunit5) {
|
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-17 22:49:35 +01:00
|
|
|
task generateManpageAsciiDoc(type: JavaExec) {
|
|
|
|
dependsOn(classes)
|
|
|
|
group = "Documentation"
|
|
|
|
description = "Generate AsciiDoc manpage"
|
|
|
|
if (hasAnnotationProcessor) {
|
|
|
|
classpath(sourceSets.main.compileClasspath, configurations.annotationProcessor, sourceSets.main.runtimeClasspath)
|
|
|
|
} else {
|
|
|
|
classpath(sourceSets.main.compileClasspath, sourceSets.main.runtimeClasspath)
|
|
|
|
}
|
|
|
|
main 'picocli.codegen.docgen.manpage.ManPageGenerator'
|
|
|
|
args mainClassName, "--outdir=${project.buildDir}/generated-picocli-docs", "-v" //, "--template-dir=src/docs/mantemplates"
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'org.asciidoctor.jvm.convert'
|
|
|
|
asciidoctor {
|
|
|
|
dependsOn(generateManpageAsciiDoc)
|
|
|
|
sourceDir = file("${project.buildDir}/generated-picocli-docs")
|
|
|
|
outputDir = file("${project.buildDir}/docs")
|
|
|
|
logDocuments = true
|
|
|
|
outputOptions {
|
|
|
|
backends = ['manpage', 'html5']
|
|
|
|
}
|
|
|
|
}
|
2022-05-02 20:57:59 +02:00
|
|
|
|
2023-09-20 18:23:23 +02:00
|
|
|
if (hasGraalVM) {
|
2022-05-02 20:57:59 +02:00
|
|
|
|
|
|
|
apply plugin: 'org.graalvm.buildtools.native'
|
|
|
|
|
|
|
|
graalvmNative {
|
|
|
|
binaries {
|
|
|
|
main {
|
|
|
|
imageName = applicationName
|
|
|
|
configurationFileDirectories.from(file('src/main/graal'))
|
|
|
|
buildArgs.add('--allow-incomplete-classpath')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|