bitcoinj/base/build.gradle
2024-09-02 03:41:42 +02:00

108 lines
2.9 KiB
Groovy

import org.gradle.util.GradleVersion
plugins {
id 'java-library'
id 'maven-publish'
}
version = '0.18-SNAPSHOT'
dependencies {
implementation 'org.slf4j:slf4j-api:2.0.13'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
testImplementation project(':bitcoinj-test-support')
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.easymock:easymock:5.4.0'
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'
}
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')
// 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.base'
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-base'
from components.java
artifact sourcesJar
artifact javadocJar
pom {
description = 'A Java Bitcoin library'
}
}
}
}