Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: zenoh-jni not loaded locally & publish jvm workflow #17

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish_android.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish
name: Publish Android

on:
release:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_jvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
esac

- name: "Upload packages"
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.job.target }}
path: |
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,24 @@ jobs:
override: true
components: rustfmt, clippy

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Cargo Format
working-directory: zenoh-jni
run: cargo fmt --all --check

- name: Clippy Check
working-directory: zenoh-jni
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Cargo Format
- name: Check for feature leaks
working-directory: zenoh-jni
run: cargo fmt --all --check
run: cargo test --no-default-features

- name: Build Zenoh-JNI
working-directory: zenoh-jni
run: cargo build

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Gradle Test
run: gradle jvmTest --info
31 changes: 2 additions & 29 deletions zenoh-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ kotlin {
}
}
val jvmMain by getting {
resources.srcDir("../zenoh-jni/target/release").include(arrayListOf("*.dylib", "*.so", "*.dll"))

// The line below is intended to load the native libraries that are crosscompiled on GitHub actions when publishing a JVM package.
resources.srcDir("../jni-libs").include("*/**")
}
Expand Down Expand Up @@ -146,32 +148,3 @@ tasks.whenObjectAdded {
this.inputs.dir(buildDir.resolve("rustJniLibs/android"))
}
}

fun buildZenohJNI(mode: BuildMode = BuildMode.DEBUG) {
val cargoCommand = mutableListOf("cargo", "build")

if (mode == BuildMode.RELEASE) {
cargoCommand.add("--release")
}

val result = project.exec {
commandLine(*(cargoCommand.toTypedArray()), "--manifest-path", "../zenoh-jni/Cargo.toml")
}

if (result.exitValue != 0) {
throw GradleException("Failed to build Zenoh-JNI.")
}
}

enum class BuildMode {
DEBUG {
override fun toString(): String {
return "debug"
}
},
RELEASE {
override fun toString(): String {
return "release"
}
}
}
Loading