diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..90ea274 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +libsignal/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 62d8886..f5b537d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - bindings variables: - libsignal_version: "v0.26.0" + libsignal_version: "v0.36.1" GRADLE_OPTS: -Dorg.gradle.daemon=false CARGO_TERM_COLOR: always @@ -45,8 +45,8 @@ compile: before_script: - ./prepare-env.sh script: - - git clone https://github.com/signalapp/libsignal-client - - cd libsignal-client && git checkout "$libsignal_version" + - git clone https://github.com/signalapp/libsignal.git + - cd libsignal && git checkout "$libsignal_version" - rustup set profile minimal - rustup toolchain install nightly - rustup target add "${TARGET}" @@ -63,24 +63,24 @@ compile: paths: - libsignal_jni-$TARGET.so -compile darwin: - extends: .multitarget-darwin - stage: native library - tags: [darwin-builder] - 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.dylib ../libsignal_jni-${TARGET}.dylib - artifacts: - paths: - - libsignal_jni-$TARGET.dylib - rules: - - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' - when: on_success - - when: manual - allow_failure: true +# compile darwin: +# extends: .multitarget-darwin +# stage: native library +# tags: [darwin-builder] +# script: +# - git clone https://github.com/signalapp/libsignal.git +# - cd libsignal && 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.dylib ../libsignal_jni-${TARGET}.dylib +# artifacts: +# paths: +# - libsignal_jni-$TARGET.dylib +# rules: +# - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' +# when: on_success +# - when: manual +# allow_failure: true jar: extends: .multitarget @@ -88,8 +88,8 @@ jar: stage: bindings needs: ["compile"] script: - - git clone https://github.com/signalapp/libsignal-client - - cd libsignal-client && git checkout "$libsignal_version" + - git clone https://github.com/signalapp/libsignal.git + - cd libsignal && git checkout "$libsignal_version" - git config user.email nobody@signald.org && git config user.name signald - git am ../libsignal.patch - mkdir -p java/shared/resources @@ -97,23 +97,23 @@ jar: - cd java - gradle assemble publish -jar darwin: - extends: .multitarget-darwin - image: gradle:7 - stage: bindings - tags: [darwin-builder] - needs: ["compile 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/shared/resources - - cp "../libsignal_jni-${TARGET}.dylib" java/shared/resources/libsignal_jni.dylib - - cd java - - gradle assemble publish - rules: - - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' - when: on_success - - when: manual - allow_failure: true +# jar darwin: +# extends: .multitarget-darwin +# image: gradle:7 +# stage: bindings +# tags: [darwin-builder] +# needs: ["compile darwin"] +# script: +# - git clone https://github.com/signalapp/libsignal.git +# - cd libsignal && git checkout "$libsignal_version" +# - git config user.email nobody@signald.org && git config user.name signald +# - git am ../libsignal.patch +# - mkdir -p java/shared/resources +# - cp "../libsignal_jni-${TARGET}.dylib" java/shared/resources/libsignal_jni.dylib +# - cd java +# - gradle assemble publish +# rules: +# - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' +# when: on_success +# - when: manual +# allow_failure: true diff --git a/README.md b/README.md index 75c08ca..67ef401 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # 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 +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. + + +## Developing + +To update libsignal: +1. download libsignal and checkout the desired tag: `git clone https://github.com/SignalApp/libsignal.git && cd libsignal && git checkout v0.36.1` +3. make changes as needed +4. test java build: `podman run --rm -v $(pwd):/build -w /build -e CI_API_V4_URL=https://gitlab.com/api -e CI_PROJECT_ID=1234 library/gradle:7 bash -c 'cd libsignal/java && gradle assemble publish'` diff --git a/libsignal.patch b/libsignal.patch index f2de41c..556f2e1 100644 --- a/libsignal.patch +++ b/libsignal.patch @@ -1,54 +1,76 @@ -From df2a3fc267457a6f17527ed49e149ccc89895b25 Mon Sep 17 00:00:00 2001 +From 907e83868ee82ff5b24ab1d68b8159a44a6908e7 Mon Sep 17 00:00:00 2001 From: signald -Date: Wed, 26 Oct 2022 20:02:19 -0700 +Date: Sat, 16 Dec 2023 11:24:01 -0800 Subject: [PATCH] update build files --- - java/build.gradle | 9 +-------- - java/client/build.gradle | 28 ++++++++-------------------- - java/settings.gradle | 11 +---------- - 3 files changed, 10 insertions(+), 38 deletions(-) + java/build.gradle | 19 +------------------ + java/client/build.gradle | 25 +++++++++++++------------ + java/settings.gradle | 13 +------------ + 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/java/build.gradle b/java/build.gradle -index 0c8f9458..01d198e7 100644 +index ef4cbe6b..81c50aca 100644 --- a/java/build.gradle +++ b/java/build.gradle -@@ -6,7 +6,7 @@ def version_number = "0.20.0" - - subprojects { - ext.version_number = version_number -- ext.group_info = "org.signal" -+ ext.group_info = "org.signald" - - if (JavaVersion.current().isJava8Compatible()) { - allprojects { -diff --git a/java/client/build.gradle b/java/client/build.gradle -index 7ee6b154..8fa89874 100644 ---- a/java/client/build.gradle -+++ b/java/client/build.gradle -@@ -1,7 +1,6 @@ +@@ -1,13 +1,12 @@ plugins { - id 'java-library' - id 'maven-publish' -- id 'signing' + id "base" +- id "signing" + id "com.diffplug.spotless" version "6.20.0" + id "io.github.gradle-nexus.publish-plugin" version "1.3.0" } - sourceCompatibility = 1.8 -@@ -46,23 +45,13 @@ java { - withJavadocJar() + allprojects { + version = "0.36.1" +- group = "org.signal" ++ group = "org.signald" + } + + subprojects { +@@ -42,13 +41,6 @@ subprojects { + } + } + +-task makeJniLibrariesDesktop(type:Exec) { +- group 'Rust' +- description 'Build the JNI libraries' +- +- // Explicitly specify 'bash' for Windows compatibility. +- commandLine 'bash', './build_jni.sh', 'desktop' +-} + + task cargoClean(type:Exec) { + group 'Rust' +@@ -80,15 +72,6 @@ ext.setUpSigningKey = { signingExt -> + } + } + +-nexusPublishing { +- repositories { +- sonatype { +- username = project.findProperty('sonatypeUsername') ?: "" +- password = project.findProperty('sonatypePassword') ?: "" +- } +- } +-} +- + def isReleaseBuild() { + return version.contains("SNAPSHOT") == false + } +diff --git a/java/client/build.gradle b/java/client/build.gradle +index c5f61516..b88da2c4 100644 +--- a/java/client/build.gradle ++++ b/java/client/build.gradle +@@ -56,17 +56,12 @@ tasks.named('jar') { + } } -processResources { - // TODO: Build a different variant of the JNI library for server. - dependsOn ':makeJniLibrariesDesktop' -- dependsOn ':downloadNonLinuxLibraries' -- gradle.taskGraph.whenReady { graph -> -- if (graph.hasTask(":client:publish")) { -- tasks.getByPath(":downloadNonLinuxLibraries").enabled = true -- } -- } -} - +- // MARK: Publishing publishing { @@ -59,14 +81,18 @@ index 7ee6b154..8fa89874 100644 from components.java pom { -@@ -93,16 +82,15 @@ publishing { +@@ -95,10 +90,16 @@ publishing { + } + } } - repositories { - maven { -- url = getReleaseRepositoryUrl() -- credentials { -- username = getRepositoryUsername() -- password = getRepositoryPassword() +-} +- +-setUpSigningKey(signing) +-signing { +- required { isReleaseBuild() && gradle.taskGraph.hasTask(":client:publish") } +- sign publishing.publications.mavenJava ++ repositories { ++ maven { + url System.getenv("CI_API_V4_URL") + "/projects/" + System.getenv("CI_PROJECT_ID") + "/packages/maven" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' @@ -74,24 +100,19 @@ index 7ee6b154..8fa89874 100644 + } + authentication { + header(HttpHeaderAuthentication) - } - } - } ++ } ++ } ++ } } - --signing { -- required { isReleaseBuild() && gradle.taskGraph.hasTask(":client:publish") } -- sign publishing.publications.mavenJava --} diff --git a/java/settings.gradle b/java/settings.gradle -index f6414646..13575990 100644 +index 6d717998..e58126f6 100644 --- a/java/settings.gradle +++ b/java/settings.gradle -@@ -6,15 +6,4 @@ pluginManagement { - } - } +@@ -8,15 +8,4 @@ pluginManagement { --include ':client', ':server' + rootProject.name = 'libsignal' + +-include ':client', ':server', ':shared' - -if (hasProperty('skipAndroid')) { - // Do nothing @@ -104,7 +125,6 @@ index f6414646..13575990 100644 - throw new GradleException("building for Android requires JDK 11 or newer; use 'client:' or 'server:' to only build certain products") -} +include ':client' -\ No newline at end of file -- -2.30.2 +2.39.2 diff --git a/prepare-env.sh b/prepare-env.sh index 6e68c60..c59af9f 100755 --- a/prepare-env.sh +++ b/prepare-env.sh @@ -3,7 +3,7 @@ set -exuo pipefail apt-get update -PACKAGES=("git" "clang-13" "libclang-dev" "cmake" "make") # "gcc-multilib" "g++-multilib") +PACKAGES=("git" "clang-13" "libclang-dev" "cmake" "make" "protobuf-compiler") # "gcc-multilib" "g++-multilib") case "${TARGET}" in aarch64-unknown-linux-gnu|aarch64-unknown-linux-musl) apt-get install -yqq "${PACKAGES[@]}" {binutils,g++,gcc}-aarch64-linux-gnu