mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 09:50:32 +01:00
137 lines
3.6 KiB
Groovy
137 lines
3.6 KiB
Groovy
import org.gradle.util.GradleVersion
|
|
|
|
plugins {
|
|
id 'java-library'
|
|
id 'com.google.protobuf'
|
|
id 'maven-publish'
|
|
}
|
|
|
|
version = '0.17-SNAPSHOT'
|
|
|
|
dependencies {
|
|
api 'org.bouncycastle:bcprov-jdk15to18:1.77'
|
|
api 'com.google.guava:guava:33.1.0-android'
|
|
api 'com.google.protobuf:protobuf-javalite:3.22.5'
|
|
implementation 'org.slf4j:slf4j-api:2.0.12'
|
|
implementation 'net.jcip:jcip-annotations:1.0'
|
|
testImplementation 'junit:junit:4.13.2'
|
|
testImplementation 'org.easymock:easymock:5.2.0'
|
|
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.16.0'
|
|
testImplementation 'org.slf4j:slf4j-jdk14:2.0.12'
|
|
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.15.2'
|
|
testImplementation 'org.hamcrest:hamcrest-library:2.2'
|
|
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
|
|
}
|
|
|
|
sourceCompatibility = 8
|
|
targetCompatibility = 8
|
|
compileJava.options.encoding = 'UTF-8'
|
|
compileTestJava.options.encoding = 'UTF-8'
|
|
javadoc.options.encoding = 'UTF-8'
|
|
// Uncomment the following line to see all the JavaDoc warnings
|
|
//javadoc.options.addStringOption('Xmaxwarns', '10000')
|
|
|
|
compileJava {
|
|
options.compilerArgs.addAll(['--release', '8'])
|
|
options.compilerArgs << '-Xlint:deprecation'
|
|
}
|
|
|
|
protobuf {
|
|
protoc {
|
|
artifact = 'com.google.protobuf:protoc:3.22.5'
|
|
}
|
|
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'
|
|
}
|
|
}
|
|
}
|
|
}
|