From 3dd99ce5f8239f85fc7c834ab1bd88279f377a34 Mon Sep 17 00:00:00 2001 From: finn Date: Fri, 15 Oct 2021 00:26:35 -0700 Subject: [PATCH] Initial commit --- .gitlab-ci.yml | 80 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 ++ libsignal.patch | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 README.md create mode 100644 libsignal.patch diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..509bda6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,80 @@ +stages: + - native libraries + - bindings + - java + +variables: + libsignal_version: "v0.9.0" + GRADLE_OPTS: -Dorg.gradle.daemon=false + +.multitarget: + parallel: + matrix: + - TARGET: + - aarch64-unknown-linux-gnu + - arm-unknown-linux-gnueabi + - arm-unknown-linux-gnueabihf + - armv7-unknown-linux-gnueabihf + - x86_64-unknown-linux-gnu + +compile: + extends: .multitarget + image: rust:slim-buster + stage: native libraries + before_script: + - ./prepare-env.sh + script: + - git clone https://github.com/signalapp/libsignal-client + - cd libsignal-client && git checkout "$libsignal_version" + - rustup target add "${TARGET}" + - RUSTFLAGS='-C link-arg=-s' cargo build -p libsignal-jni --target "${TARGET}" --release --verbose + - cp -v target/${TARGET}/release/libsignal_jni.so ../libsignal_jni-${TARGET}.so + artifacts: + paths: + - libsignal_jni-$TARGET.so + +compile x86_64-apple-darwin: + stage: native libraries + tags: [darwin-builder] + script: + - git clone https://github.com/signalapp/libsignal-client + - cd libsignal-client && git checkout "$libsignal_version" + - RUSTFLAGS='-C link-arg=-s' cargo build -p libsignal-jni --release --verbose + - cp -v target/release/libsignal_jni.dylib ../libsignal_jni-x86_64-apple-darwin.dylib + artifacts: + paths: + - libsignal_jni-x86_64-apple-darwin.dylib + variables: + TARGET: x86_64-apple-darwin + +jar: + extends: .multitarget + image: gradle:6 + stage: bindings + needs: ["libsignal:bin"] + script: + - git clone https://github.com/signalapp/libsignal-client + - cd libsignal-client && git checkout "$libsignal_version" + - git config user.email nobody@signald.org && git config user.name signald + - git am ../libsignal.patch + - mkdir -p java/java/src/main/resources + - cp "../libsignal_jni-${TARGET}.so" java/java/src/main/resources/libsignal_jni.so + - cd java + - gradle assemble publish + +jar x86_64-apple-darwin: + image: gradle:6 + stage: bindings + tags: [darwin-builder] + needs: ["libsignal:bin:x86_64-apple-darwin"] + script: + - git clone https://github.com/signalapp/libsignal-client + - cd libsignal-client && git checkout "$libsignal_version" + - git config user.email nobody@signald.org && git config user.name signald + - git am ../libsignal.patch + - mkdir -p java/java/src/main/resources + - cp "../libsignal_jni-${TARGET}.dylib" java/java/src/main/resources/libsignal_jni.dylib + - cd java + - gradle assemble publish + variables: + TARGET: x86_64-apple-darwin \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..75c08ca --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# libsignal-client + +this repo manages building and publishing of [libsignal-client](https://github.com/SignalApp/libsignal-client). The published artifact is a per-target jar in a maven-compatible repo. \ No newline at end of file diff --git a/libsignal.patch b/libsignal.patch new file mode 100644 index 0000000..173c38e --- /dev/null +++ b/libsignal.patch @@ -0,0 +1,84 @@ +From 46c6a177211022656abcbb30001044b7592b2552 Mon Sep 17 00:00:00 2001 +From: signald +Date: Thu, 20 May 2021 23:56:48 -0700 +Subject: [PATCH] Update gradle files + +--- + java/build.gradle | 16 +--------------- + java/java/build.gradle | 23 +++++++++++++++++++++-- + 2 files changed, 22 insertions(+), 17 deletions(-) + +diff --git a/java/build.gradle b/java/build.gradle +index a88e374..b89a098 100644 +--- a/java/build.gradle ++++ b/java/build.gradle +@@ -11,20 +11,6 @@ subprojects { + } + } + +-task makeJniLibrariesAndroid(type:Exec) { +- group 'Rust' +- description 'Build the JNI libraries' +- +- commandLine './build_jni.sh', 'android' +-} +- +-task makeJniLibrariesDesktop(type:Exec) { +- group 'Rust' +- description 'Build the JNI libraries' +- +- commandLine './build_jni.sh', 'desktop' +-} +- + task clean(type: Delete) { + description 'Clean JNI libs' + delete fileTree('./android/src/main/jniLibs') { +@@ -41,5 +27,5 @@ task makeAll() { + group 'Rust' + description 'Build the native libraries' + +- dependsOn 'makeDesktop', 'makeAndroid' ++ dependsOn 'makeDesktop' + } +diff --git a/java/java/build.gradle b/java/java/build.gradle +index 2f31542..ba4bdbc 100644 +--- a/java/java/build.gradle ++++ b/java/java/build.gradle +@@ -8,6 +8,7 @@ buildscript { + apply plugin: 'java' + apply plugin: 'maven' + apply plugin: 'signing' ++apply plugin: 'maven-publish' + + sourceCompatibility = 1.7 + archivesBaseName = "signal-client-java" +@@ -133,6 +134,24 @@ artifacts { + archives packageSources + } + +-tasks.withType(JavaCompile) { +- compileTask -> compileTask.dependsOn ':makeJniLibrariesDesktop' ++ ++publishing { ++ publications { ++ library(MavenPublication) { ++ from components.java ++ artifactId = archivesBaseName + "-" + System.getenv("TARGET") ++ } ++ } ++ repositories { ++ maven { ++ url System.getenv("CI_API_V4_URL") + "/projects/" + System.getenv("CI_PROJECT_ID") + "/packages/maven" ++ credentials(HttpHeaderCredentials) { ++ name = 'Job-Token' ++ value = System.getenv("CI_JOB_TOKEN") ++ } ++ authentication { ++ header(HttpHeaderAuthentication) ++ } ++ } ++ } + } +-- +2.20.1 +