Skip to content
Open
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
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish artfiacts to Sonatype Repo

on: [push]

jobs:
build-native:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build native image
run: |
cd zwaves_jni
sudo apt-get update
rustup target add x86_64-unknown-linux-gnu
cargo build --target=x86_64-unknown-linux-gnu --release
cp ../target/x86_64-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux64
cd javalib
./gradlew publishToSonatype \
-PsonatypeUsername='${{ secrets.OSSRH_USERNAME }}' \
-PsonatypePassword='${{ secrets.OSSRH_PASSWORD }}' \
-PgpgKey='${{ secrets.OSSRH_GPG_KEY_ASCII }}' \
-PgpgPassphrase='${{ secrets.OSSRH_GPG_PASSPHRASE }}'

41 changes: 22 additions & 19 deletions zwaves_jni/build_all.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
if [ ! -d "osxcross" ]; then
git clone https://github.com/tpoechtrager/osxcross
pushd osxcross
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
mv MacOSX10.10.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
popd
fi
# if [ ! -d "osxcross" ]; then
# git clone https://github.com/tpoechtrager/osxcross
# pushd osxcross
# wget --quiet -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
# mv MacOSX10.10.sdk.tar.xz tarballs/
# UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
# popd
# fi

cargo build --target=i686-unknown-linux-gnu --release
cp ../target/i686-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux32
# rustup target add i686-unknown-linux-gnu
# cargo build --target=i686-unknown-linux-gnu --release
# cp ../target/i686-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux32

cargo build --target=x86_64-unknown-linux-gnu --release
cp ../target/x86_64-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux64

PATH="$(pwd)/osxcross/target/bin:$PATH" CC=o64-clang CXX=o64-clang++ LIBZ_SYS_STATIC=1 cargo build --target x86_64-apple-darwin --release
cp ../target/x86_64-apple-darwin/release/libzwaves_jni.dylib javalib/src/main/resources/META-INF/native/osx

cargo build --target=i686-pc-windows-gnu --release
cp ../target/i686-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows32

cargo build --target=x86_64-pc-windows-gnu --release
cp ../target/x86_64-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows64
# PATH="$(pwd)/osxcross/target/bin:$PATH" CC=o64-clang CXX=o64-clang++ LIBZ_SYS_STATIC=1 cargo build --target x86_64-apple-darwin --release
# cp ../target/x86_64-apple-darwin/release/libzwaves_jni.dylib javalib/src/main/resources/META-INF/native/osx
#
# rustup target add i686-pc-windows-gnu
# cargo build --target=i686-pc-windows-gnu --release
# cp ../target/i686-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows32
#
# rustup target add x86_64-pc-windows-gnu
# cargo build --target=x86_64-pc-windows-gnu --release
# cp ../target/x86_64-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows64

pushd javalib
./gradlew build
./gradlew build -P
popd
61 changes: 35 additions & 26 deletions zwaves_jni/javalib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* User Manual available at https://docs.gradle.org/5.4.1/userguide/java_library_plugin.html
*/

plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id "java-library"
id "maven-publish"
id "signing"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
}

repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenCentral()
}

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:27.0.1-jre'

// Use JUnit test framework
testImplementation 'junit:junit:4.12'
publishing {
publications {
mavenJava(MavenPublication) {
from(components["java"])

pom {
name.set("zwaves")
licenses {
license {
name.set("MIT License")
url.set("LICENSE")
}
}
}
}
}
}

signing {
useInMemoryPgpKeys(gpgKey, gpgPassphrase)
sign(publishing.publications["mavenJava"])
}

test {
useJUnit()

maxHeapSize = '1G'
nexusPublishing {
repositories {
repositories {
sonatype {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file modified zwaves_jni/javalib/gradlew
100644 → 100755
Empty file.
9 changes: 0 additions & 9 deletions zwaves_jni/javalib/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/5.4.1/userguide/multi_project_builds.html
*/

rootProject.name = 'zwaves'