mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 01:40:26 +01:00
base: add new module for foundational types
This commit is contained in:
parent
57846ad363
commit
786599354f
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
@ -38,6 +38,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: bitcoinj-core-test-results-jdk${{ matrix.java }}-${{ matrix.os }}-${{ matrix.gradle }}
|
name: bitcoinj-core-test-results-jdk${{ matrix.java }}-${{ matrix.os }}-${{ matrix.gradle }}
|
||||||
path: |
|
path: |
|
||||||
|
base/build/reports/tests/test/
|
||||||
|
base/build/test-results/test/
|
||||||
core/build/reports/tests/test/
|
core/build/reports/tests/test/
|
||||||
core/build/test-results/test/
|
core/build/test-results/test/
|
||||||
wallettool/build/reports/tests/test/
|
wallettool/build/reports/tests/test/
|
||||||
|
@ -21,7 +21,7 @@ bookworm-jdk17:
|
|||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get -y install openjdk-17-jdk-headless gradle
|
- apt-get -y install openjdk-17-jdk-headless gradle
|
||||||
script:
|
script:
|
||||||
- gradle --settings-file settings-debian.gradle build :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist --init-script build-scan-agree.gradle --scan --stacktrace
|
- gradle --settings-file settings-debian.gradle build :bitcoinj-base:publishToMavenLocal :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist --init-script build-scan-agree.gradle --scan --stacktrace
|
||||||
after_script:
|
after_script:
|
||||||
- gradle --version
|
- gradle --version
|
||||||
- sha256sum core/build/libs/*.jar wallettool/build/install/wallet-tool/bin/* wallettool/build/install/wallet-tool/lib/*.jar
|
- sha256sum core/build/libs/*.jar wallettool/build/install/wallet-tool/bin/* wallettool/build/install/wallet-tool/lib/*.jar
|
||||||
|
@ -10,11 +10,11 @@ The bitcoinj library is a Java implementation of the Bitcoin protocol, which all
|
|||||||
|
|
||||||
### Technologies
|
### Technologies
|
||||||
|
|
||||||
* Java 8+ (needs Java 8 API or Android 8.0 API, compiles to Java 8 bytecode) for the `core` module
|
* Java 8+ (needs Java 8 API or Android 8.0 API, compiles to Java 8 bytecode) for `base` and `core` module
|
||||||
* Java 17+ for `tools`, `wallettool`, `examples` and the JavaFX-based `wallettemplate`
|
* Java 17+ for `tools`, `wallettool`, `examples` and the JavaFX-based `wallettemplate`
|
||||||
* https://gradle.org/[Gradle]
|
* https://gradle.org/[Gradle]
|
||||||
** Gradle 7.3+ for building the whole project or
|
** Gradle 7.3+ for building the whole project or
|
||||||
** Debian Gradle 4.4 for just the `core`, `tools`, `wallettool` and `examples` modules (see "reference build" below)
|
** Debian Gradle 4.4 for just the `base`, `core`, `tools`, `wallettool` and `examples` modules (see "reference build" below)
|
||||||
* https://github.com/google/protobuf[Google Protocol Buffers] - for use with serialization and hardware communications
|
* https://github.com/google/protobuf[Google Protocol Buffers] - for use with serialization and hardware communications
|
||||||
|
|
||||||
### Getting started
|
### Getting started
|
||||||
|
107
base/build.gradle
Normal file
107
base/build.gradle
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -40,13 +40,17 @@ RUN /usr/bin/gradle --project-dir project/ \
|
|||||||
--no-build-cache --no-daemon --no-parallel \
|
--no-build-cache --no-daemon --no-parallel \
|
||||||
--settings-file=settings-debian.gradle \
|
--settings-file=settings-debian.gradle \
|
||||||
-Dmaven.repo.local=repo \
|
-Dmaven.repo.local=repo \
|
||||||
clean ${ADDITIONAL_GRADLE_TASK} :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist
|
clean ${ADDITIONAL_GRADLE_TASK} :bitcoinj-base:publishToMavenLocal :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist
|
||||||
|
|
||||||
# stage: export build output
|
# stage: export build output
|
||||||
FROM scratch AS export-stage
|
FROM scratch AS export-stage
|
||||||
COPY --from=build-stage \
|
COPY --from=build-stage \
|
||||||
/home/builder/repo/org/bitcoinj/*/*/*.jar \
|
/home/builder/repo/org/bitcoinj/bitcoinj-base/*/*.jar \
|
||||||
/home/builder/repo/org/bitcoinj/*/*/*.pom \
|
/home/builder/repo/org/bitcoinj/bitcoinj-base/*/*.pom \
|
||||||
|
/base/
|
||||||
|
COPY --from=build-stage \
|
||||||
|
/home/builder/repo/org/bitcoinj/bitcoinj-core/*/*.jar \
|
||||||
|
/home/builder/repo/org/bitcoinj/bitcoinj-core/*/*.pom \
|
||||||
/core/
|
/core/
|
||||||
COPY --from=build-stage \
|
COPY --from=build-stage \
|
||||||
/home/builder/project/wallettool/build/install/wallet-tool/ \
|
/home/builder/project/wallettool/build/install/wallet-tool/ \
|
||||||
|
@ -9,6 +9,7 @@ plugins {
|
|||||||
version = '0.18-SNAPSHOT'
|
version = '0.18-SNAPSHOT'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api project(':bitcoinj-base')
|
||||||
api 'org.bouncycastle:bcprov-jdk15to18:1.78.1'
|
api 'org.bouncycastle:bcprov-jdk15to18:1.78.1'
|
||||||
api 'com.google.guava:guava:33.3.0-android'
|
api 'com.google.guava:guava:33.3.0-android'
|
||||||
api 'com.google.protobuf:protobuf-javalite:4.27.3'
|
api 'com.google.protobuf:protobuf-javalite:4.27.3'
|
||||||
|
@ -22,6 +22,9 @@ rootProject.name = 'bitcoinj-parent'
|
|||||||
include 'test-support'
|
include 'test-support'
|
||||||
project(':test-support').name = 'bitcoinj-test-support'
|
project(':test-support').name = 'bitcoinj-test-support'
|
||||||
|
|
||||||
|
include 'base'
|
||||||
|
project(':base').name = 'bitcoinj-base'
|
||||||
|
|
||||||
include 'core'
|
include 'core'
|
||||||
project(':core').name = 'bitcoinj-core'
|
project(':core').name = 'bitcoinj-core'
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@ if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
|
|||||||
include 'test-support'
|
include 'test-support'
|
||||||
project(':test-support').name = 'bitcoinj-test-support'
|
project(':test-support').name = 'bitcoinj-test-support'
|
||||||
|
|
||||||
|
include 'base'
|
||||||
|
project(':base').name = 'bitcoinj-base'
|
||||||
|
|
||||||
include 'core'
|
include 'core'
|
||||||
project(':core').name = 'bitcoinj-core'
|
project(':core').name = 'bitcoinj-core'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user