Skip to content

Commit d00260e

Browse files
committed
Maven arch-specific and nolib artifacts
This change makes the following arch-specific artifacts to be deployed to Maven Central (in addition to the main `duckdb_jdbc-x.x.x.x.jar` that remains unchanged), classifiers: - `linux_amd64` - `linux_amd64_musl` - `linux_arm64` - `linux_arm64_musl` - `macos_universal` - `windows_amd64` - `windows_arm64` Each arch-specific artifact contains a native library only for this particular platform and can be specified in Maven dependencies with the following syntax: ```xml <dependency> <groupId>org.duckdb</groupId> <artifactId>duckdb_jdbc</artifactId> <version>1.x.x.x</version> <classifier>linux_amd64_musl</classifier> </dependency> ``` Note that Windows and Linux-musl AArch64 artifacts are renamed from `aarch64` to `arm64` to align with wider DuckDB arch naming. Additionally an artifact without any native library is deployed with a `nolib` classifier. It is intended to be used with an externally provided native library, see #421 for details.
1 parent b358475 commit d00260e

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: DuckDB JDBC Driver
44
Bundle-SymbolicName: org.duckdb.duckdb_jdbc
5-
Bundle-Version: 1.4.0.0
5+
Bundle-Version: 1.5.0.0
66
Bundle-Vendor: DuckDB Labs
77
Bundle-Description: A JDBC-compliant driver for the DuckDB data management system
88
Bundle-License: https://raw.githubusercontent.com/duckdb/duckdb/main/LICENSE

scripts/jdbc_maven_deploy.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,32 @@ def exec(cmd):
5959
jdbc_root_path = sys.argv[3]
6060

6161
combine_builds = ['linux-amd64', 'osx-universal', 'windows-amd64', 'linux-aarch64']
62-
arch_specific_builds = ['linux-amd64-musl', 'linux-aarch64-musl', 'windows-aarch64']
63-
arch_specific_classifiers = ['linux_amd64_musl', 'linux_aarch64_musl', 'windows_aarch64']
62+
arch_specific_builds = [
63+
'linux-amd64',
64+
'linux-aarch64',
65+
'linux-amd64-musl',
66+
'linux-aarch64-musl',
67+
'osx-universal',
68+
'windows-amd64',
69+
'windows-aarch64',
70+
]
71+
arch_specific_classifiers = [
72+
'linux_amd64',
73+
'linux_arm64',
74+
'linux_amd64_musl',
75+
'linux_arm64_musl',
76+
'macos_universal',
77+
'windows_amd64',
78+
'windows_arm64',
79+
]
6480

6581
staging_dir = tempfile.mkdtemp()
6682

6783
binary_jar = '%s/duckdb_jdbc-%s.jar' % (staging_dir, release_version)
6884
pom = '%s/duckdb_jdbc-%s.pom' % (staging_dir, release_version)
6985
sources_jar = '%s/duckdb_jdbc-%s-sources.jar' % (staging_dir, release_version)
7086
javadoc_jar = '%s/duckdb_jdbc-%s-javadoc.jar' % (staging_dir, release_version)
87+
nolib_jar = '%s/duckdb_jdbc-%s-nolib.jar' % (staging_dir, release_version)
7188

7289
arch_specific_jars = []
7390
for i in range(len(arch_specific_builds)):
@@ -123,9 +140,20 @@ def exec(cmd):
123140
pom_path = pathlib.Path(pom)
124141
pom_path.write_text(pom_template.replace("${VERSION}", release_version))
125142

126-
# fatten up jar to add other binaries, start with first one
127-
shutil.copyfile(os.path.join(jdbc_artifact_dir, "java-" + combine_builds[0], "duckdb_jdbc.jar"), binary_jar)
128-
for build in combine_builds[1:]:
143+
# prepare 'empty' jar
144+
linux_amd64_src_jar = os.path.join(jdbc_artifact_dir, "java-" + combine_builds[0], "duckdb_jdbc.jar")
145+
with zipfile.ZipFile(linux_amd64_src_jar) as linux_amd64:
146+
with zipfile.ZipFile(binary_jar, mode='w') as nolib:
147+
for item in linux_amd64.infolist():
148+
if item.filename != "libduckdb_java.so_linux_amd64":
149+
buffer = linux_amd64.read(item.filename)
150+
nolib.writestr(item, buffer)
151+
152+
# copy 'empty' jar to '-nolib' classifier
153+
shutil.copyfile(binary_jar, nolib_jar)
154+
155+
# fatten up 'empty' jar adding native libs
156+
for build in combine_builds:
129157
old_jar = zipfile.ZipFile(os.path.join(jdbc_artifact_dir, "java-" + build, "duckdb_jdbc.jar"), 'r')
130158
for zip_entry in old_jar.namelist():
131159
if zip_entry.startswith('libduckdb_java.so'):
@@ -149,6 +177,7 @@ def exec(cmd):
149177
binary_jar,
150178
sources_jar,
151179
javadoc_jar,
180+
nolib_jar,
152181
pom
153182
]
154183
for jar in arch_specific_jars:

0 commit comments

Comments
 (0)