Skip to content

Commit bfca828

Browse files
committed
fix(client-cpp): flatten package zip layout and add SHA512 checksums
Unpack directly to include/ and lib/ at zip root, generate .sha512 via checksum-maven-plugin, and upload checksums from the package workflow.
1 parent 275334f commit bfca828

8 files changed

Lines changed: 96 additions & 29 deletions

File tree

.github/workflows/client-cpp-package.yml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,19 @@ jobs:
199199
fi
200200
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
201201
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
202+
sha512="${zips[0]}.sha512"
203+
if [ ! -f "${sha512}" ]; then
204+
echo "Expected checksum file: ${sha512}"
205+
exit 1
206+
fi
207+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
202208
- name: Upload zip artifact
203209
uses: actions/upload-artifact@v6
204210
with:
205211
name: ${{ steps.pkg.outputs.name }}
206-
path: ${{ steps.pkg.outputs.path }}
212+
path: |
213+
${{ steps.pkg.outputs.path }}
214+
${{ steps.pkg.outputs.sha512_path }}
207215
if-no-files-found: error
208216

209217
package-linux-aarch64-glibc217:
@@ -249,11 +257,19 @@ jobs:
249257
fi
250258
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
251259
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
260+
sha512="${zips[0]}.sha512"
261+
if [ ! -f "${sha512}" ]; then
262+
echo "Expected checksum file: ${sha512}"
263+
exit 1
264+
fi
265+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
252266
- name: Upload zip artifact
253267
uses: actions/upload-artifact@v6
254268
with:
255269
name: ${{ steps.pkg.outputs.name }}
256-
path: ${{ steps.pkg.outputs.path }}
270+
path: |
271+
${{ steps.pkg.outputs.path }}
272+
${{ steps.pkg.outputs.sha512_path }}
257273
if-no-files-found: error
258274

259275
package-linux-glibc224:
@@ -299,11 +315,19 @@ jobs:
299315
fi
300316
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
301317
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
318+
sha512="${zips[0]}.sha512"
319+
if [ ! -f "${sha512}" ]; then
320+
echo "Expected checksum file: ${sha512}"
321+
exit 1
322+
fi
323+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
302324
- name: Upload zip artifact
303325
uses: actions/upload-artifact@v6
304326
with:
305327
name: ${{ steps.pkg.outputs.name }}
306-
path: ${{ steps.pkg.outputs.path }}
328+
path: |
329+
${{ steps.pkg.outputs.path }}
330+
${{ steps.pkg.outputs.sha512_path }}
307331
if-no-files-found: error
308332

309333
package-linux-aarch64-glibc224:
@@ -349,11 +373,19 @@ jobs:
349373
fi
350374
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
351375
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
376+
sha512="${zips[0]}.sha512"
377+
if [ ! -f "${sha512}" ]; then
378+
echo "Expected checksum file: ${sha512}"
379+
exit 1
380+
fi
381+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
352382
- name: Upload zip artifact
353383
uses: actions/upload-artifact@v6
354384
with:
355385
name: ${{ steps.pkg.outputs.name }}
356-
path: ${{ steps.pkg.outputs.path }}
386+
path: |
387+
${{ steps.pkg.outputs.path }}
388+
${{ steps.pkg.outputs.sha512_path }}
357389
if-no-files-found: error
358390

359391
package-macos:
@@ -414,11 +446,19 @@ jobs:
414446
fi
415447
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
416448
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
449+
sha512="${zips[0]}.sha512"
450+
if [ ! -f "${sha512}" ]; then
451+
echo "Expected checksum file: ${sha512}"
452+
exit 1
453+
fi
454+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
417455
- name: Upload zip artifact
418456
uses: actions/upload-artifact@v6
419457
with:
420458
name: ${{ steps.pkg.outputs.name }}
421-
path: ${{ steps.pkg.outputs.path }}
459+
path: |
460+
${{ steps.pkg.outputs.path }}
461+
${{ steps.pkg.outputs.sha512_path }}
422462
if-no-files-found: error
423463

424464
package-windows:
@@ -517,9 +557,17 @@ jobs:
517557
fi
518558
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
519559
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
560+
sha512="${zips[0]}.sha512"
561+
if [ ! -f "${sha512}" ]; then
562+
echo "Expected checksum file: ${sha512}"
563+
exit 1
564+
fi
565+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
520566
- name: Upload zip artifact
521567
uses: actions/upload-artifact@v6
522568
with:
523569
name: ${{ steps.pkg.outputs.name }}
524-
path: ${{ steps.pkg.outputs.path }}
570+
path: |
571+
${{ steps.pkg.outputs.path }}
572+
${{ steps.pkg.outputs.sha512_path }}
525573
if-no-files-found: error

distribution/src/assembly/client-cpp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<baseDirectory>apache-iotdb-${project.version}-client-cpp-${os.classifier}-bin</baseDirectory>
2929
<fileSets>
3030
<fileSet>
31-
<directory>${project.basedir}/../iotdb-client/client-cpp/target/client-cpp-${project.version}-${os.classifier}/client-cpp-${project.version}-${os.classifier}</directory>
31+
<directory>${project.basedir}/../iotdb-client/client-cpp/target/client-cpp-${project.version}-${os.classifier}</directory>
3232
<outputDirectory>${file.separator}</outputDirectory>
3333
</fileSet>
3434
</fileSets>

example/client-cpp-example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ user `root` / `root`).
4343

4444
Release CI ([client-cpp-package.yml](../../.github/workflows/client-cpp-package.yml))
4545
publishes one zip per platform/toolchain:
46-
`client-cpp-<version>-<classifier>.zip` (root folder `client-cpp-<version>-<classifier>/` with `include/` and `lib/`).
46+
`client-cpp-<version>-<classifier>.zip` (zip root contains `include/` and `lib/`).
4747

