Skip to content

Commit 25fcebe

Browse files
committed
fix: split android native symbols
1 parent bf98583 commit 25fcebe

13 files changed

Lines changed: 109 additions & 16 deletions

File tree

.github/workflows/gradle-publish.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
publish:
1717
runs-on: ubuntu-latest
1818
permissions:
19-
contents: read
19+
contents: write
2020
packages: write
2121

2222
steps:
@@ -58,7 +58,7 @@ jobs:
5858
if [[ -z "$VERSION" ]]; then
5959
VERSION="$GITHUB_REF_NAME"
6060
fi
61-
echo "version=${VERSION#v}" >> $GITHUB_OUTPUT
61+
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
6262
6363
- name: Generate Android bindings
6464
run: ./build_android.sh
@@ -67,6 +67,18 @@ jobs:
6767
working-directory: bindings/android
6868
run: ./gradlew build -Pversion=${{ steps.version.outputs.version }}
6969

70+
- name: Upload native debug symbols artifact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: vss-client-native-debug-symbols-${{ steps.version.outputs.version }}
74+
path: bindings/android/native-debug-symbols.zip
75+
76+
- name: Upload native debug symbols to release
77+
if: github.event_name == 'release'
78+
env:
79+
GH_TOKEN: ${{ github.token }}
80+
run: gh release upload "${{ github.event.release.tag_name }}" bindings/android/native-debug-symbols.zip --clobber
81+
7082
- name: Publish to GitHub Packages
7183
working-directory: bindings/android
7284
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.idea/
22
.DS_Store
33
/target/
4+
bindings/android/native-debug-symbols.zip
45
.rust-analyzer/
56
.cargo/
67
# Default ignored files

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vss-rust-client-ffi"
3-
version = "0.5.17"
3+
version = "0.5.18"
44
edition = "2021"
55
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
66

Package.swift

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

44
import PackageDescription
55

6-
let tag = "v0.5.17"
6+
let tag = "v0.5.18"
77
let checksum = "92c01c752f505d47e22a8ea7b4b3c6ec47b60a9dd877459d9c628d743ce723bf"
88
let url = "https://github.com/synonymdev/vss-rust-client-ffi/releases/download/\(tag)/VssRustClientFfi.xcframework.zip"
99

bindings/android/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ cd ./bindings/android
9191
./gradlew publish -Pversion=0.1.0
9292
```
9393

94-
Run `./build_android.sh` before any direct Gradle publish so `jniLibs` is regenerated with native debug metadata and 16 KB page-size alignment.
94+
Run `./build_android.sh` before any direct Gradle publish so `jniLibs` is regenerated as stripped release libraries with separate `native-debug-symbols.zip` metadata and 16 KB page-size alignment.

bindings/android/build.gradle.kts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ android {
3232
kotlinOptions {
3333
jvmTarget = "11"
3434
}
35-
packaging {
36-
jniLibs {
37-
keepDebugSymbols += listOf("**/libvss_rust_client_ffi.so")
38-
}
39-
}
4035
publishing {
4136
singleVariant("release") {
4237
withSourcesJar()
@@ -104,7 +99,7 @@ fun String.parseElfAlignment(): Long {
10499

105100
val validateReleaseNativeLibraries by tasks.registering {
106101
group = "verification"
107-
description = "Validates release JNI libraries keep full DWARF metadata and 16 KB LOAD alignment."
102+
description = "Validates release JNI libraries are stripped and keep 16 KB LOAD alignment."
108103

109104
doLast {
110105
val readelf = findReadelf()
@@ -117,8 +112,11 @@ val validateReleaseNativeLibraries by tasks.registering {
117112
}
118113

119114
val (sectionsExit, sections) = runReadelf(readelf, "-S", lib.absolutePath)
120-
if (sectionsExit != 0 || !Regex("""\.debug_info""").containsMatchIn(sections)) {
121-
throw GradleException("Android native library has no .debug_info DWARF metadata: '${lib.path}'")
115+
if (sectionsExit != 0) {
116+
throw GradleException("Unable to inspect Android native library sections: '${lib.path}'")
117+
}
118+
if (Regex("""\.debug_""").containsMatchIn(sections)) {
119+
throw GradleException("Android release native library still contains .debug_* sections: '${lib.path}'")
122120
}
123121

124122
val wideHeaders = runReadelf(readelf, "-W", "-l", lib.absolutePath)
@@ -158,6 +156,10 @@ afterEvaluate {
158156
version = project.version.toString()
159157

160158
from(components["release"])
159+
artifact(rootProject.layout.projectDirectory.file("native-debug-symbols.zip")) {
160+
classifier = "native-debug-symbols"
161+
extension = "zip"
162+
}
161163
pom {
162164
name.set(mavenArtifactId)
163165
description.set("VSS Rust Client Android bindings.")

bindings/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ android.useAndroidX=true
33
android.nonTransitiveRClass=true
44
kotlin.code.style=official
55
# project settings:
6-
version=0.5.17
6+
version=0.5.18
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)