mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 01:40:26 +01:00
151 lines
4.2 KiB
Groovy
151 lines
4.2 KiB
Groovy
import org.gradle.util.GradleVersion
|
|
|
|
plugins {
|
|
id 'java-library'
|
|
id 'com.google.protobuf'
|
|
id 'maven-publish'
|
|
}
|
|
|
|
version = '0.18-SNAPSHOT'
|
|
|
|
dependencies {
|
|
api project(':bitcoinj-base')
|
|
api 'org.bouncycastle:bcprov-jdk15to18:1.78.1'
|
|
api 'com.google.guava:guava:33.3.0-android'
|
|
api 'com.google.protobuf:protobuf-javalite:4.27.3'
|
|
implementation 'org.slf4j:slf4j-api:2.0.13'
|
|
implementation 'net.jcip:jcip-annotations:1.0'
|
|
|
|
testImplementation project(':bitcoinj-test-support')
|
|
testImplementation 'junit:junit:4.13.2'
|
|
testImplementation 'org.easymock:easymock:5.4.0'
|
|
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
|
|
testImplementation 'org.slf4j:slf4j-jdk14:2.0.13'
|
|
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.16.1'
|
|
testImplementation 'org.hamcrest:hamcrest-library:3.0'
|
|
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
|
|
}
|
|
|
|
// 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))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs.addAll(['--release', '8'])
|
|
options.compilerArgs << '-Xlint:deprecation'
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
javadoc.options.encoding = 'UTF-8'
|
|
// Uncomment the following line to see all the JavaDoc warnings
|
|
//javadoc.options.addStringOption('Xmaxwarns', '10000')
|
|
|
|
protobuf {
|
|
protoc {
|
|
artifact = 'com.google.protobuf:protoc:4.27.3'
|
|
}
|
|
generateProtoTasks {
|
|
all().each { task ->
|
|
task.builtins {
|
|
java {
|
|
option "lite"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(Test) {
|
|
exclude 'org/bitcoinj/net/discovery/DnsDiscoveryTest*'
|
|
testLogging {
|
|
events "failed"
|
|
exceptionFormat "full"
|
|
}
|
|
}
|
|
|
|
// 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
|
|
}
|
|
}
|
|
|
|
ext.moduleName = 'org.bitcoinj.core'
|
|
|
|
jar {
|
|
inputs.property("moduleName", moduleName)
|
|
manifest {
|
|
attributes 'Automatic-Module-Name': moduleName
|
|
}
|
|
}
|
|
|
|
def minGradleArchiveClassifierVersion = GradleVersion.version("5.0")
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
|
archiveClassifier.set('javadoc')
|
|
} else {
|
|
classifier = 'javadoc'
|
|
}
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
if (GradleVersion.current().compareTo(minGradleArchiveClassifierVersion) > 0) {
|
|
archiveClassifier.set('sources')
|
|
} else {
|
|
classifier = 'sources'
|
|
}
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifactId = 'bitcoinj-core'
|
|
from components.java
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
|
|
pom {
|
|
description = 'A Java Bitcoin library'
|
|
}
|
|
}
|
|
}
|
|
}
|