4848
| Deployment target | Classifier suffix |
4949
|-------------------|-------------------|

example/client-cpp-example/README_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
CI 发版([client-cpp-package.yml](../../.github/workflows/client-cpp-package.yml)
4444
会按平台/工具链打出多份 zip,文件名形如
45-
`client-cpp-<version>-<classifier>.zip`解压后为 `client-cpp-<version>-<classifier>/`,内含 `include/``lib/`)。请按目标环境选择:
45+
`client-cpp-<version>-<classifier>.zip`解压后根目录即为 `include/``lib/`)。请按目标环境选择:
4646

4747
| 目标环境 | classifier 后缀 |
4848
|----------|-----------------|

example/client-cpp-example/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@
108108
<type>zip</type>
109109
<classifier>${os.classifier}</classifier>
110110
<overWrite>true</overWrite>
111-
<fileMappers>
112-
<org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
113-
<pattern>^[^/]+/(.*)$</pattern>
114-
<replacement>$1</replacement>
115-
</org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
116-
</fileMappers>
117111
</artifactItem>
118112
</artifactItems>
119113
<outputDirectory>${project.build.directory}/client</outputDirectory>

iotdb-client/client-cpp/README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ During configure CMake will, in order:
6666

6767
The Maven build sets `cmake.install.prefix` to `target/install/`. Output zips
6868
land at `iotdb-client/client-cpp/target/client-cpp-<version>-<classifier>.zip`
69-
(with `include/` and `lib/` under `client-cpp-<version>-<classifier>/` inside the zip),
69+
(with `include/` and `lib/` at the zip root; a `.sha512` checksum is generated alongside),
7070
where `<classifier>` defaults to the OS name (for example `linux-x86_64`) and
7171
can be overridden with `-Dclient.cpp.package.classifier=...` when building
7272
multiple toolchains on the same platform.
@@ -325,15 +325,14 @@ A successful `mvn ... package` produces
325325
`target/client-cpp-<version>-<classifier>.zip` with this layout:
326326

327327
```
328-
client-cpp-<version>-<classifier>/
329-
├── include/
330-
│ ├── Session.h
331-
│ ├── SessionC.h
332-
│ └── ... (public API headers only; no Thrift/Boost)
333-
└── lib/
334-
├── libiotdb_session.{so,dylib} (Linux / macOS)
335-
├── iotdb_session.dll (Windows – runtime)
336-
└── iotdb_session.lib (Windows – import library for linking)
328+
include/
329+
├── Session.h
330+
├── SessionC.h
331+
└── ... (public API headers only; no Thrift/Boost)
332+
lib/
333+
├── libiotdb_session.{so,dylib} (Linux / macOS)
334+
├── iotdb_session.dll (Windows – runtime)
335+
└── iotdb_session.lib (Windows – import library for linking)
337336
```
338337

339338
Thrift is embedded inside `iotdb_session` on all platforms; it is not shipped

iotdb-client/client-cpp/pom.xml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
</execution>
170170
</executions>
171171
</plugin>
172-
<!-- Zip: client-cpp-<version>-<classifier>.zip with include/ and lib/ inside -->
172+
<!-- Zip: client-cpp-<version>-<classifier>.zip with include/ and lib/ at zip root -->
173173
<plugin>
174174
<groupId>org.apache.maven.plugins</groupId>
175175
<artifactId>maven-assembly-plugin</artifactId>
@@ -189,6 +189,33 @@
189189
</execution>
190190
</executions>
191191
</plugin>
192+
<!-- Create SHA512 checksum files for the release zip. -->
193+
<plugin>
194+
<groupId>net.nicoulaj.maven.plugins</groupId>
195+
<artifactId>checksum-maven-plugin</artifactId>
196+
<executions>
197+
<execution>
198+
<id>checksum-client-cpp-package</id>
199+
<goals>
200+
<goal>files</goal>
201+
</goals>
202+
<phase>package</phase>
203+
<configuration>
204+
<algorithms>
205+
<algorithm>SHA-512</algorithm>
206+
</algorithms>
207+
<fileSets>
208+
<fileSet>
209+
<directory>${project.build.directory}</directory>
210+
<includes>
211+
<include>${project.artifactId}-${project.version}-${client.cpp.package.classifier}.zip</include>
212+
</includes>
213+
</fileSet>
214+
</fileSets>
215+
</configuration>
216+
</execution>
217+
</executions>
218+
</plugin>
192219
</plugins>
193220
</build>
194221
<profiles>

iotdb-client/client-cpp/src/assembly/client-cpp.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@
2020
<!--
2121
The CMake build installs everything (headers + libs) into
2222
${cmake.install.prefix} = target/install. Package layout:
23-
client-cpp-<version>-<classifier>/{include,lib}
23+
client-cpp-<version>-<classifier>.zip -> {include,lib} at zip root.
2424
-->
2525
<assembly>
2626
<id>${client.cpp.package.classifier}</id>
2727
<formats>
2828
<format>zip</format>
2929
<format>dir</format>
3030
</formats>
31-
<includeBaseDirectory>true</includeBaseDirectory>
32-
<baseDirectory>${project.artifactId}-${project.version}-${client.cpp.package.classifier}</baseDirectory>
31+
<includeBaseDirectory>false</includeBaseDirectory>
3332
<fileSets>
3433
<fileSet>
3534
<directory>${project.build.directory}/install/include</directory>

0 commit comments

Comments
 (0)