Skip to content

Commit 863a8ef

Browse files
authored
Java: Make jedis-compatibility a pure-Java JAR with no-classifier support (#5649)
Java: Make jedis-compatibility a pure-Java JAR with no-classifier support Make valkey-glide-jedis-compatibility a pure-Java JAR by removing native library bundling, and publish a no-classifier variant so users no longer need to specify a platform classifier. Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
1 parent b6b2cd6 commit 863a8ef

3 files changed

Lines changed: 40 additions & 25 deletions

File tree

.github/workflows/java-cd.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,42 @@ jobs:
331331
cd -
332332
cp $src_folder/bundle.jar bundle-uber-jar.jar
333333
334+
- name: Build jedis-compatibility (no classifier, no natives)
335+
working-directory: java
336+
shell: bash
337+
env:
338+
GLIDE_RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
339+
JEDIS_NO_CLASSIFIER_BUILD: "true"
340+
run: |
341+
./gradlew --build-cache :jedis-compatibility:publishToMavenLocal \
342+
-x buildRust \
343+
-Psigning.secretKeyRingFile=secring.gpg \
344+
-Psigning.password="${{ secrets.GPG_PASSWORD }}" \
345+
-Psigning.keyId=${{ secrets.GPG_KEY_ID }}
346+
347+
- name: Bundle jedis-compatibility no-classifier JAR
348+
working-directory: java
349+
shell: bash
350+
run: |
351+
src_folder=~/.m2/repository/io/valkey/valkey-glide-jedis-compatibility/${{ env.RELEASE_VERSION }}
352+
cd $src_folder
353+
jar -cvf jedis-bundle.jar *
354+
ls -ltr
355+
cd -
356+
cp $src_folder/jedis-bundle.jar jedis-bundle-no-classifier.jar
357+
334358
- name: Upload uber JAR artifact
335359
uses: actions/upload-artifact@v4
336360
with:
337361
name: java-uber-jar
338362
path: java/bundle-uber-jar.jar
339363

364+
- name: Upload jedis no-classifier artifact
365+
uses: actions/upload-artifact@v4
366+
with:
367+
name: jedis-no-classifier
368+
path: java/jedis-bundle-no-classifier.jar
369+
340370
publish-to-maven-central-deployment:
341371
if: ${{ inputs.maven_publish == true || github.event_name == 'push' }}
342372
needs:

java/integTest/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ dependencies {
3434
// Use published GLIDE artifact
3535
implementation group: 'io.valkey', name: 'valkey-glide', version: project.ext.defaultReleaseVersion, classifier: classifier
3636

37-
// Use published jedis-compatibility artifact
38-
testImplementation group: 'io.valkey', name: 'valkey-glide-jedis-compatibility', version: project.ext.defaultReleaseVersion, classifier: osdetector.classifier
37+
// Use project dependency for jedis-compatibility (resolves directly, no Maven Local needed)
38+
testImplementation project(':jedis-compatibility')
3939

4040
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.20.0'
4141
implementation 'com.google.code.gson:gson:2.13.2'
@@ -279,10 +279,10 @@ gradle.buildFinished {
279279
println "Failed to clean up cluster folders: ${e.message}"
280280
}
281281
}
282-
compileTestJava.dependsOn ':client:publishToMavenLocal', ':jedis-compatibility:publishToMavenLocal'
282+
compileTestJava.dependsOn ':client:publishToMavenLocal'
283283

284284
tasks.withType(Test) {
285-
dependsOn ':client:publishToMavenLocal', ':jedis-compatibility:publishToMavenLocal'
285+
dependsOn ':client:publishToMavenLocal'
286286
useJUnitPlatform()
287287
if (!project.gradle.startParameter.taskNames.contains(':integTest:modulesTest')) {
288288
dependsOn 'beforeTests'

java/jedis-compatibility/build.gradle

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,7 @@ javadoc {
6060
failOnError = false // Disable javadoc errors for compatibility layer
6161
}
6262

63-
tasks.register('copyNativeLib', Copy) {
64-
def target
65-
if (project.hasProperty('target')) {
66-
target = project.target
67-
from "${projectDir}/../target/${target}/release/"
68-
} else if (osdetector.os == 'linux' && osdetector.release.id != 'alpine') {
69-
from "${projectDir}/../target/${arch}-unknown-linux-gnu/release/"
70-
} else if (osdetector.os == 'linux' && osdetector.release.id == 'alpine') {
71-
from "${projectDir}/../target/${arch}-unknown-linux-musl/release/"
72-
} else {
73-
from "${projectDir}/../target/release/"
74-
}
75-
include "*.dylib", "*.so", "*.dll"
76-
into sourceSets.main.output.resourcesDir
77-
}
78-
79-
jar.dependsOn('copyNativeLib')
80-
javadoc.dependsOn('copyNativeLib')
81-
compileTestJava.dependsOn('copyNativeLib')
8263
delombok.dependsOn('compileJava')
83-
copyNativeLib.dependsOn(':client:buildRust')
8464
compileJava.dependsOn(':client:jar')
8565

8666
tasks.withType(Test) {
@@ -99,7 +79,11 @@ tasks.withType(Test) {
9979
}
10080

10181
jar {
102-
if (project.hasProperty('target') && project.target.contains("musl")) {
82+
def isNoClassifierBuild = System.getenv("JEDIS_NO_CLASSIFIER_BUILD") == "true"
83+
84+
if (isNoClassifierBuild) {
85+
archiveClassifier = ''
86+
} else if (project.hasProperty('target') && project.target.contains("musl")) {
10387
archiveClassifier = "linux_musl_${arch}"
10488
} else {
10589
archiveClassifier = osdetector.classifier
@@ -129,6 +113,7 @@ publishing {
129113
artifactId = 'valkey-glide-jedis-compatibility'
130114
version = System.getenv("GLIDE_RELEASE_VERSION") ?: project.ext.defaultReleaseVersion
131115
pom {
116+
packaging = 'jar'
132117
name = 'valkey-glide-jedis-compatibility'
133118
description = 'Jedis compatibility layer for Valkey GLIDE'
134119
url = 'https://github.com/valkey-io/valkey-glide.git'

0 commit comments

Comments
 (0)