2021-09-08 21:46:47 +02:00
|
|
|
import org.gradle.util.GradleVersion
|
|
|
|
|
2019-04-04 22:14:51 +02:00
|
|
|
plugins {
|
2020-02-29 20:57:33 +01:00
|
|
|
id 'java-library'
|
2019-04-04 22:14:51 +02:00
|
|
|
id 'com.google.protobuf'
|
2021-04-26 15:36:28 +02:00
|
|
|
id 'maven-publish'
|
2019-04-04 22:14:51 +02:00
|
|
|
}
|
2018-03-06 21:13:17 +01:00
|
|
|
|
2024-08-23 16:46:19 +02:00
|
|
|
version = '0.18-SNAPSHOT'
|
2018-03-06 21:13:17 +01:00
|
|
|
|
|
|
|
dependencies {
|
2024-09-01 21:08:57 +02:00
|
|
|
api project(':bitcoinj-base')
|
2024-04-29 12:19:49 +02:00
|
|
|
api 'org.bouncycastle:bcprov-jdk15to18:1.78.1'
|
2024-08-21 13:12:59 +02:00
|
|
|
api 'com.google.guava:guava:33.3.0-android'
|
2024-08-03 09:37:46 +02:00
|
|
|
api 'com.google.protobuf:protobuf-javalite:4.27.3'
|
2024-08-03 09:40:20 +02:00
|
|
|
implementation 'org.slf4j:slf4j-api:2.0.13'
|
2018-03-06 21:13:17 +01:00
|
|
|
implementation 'net.jcip:jcip-annotations:1.0'
|
2024-09-01 19:19:44 +02:00
|
|
|
|
|
|
|
testImplementation project(':bitcoinj-test-support')
|
2021-12-14 11:45:39 +01:00
|
|
|
testImplementation 'junit:junit:4.13.2'
|
2024-08-03 09:42:48 +02:00
|
|
|
testImplementation 'org.easymock:easymock:5.4.0'
|
2024-08-03 09:45:17 +02:00
|
|
|
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
|
2024-08-03 09:40:20 +02:00
|
|
|
testImplementation 'org.slf4j:slf4j-jdk14:2.0.13'
|
2024-04-29 07:39:13 +02:00
|
|
|
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.16.1'
|
2024-08-03 09:48:39 +02:00
|
|
|
testImplementation 'org.hamcrest:hamcrest-library:3.0'
|
2022-08-18 22:00:12 +02:00
|
|
|
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
|
2018-03-06 21:13:17 +01:00
|
|
|
}
|
|
|
|
|
2023-09-16 21:05:55 +02:00
|
|
|
// Prevent newer Gradle from switching to JRE version of Guava
|
|
|
|
def gradleVersionTargetJVM = GradleVersion.version("7.0")
|
|
|
|
if (GradleVersion.current().compareTo(gradleVersionTargetJVM) > 0) {
|
|
|
|
dependencies.constraints {
|
|
|
|
implementation("com.google.guava:guava") {
|
|
|
|
attributes {
|
|
|
|
attribute(
|
|
|
|
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
|
|
|
|
objects.named(TargetJvmEnvironment, TargetJvmEnvironment.ANDROID))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-29 22:56:59 +02:00
|
|
|
tasks.withType(JavaCompile) {
|
2021-09-08 21:46:47 +02:00
|
|
|
options.compilerArgs.addAll(['--release', '8'])
|
2022-04-18 19:42:38 +02:00
|
|
|
options.compilerArgs << '-Xlint:deprecation'
|
2024-08-29 22:56:59 +02:00
|
|
|
options.encoding = 'UTF-8'
|
2021-09-08 21:46:47 +02:00
|
|
|
}
|
|
|
|
|
2024-08-29 22:56:59 +02:00
|
|
|
javadoc.options.encoding = 'UTF-8'
|
|
|
|
// Uncomment the following line to see all the JavaDoc warnings
|
|
|
|
//javadoc.options.addStringOption('Xmaxwarns', '10000')
|
|
|
|
|
2018-07-27 14:10:10 +02:00
|
|
|
protobuf {
|
2019-02-23 22:52:01 +01:00
|
|
|
protoc {
|
2024-08-03 09:37:46 +02:00
|
|
|
artifact = 'com.google.protobuf:protoc:4.27.3'
|
2019-02-23 22:52:01 +01:00
|
|
|
}
|
2019-10-08 20:47:25 +02:00
|
|
|
generateProtoTasks {
|
|
|
|
all().each { task ->
|
|
|
|
task.builtins {
|
|
|
|
java {
|
|
|
|
option "lite"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-07-27 14:10:10 +02:00
|
|
|
}
|
|
|
|
|
2021-12-28 20:11:33 +01:00
|
|
|
tasks.withType(Test) {
|
2019-03-15 12:09:05 +01:00
|
|
|
exclude 'org/bitcoinj/net/discovery/DnsDiscoveryTest*'
|
2019-02-15 15:54:28 +01:00
|
|
|
testLogging {
|
|
|
|
events "failed"
|
|
|
|
exceptionFormat "full"
|
|
|
|
}
|
2018-03-06 21:13:17 +01:00
|
|
|
}
|
|
|
|
|
2021-12-28 20:11:33 +01:00
|
|
|
// Test with default Java toolchain
|
|
|
|
test {
|
|
|
|
doFirst {
|
|
|
|
logger.lifecycle("Testing with default toolchain")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def gradleVersionToolchains = GradleVersion.version("6.7")
|
|
|
|
|
|
|
|
if (GradleVersion.current().compareTo(gradleVersionToolchains) > 0) {
|
|
|
|
// If the Gradle Java Toolchains feature is available, run tests on older JDKs
|
|
|
|
System.err.println "Adding 'testOnJdk8' task, because ${GradleVersion.current()}"
|
|
|
|
|
|
|
|
task('testOnJdk8', type: Test) {
|
|
|
|
doFirst {
|
|
|
|
logger.lifecycle("Testing with JDK ${javaLauncher.get().metadata.javaRuntimeVersion}")
|
|
|
|
}
|
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
|
|
|
languageVersion = JavaLanguageVersion.of(8)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Activate if `testJdk8` is `true` in `gradle.properties` or `-PtestJdk8=true` is on command-line
|
|
|
|
if (Boolean.valueOf(findProperty('testJdk8'))) {
|
|
|
|
check.dependsOn testOnJdk8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-05 00:07:33 +02:00
|
|
|
ext.moduleName = 'org.bitcoinj.core'
|
|
|
|
|
|
|
|
jar {
|
|
|
|
inputs.property("moduleName", moduleName)
|
|
|
|
manifest {
|
|
|
|
attributes 'Automatic-Module-Name': moduleName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-22 20:25:37 +02:00
|
|
|
def minGradleArchiveClassifierVersion = GradleVersion.version("5.0")
|
|
|
|
|
2018-03-06 21:13:17 +01:00
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
2023-04-22 20:25:37 +02:00
|
|
|
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
|
|
|
archiveClassifier.set('javadoc')
|
|
|
|
} else {
|
|
|
|
classifier = 'javadoc'
|
|
|
|
}
|
2018-03-06 21:13:17 +01:00
|
|
|
from javadoc.destinationDir
|
|
|
|
}
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
2023-04-22 20:25:37 +02:00
|
|
|
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
|
|
|
archiveClassifier.set('sources')
|
|
|
|
} else {
|
|
|
|
classifier = 'sources'
|
|
|
|
}
|
2018-03-06 21:13:17 +01:00
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives sourcesJar
|
|
|
|
archives javadocJar
|
|
|
|
}
|
2021-10-06 00:20:33 +02:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
artifactId = 'bitcoinj-core'
|
|
|
|
from components.java
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
|
|
|
|
pom {
|
|
|
|
description = 'A Java Bitcoin library'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|