Initial commit

This commit is contained in:
finn 2021-10-15 00:26:35 -07:00
commit 3dd99ce5f8
3 changed files with 167 additions and 0 deletions

80
.gitlab-ci.yml Normal file
View file

@ -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

3
README.md Normal file
View file

@ -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.

84
libsignal.patch Normal file
View file

@ -0,0 +1,84 @@
From 46c6a177211022656abcbb30001044b7592b2552 Mon Sep 17 00:00:00 2001
From: signald <nobody@signald.org>
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