import org.gradle.util.GradleVersion plugins { id 'java' id 'application' id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false id 'org.graalvm.buildtools.native' version '0.10.2' apply false } def annotationProcessorMinVersion = GradleVersion.version("4.6") boolean hasAnnotationProcessor = GradleVersion.current() >= annotationProcessorMinVersion def junit5MinVersion = GradleVersion.version("4.6") boolean hasJunit5 = GradleVersion.current() >= junit5MinVersion def graalVMMinVersion = GradleVersion.version("7.4") // Toolchains with selection by vendor boolean hasGraalVM = GradleVersion.current() >= graalVMMinVersion dependencies { implementation project(':bitcoinj-core') implementation 'info.picocli:picocli:4.7.6' implementation 'org.slf4j:slf4j-jdk14:2.0.13' if (hasAnnotationProcessor) { annotationProcessor 'info.picocli:picocli-codegen:4.7.6' } else { compileOnly 'info.picocli:picocli-codegen:4.7.6' } testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3" testImplementation 'org.slf4j:slf4j-jdk14:2.0.13' } tasks.withType(JavaCompile) { options.compilerArgs.addAll(['--release', '17']) options.compilerArgs << '-Xlint:deprecation' options.encoding = 'UTF-8' } javadoc.options.encoding = 'UTF-8' mainClassName = "org.bitcoinj.wallettool.WalletTool" applicationName = "wallet-tool" // wallettool is using JUnit 5 for testing, if it's not available no tests will be run if (hasJunit5) { test { useJUnitPlatform() } } 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'] } } if (hasGraalVM) { apply plugin: 'org.graalvm.buildtools.native' graalvmNative { binaries { main { imageName = applicationName configurationFileDirectories.from(file('src/main/graal')) buildArgs.add('--allow-incomplete-classpath') } } } }