bitcoinj/core/build.gradle
Andreas Schildbach b528fb5180 build.gradle: update SLF4J to 2.0.7
Starting with SLF4J 2.0.0, we can use the fluent logger API.
2023-03-27 15:25:02 +02:00

129 lines
3.4 KiB
Groovy

import org.gradle.util.GradleVersion
plugins {
id 'java-library'
id 'com.google.protobuf'
id 'maven-publish'
id 'eclipse'
}
version = '0.17-SNAPSHOT'
dependencies {
api 'org.bouncycastle:bcprov-jdk15to18:1.72'
api 'com.google.guava:guava:31.1-android'
api 'com.google.protobuf:protobuf-javalite:3.21.12'
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation 'net.jcip:jcip-annotations:1.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.easymock:easymock:5.1.0'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0'
testImplementation 'org.slf4j:slf4j-jdk14:2.0.7'
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.11'
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.21.12'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
}
}
}
}
generatedFilesBaseDir = new File(projectDir, '/src') // workaround for '$projectDir/src'
}
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
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
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'
}
}
}
}