Skip to content

Commit 16190df

Browse files
authored
fix(plugins): exclude transitive leveldbjni-all from :crypto (tronprotocol#6738)
1 parent d71e1e4 commit 16190df

2 files changed

Lines changed: 58 additions & 3 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ jobs:
5454
- name: Build
5555
run: ./gradlew clean build --no-daemon
5656

57+
- name: Toolkit jar smoke test
58+
run: |
59+
set -e
60+
JAR=plugins/build/libs/Toolkit.jar
61+
java -jar "$JAR" help
62+
java -jar "$JAR" db --help
63+
java -jar "$JAR" db archive -h
64+
java -jar "$JAR" keystore --help
65+
5766
build-ubuntu:
5867
name: Build ubuntu24 (JDK 17 / aarch64)
5968
if: ${{ github.event_name == 'pull_request' || inputs.job == 'all' || inputs.job == 'ubuntu' }}
@@ -84,6 +93,15 @@ jobs:
8493
- name: Build
8594
run: ./gradlew clean build --no-daemon
8695

96+
- name: Toolkit jar smoke test
97+
run: |
98+
set -e
99+
JAR=plugins/build/libs/Toolkit.jar
100+
java -jar "$JAR" help
101+
java -jar "$JAR" db --help
102+
java -jar "$JAR" db archive -h
103+
java -jar "$JAR" keystore --help
104+
87105
docker-build-rockylinux:
88106
name: Build rockylinux (JDK 8 / x86_64)
89107
if: ${{ github.event_name == 'pull_request' || inputs.job == 'all' || inputs.job == 'rockylinux' }}
@@ -127,6 +145,15 @@ jobs:
127145
- name: Build
128146
run: ./gradlew clean build --no-daemon
129147

148+
- name: Toolkit jar smoke test
149+
run: |
150+
set -e
151+
JAR=plugins/build/libs/Toolkit.jar
152+
java -jar "$JAR" help
153+
java -jar "$JAR" db --help
154+
java -jar "$JAR" db archive -h
155+
java -jar "$JAR" keystore --help
156+
130157
- name: Test with RocksDB engine
131158
run: ./gradlew :framework:testWithRocksDb --no-daemon
132159

@@ -172,6 +199,15 @@ jobs:
172199
- name: Build
173200
run: ./gradlew clean build --no-daemon --no-build-cache
174201

202+
- name: Toolkit jar smoke test
203+
run: |
204+
set -e
205+
JAR=plugins/build/libs/Toolkit.jar
206+
java -jar "$JAR" help
207+
java -jar "$JAR" db --help
208+
java -jar "$JAR" db archive -h
209+
java -jar "$JAR" keystore --help
210+
175211
- name: Test with RocksDB engine
176212
run: ./gradlew :framework:testWithRocksDb --no-daemon --no-build-cache
177213

plugins/build.gradle

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ dependencies {
3939
exclude group: 'io.prometheus'
4040
exclude group: 'org.aspectj'
4141
exclude group: 'org.apache.httpcomponents'
42+
// x86 declares io.github.tronprotocol:leveldbjni-all:1.18.2 below;
43+
// :crypto -> :common -> :platform also transitively pulls
44+
// org.fusesource.leveldbjni:leveldbjni-all:1.8. Both jars carry
45+
// org/iq80/leveldb/Options.class and the fat jar's last-write-wins
46+
// merge can leave the 1.8 copy, which lacks Options.maxBatchSize(int)
47+
// and breaks `db archive` at runtime. Drop the 1.8 transitive on x86
48+
// only; ARM64 has a single copy via :platform direct and no conflict.
49+
if (!rootProject.archInfo.isArm64) {
50+
exclude group: 'org.fusesource.leveldbjni', module: 'leveldbjni-all'
51+
}
4252
}
4353
implementation group: 'info.picocli', name: 'picocli', version: '4.6.3'
4454
implementation group: 'com.typesafe', name: 'config', version: '1.3.2'
@@ -49,9 +59,12 @@ dependencies {
4959
implementation project(":platform")
5060
} else {
5161
implementation project(":platform"), {
62+
// Only leveldbjni-all is excluded; the io.github.tronprotocol
63+
// 1.18.2 fork below is the version we want on x86. zksnark-java-sdk
64+
// and commons-io are intentionally kept (the plugins test runtime
65+
// needs both via :crypto -> :common -> :platform and the duplicate
66+
// resolution dedups to one copy).
5267
exclude(group: 'org.fusesource.leveldbjni', module: 'leveldbjni-all')
53-
exclude(group: 'io.github.tronprotocol', module: 'zksnark-java-sdk')
54-
exclude(group: 'commons-io', module: 'commons-io')
5568
}
5669
implementation 'io.github.tronprotocol:leveldbjni-all:1.18.2'
5770
implementation 'io.github.tronprotocol:leveldb:1.18.2'
@@ -130,7 +143,13 @@ def binaryRelease(taskName, jarName, mainClass) {
130143
from(sourceSets.main.output) {
131144
include "/**"
132145
}
133-
dependsOn (project(':protocol').jar, project(':platform').jar) // explicit_dependency
146+
// Fat jar zips up runtimeClasspath, which includes the jar outputs of
147+
// every project dependency. Declare them all explicitly so Gradle does
148+
// not warn about implicit_dependency and disable execution optimizations
149+
// (and so partial / parallel builds cannot run binaryRelease before the
150+
// dependency jars exist).
151+
dependsOn (project(':protocol').jar, project(':platform').jar,
152+
project(':crypto').jar, project(':common').jar) // explicit_dependency
134153
from {
135154
configurations.runtimeClasspath.collect { // https://docs.gradle.org/current/userguide/upgrading_version_6.html#changes_6.3
136155
it.isDirectory() ? it : zipTree(it)

0 commit comments

Comments
 (0)