From 5179cc9226c92b6562f5b8c20063fb9f481e986b Mon Sep 17 00:00:00 2001 From: Finn Date: Sat, 16 Dec 2023 16:43:30 -0800 Subject: [PATCH] update to v2.15.3_unofficial_90 --- .gitignore | 1 + .gitlab-ci.yml | 24 +- build.sh | 2 +- hashes.json | 32 +-- libsignal-service-java.patch | 423 +++++++++++++++++++++-------------- update-hashes.py | 8 +- 6 files changed, 281 insertions(+), 209 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..177875a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +libsignal-service-java diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 264f7a4..84a549f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ stages: - build variables: - version: "v2.15.3_unofficial_50" + version: "v2.15.3_unofficial_90" GRADLE_OPTS: -Dorg.gradle.daemon=false build: @@ -18,15 +18,15 @@ build: - arm-unknown-linux-gnueabihf - armv7-unknown-linux-gnueabihf - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl + # - x86_64-unknown-linux-musl -build darwin: - stage: build - tags: [darwin-builder] - script: - - ./build.sh - parallel: - matrix: - - TARGET: - - x86_64-apple-darwin - - aarch64-apple-darwin +# build darwin: +# stage: build +# tags: [darwin-builder] +# script: +# - ./build.sh +# parallel: +# matrix: +# - TARGET: +# - x86_64-apple-darwin +# - aarch64-apple-darwin diff --git a/build.sh b/build.sh index 4f84fb2..ba3287c 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ cd libsignal-service-java git config user.email nobody@signald.org git config user.name signald git am ../libsignal-service-java.patch -git am ../update-kbs-settings.patch +# git am ../update-kbs-settings.patch # unclear if this is still needed python3 ../update-verification-metadata.py git diff --color=always gradle assemble publish || (gradle --write-verification-metadata sha256 && git diff --color=always && exit 1) diff --git a/hashes.json b/hashes.json index 11e4ed7..2e0d215 100644 --- a/hashes.json +++ b/hashes.json @@ -1,34 +1,22 @@ { "aarch64-unknown-linux-gnu": { - "jar": "802529c1472f7e621cca496c918d7bfec08314572f10e168b0d20b15a5b8101a", - "module": "48e315037d2d9af6c7cf7b811d9a81d81b1eff13cbb1837b7638a3803b68f303" + "jar": "c0d1ce093ab2060e4333eb49c7315eaca50874cc9e7baa06b5e2ce58a141e6ac", + "module": "0657c6c9d287e5a41ceef433106ff5e490d469b2453fb7678bb0672aef0d75f6" }, "arm-unknown-linux-gnueabi": { - "jar": "8ef66fe1ae28fe7b2918292824ef33a41a3432c3a981cfa55665106c89348327", - "module": "7c988dfb2fca57ff0aabd7bd88ebfa5658be8722adb0831a5140aed3d1529097" + "jar": "8c46441147601b9905dd91460830161a239355e4187ef6dcce4ab6d01e4601ba", + "module": "da17b4f0a37223f157d90d33907e746eceaa672e8ce1c0124a43d8ab4e4261d6" }, "arm-unknown-linux-gnueabihf": { - "jar": "446a796b0a2a062c65d9d5cb75a3fd4aadc03ab321b52c39a5bfe1e6f9dc9891", - "module": "30e6a82cc6d2b01b57b758d8352c9d90926f31becfe6218c43d2614a309c9cbc" + "jar": "f72c16545d62a530985b17c554e626705e24ad8cbbb45807f16c3eca2e8bf5e6", + "module": "3c7ca3308427a89fba119d67a11cb31032042d407f7757a556c45d14bbf8af9b" }, "armv7-unknown-linux-gnueabihf": { - "jar": "3e896a52cf5816387094137403c112353de93f4b7591bcfc5965e89ef3777c5b", - "module": "39be083718c6b8afe94e2ccff63c918ea1255292881afbb60b12236cd4b70dc6" + "jar": "e0ff56633ffa3868e640815b3d6f5bd7577586cc281aa4e5d9f1e818559d7446", + "module": "cb00288bdea54756ea3a712378ed5abc6e877be2940fef939c2c22e0a8c2b193" }, "x86_64-unknown-linux-gnu": { - "jar": "b38295eb11df91939b872f49eb8b55b2faf7933da92202b95d82320f4cdcb644", - "module": "1b739335cde181864882481f5feca8fca3f7baa439f79c36ac596a781e6d4477" - }, - "x86_64-apple-darwin": { - "jar": "949a72b14d81389a30e330db3162f822a475d0f19087590f334639acdb01b4eb", - "module": "7de5da969225585d36d68ba7a87c80d33886e36a04dea9d78ef8c2df9f6a3bf2" - }, - "aarch64-apple-darwin": { - "jar": "e7f405b1c521054bbea8ec0ff87c54527f17e8c914079d7805c4def3589e8af1", - "module": "3c153a7e01ae317280981e387d3fd002b7106ce65653be1b6e4216a4f4d9d314" - }, - "x86_64-unknown-linux-musl": { - "jar": "9a46edb376089b6284cbc76c4e6bc21fa91f8ee7e3daf221d704243cfe0c16cf", - "module": "a35abf78dc674557ddc7da348d5eb2d015b4e843d5402df95922ba2780b36169" + "jar": "dac1a217685d87a30bf4215e069799264893f749005f9c9c33ad6a009a69be69", + "module": "924b8868987fb56b250e3e5cf6157273b2cb8664996b6cdb85535fa84cf9fe15" } } \ No newline at end of file diff --git a/libsignal-service-java.patch b/libsignal-service-java.patch index cdf0862..f1911ca 100644 --- a/libsignal-service-java.patch +++ b/libsignal-service-java.patch @@ -1,212 +1,295 @@ -From c51057ae26118490176af0b2421f8fa62d926c00 Mon Sep 17 00:00:00 2001 +From c8219a8be171ca170eb9ef8d85100c7ab8a6b9a7 Mon Sep 17 00:00:00 2001 From: signald -Date: Thu, 16 Jun 2022 13:04:00 -0700 +Date: Sat, 16 Dec 2023 16:42:49 -0800 Subject: [PATCH] update build files and provide a way for the websocket receive callback to indicate the message was not saved --- - build.gradle | 17 +++-------------- - dependencies.gradle | 3 +-- - gradle/verification-metadata.xml | 13 ++++++++----- - service/build.gradle | 19 +++++++++---------- - .../signalservice/api/NotSavedException.java | 4 ++++ - .../signalservice/api/SignalWebSocket.java | 13 ++++++++++--- - settings.gradle | 1 - - 7 files changed, 35 insertions(+), 35 deletions(-) - create mode 100644 service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java + build.gradle.kts | 16 ++---- + dependencies.gradle.kts | 2 +- + gradle/verification-metadata.xml | 88 +++++++++++++++++++++++++++++--- + service/build.gradle.kts | 20 ++++++-- + settings.gradle.kts | 3 ++ + 5 files changed, 105 insertions(+), 24 deletions(-) -diff --git a/build.gradle b/build.gradle -index 2498bfcb..81f7038d 100644 ---- a/build.gradle -+++ b/build.gradle -@@ -9,11 +9,8 @@ buildscript { - } - } +diff --git a/build.gradle.kts b/build.gradle.kts +index 89519ef1..8d9d01d9 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -6,6 +6,9 @@ buildscript { + rootProject.extra["kotlin_version"] = "1.9.10" + + repositories { ++ maven { ++ url = uri("https://gitlab.com/api/v4/groups/6853927/-/packages/maven") // https://gitlab.com/groups/signald/-/packages ++ } + google() + mavenCentral() + maven { +@@ -31,23 +34,12 @@ buildscript { + + apply(from = "${rootDir}/constants.gradle.kts") -plugins { -- id("io.github.gradle-nexus.publish-plugin") version "1.1.0" +- id("io.github.gradle-nexus.publish-plugin") version "1.3.0" -} -project.group = "com.github.turasa" +project.group = "org.signald" - def getRepositoryUsername() { - return hasProperty('whisperSonatypeUsername') ? whisperSonatypeUsername : "" -@@ -23,18 +20,10 @@ def getRepositoryPassword() { - return hasProperty('whisperSonatypePassword') ? whisperSonatypePassword : "" - } + val repositoryUsername = project.findProperty("whisperSonatypeUsername")?.toString() ?: "" + val repositoryPassword = project.findProperty("whisperSonatypePassword")?.toString() ?: "" -nexusPublishing { -- repositories { -- sonatype { -- username = getRepositoryUsername() -- password = getRepositoryPassword() -- } +- repositories { +- sonatype { +- username = repositoryUsername +- password = repositoryPassword - } +- } -} - subprojects { -- ext.lib_signal_service_version_number = "2.15.3_unofficial_50" -- ext.lib_signal_service_group_info = "com.github.turasa" -+ ext.lib_signal_service_version_number = "2.15.3_unofficial_50_signald_2" -+ ext.lib_signal_service_group_info = "org.signald" + val lib_signal_service_version_number: String by rootProject.extra + val lib_signal_service_group_info: String by rootProject.extra +diff --git a/dependencies.gradle.kts b/dependencies.gradle.kts +index 152a0298..e0bd16af 100644 +--- a/dependencies.gradle.kts ++++ b/dependencies.gradle.kts +@@ -13,7 +13,7 @@ dependencyResolutionManagement { + library("google-jsr305", "com.google.code.findbugs:jsr305:3.0.2") - if (JavaVersion.current().isJava8Compatible()) { - allprojects { -diff --git a/dependencies.gradle b/dependencies.gradle -index e4b9f8a8..20e0d2f2 100644 ---- a/dependencies.gradle -+++ b/dependencies.gradle -@@ -8,8 +8,7 @@ dependencyResolutionManagement { - alias('google-libphonenumber').to('com.googlecode.libphonenumber:libphonenumber:8.12.48') + // 1st Party +- library("libsignal-client", "org.signal", "libsignal-client").versionRef("libsignal-client") ++ library("libsignal-client", "org.signald", "libsignal-client-" + System.getenv("TARGET")).versionRef("libsignal-client") - // 1st Party -- alias('libsignal-client').to('org.signal', 'libsignal-client').versionRef('libsignal-client') -- alias('libsignal-android').to('org.signal', 'libsignal-android').versionRef('libsignal-client') -+ alias('libsignal-client').to('org.signald', 'libsignal-client-' + System.getenv("TARGET")).versionRef('libsignal-client') - - // Third Party - alias('jackson-core').to('com.fasterxml.jackson.core:jackson-databind:2.13.0') + // Third Party + library("jackson-core", "com.fasterxml.jackson.core:jackson-databind:2.16.0") diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml -index fc39d024..59fde59c 100644 +index 7b9f9ca9..87bc8856 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml -@@ -482,6 +482,9 @@ - - +@@ -1,5 +1,5 @@ + +- ++ + + true + false +@@ -60,6 +60,11 @@ + -+ -+ + ++ ++ ++ ++ ++ + + + +@@ -451,6 +456,9 @@ + + + ++ ++ + - - -@@ -1133,12 +1136,12 @@ - + + +@@ -800,6 +808,12 @@ -- -- -- -+ -+ + ++ ++ ++ ++ ++ ++ + + + +@@ -816,6 +830,12 @@ + + + ++ ++ ++ ++ ++ ++ + + + +@@ -890,6 +910,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -978,6 +1006,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -1012,6 +1048,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -1046,6 +1090,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -1070,6 +1122,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -1209,6 +1269,22 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -1238,12 +1314,12 @@ + + + +- +- +- ++ ++ + -- -- -+ +- +- ++ + - -diff --git a/service/build.gradle b/service/build.gradle -index ae4df43a..4b0240d8 100644 ---- a/service/build.gradle -+++ b/service/build.gradle -@@ -21,6 +21,7 @@ compileJava { - } + +diff --git a/service/build.gradle.kts b/service/build.gradle.kts +index bc927658..463d9214 100644 +--- a/service/build.gradle.kts ++++ b/service/build.gradle.kts +@@ -114,7 +114,7 @@ publishing { + from(components["java"]) - repositories { -+ maven {url "https://gitlab.com/api/v4/groups/6853927/-/packages/maven"} // https://gitlab.com/groups/signald/-/packages - mavenCentral() - mavenLocal() - } -@@ -98,7 +99,7 @@ def getRepositoryPassword() { - publishing { - publications { - mavenJava(MavenPublication) { -- artifactId = 'signal-service-java' -+ artifactId = 'signal-service-java-' + System.getenv("TARGET") - from components.java - - pom { -@@ -139,16 +140,14 @@ publishing { - - repositories { - maven { -- url = getReleaseRepositoryUrl() -- credentials { -- username getRepositoryUsername() -- password getRepositoryPassword() -+ 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) - } + pom { +- name.set("signal-service-java") ++ name.set("signal-service-java-" + System.getenv("TARGET")) + description.set("Signal Service communication library for Java, unofficial fork") + url.set("https://github.com/Turasa/libsignal-service-java") + licenses { +@@ -141,10 +141,20 @@ publishing { } - } - } -- --signing { -- required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } -- sign publishing.publications.mavenJava --} -diff --git a/service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java b/service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java -new file mode 100644 -index 00000000..05d77d1f ---- /dev/null -+++ b/service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java -@@ -0,0 +1,4 @@ -+package org.whispersystems.signalservice.api; -+ -+public class NotSavedException extends Exception { -+} -diff --git a/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java b/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java -index 5a98f3c4..dff24940 100644 ---- a/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java -+++ b/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java -@@ -243,6 +243,7 @@ public final class SignalWebSocket { - while (true) { - WebSocketRequestMessage request = getWebSocket().readRequest(timeout); - WebSocketResponseMessage response = createWebSocketResponse(request); -+ boolean sendResponse = true; // indicates the acknowledgement should be sent to the server - try { - if (isSignalServiceEnvelope(request)) { - Optional timestampHeader = findHeader(request); -@@ -258,13 +259,19 @@ public final class SignalWebSocket { - - SignalServiceEnvelope envelope = new SignalServiceEnvelope(request.getBody().toByteArray(), timestamp); - -- callback.onMessage(envelope); -+ try { -+ callback.onMessage(envelope); -+ } catch (NotSavedException e) { -+ sendResponse = false; -+ } - return Optional.of(envelope); - } else if (isSocketEmptyRequest(request)) { - return Optional.empty(); - } - } finally { -- getWebSocket().sendResponse(response); -+ if(sendResponse) { -+ getWebSocket().sendResponse(response); -+ } } } - } -@@ -315,6 +322,6 @@ public final class SignalWebSocket { - * received. - */ - public interface MessageReceivedCallback { -- void onMessage(SignalServiceEnvelope envelope); -+ void onMessage(SignalServiceEnvelope envelope) throws NotSavedException; ++ ++ repositories { ++ maven { ++ url = uri(System.getenv("CI_API_V4_URL") + "/projects/" + System.getenv("CI_PROJECT_ID") + "/packages/maven") ++ name = "GitLab" ++ credentials(HttpHeaderCredentials::class) { ++ name = "Job-Token" ++ value = System.getenv("CI_JOB_TOKEN") ++ } ++ authentication { ++ create("header", HttpHeaderAuthentication::class) ++ } ++ } ++ } } } -diff --git a/settings.gradle b/settings.gradle -index 8861c008..8dd03423 100644 ---- a/settings.gradle -+++ b/settings.gradle -@@ -1,6 +1,5 @@ - enableFeaturePreview('VERSION_CATALOGS') --include ':android' - - include 'libsignal-service' - project(':libsignal-service').projectDir = file('service') +-signing { +- isRequired = gradle.taskGraph.hasTask("uploadArchives") +- sign(publishing.publications["mavenJava"]) +-} +diff --git a/settings.gradle.kts b/settings.gradle.kts +index b0de0df4..6332e1db 100644 +--- a/settings.gradle.kts ++++ b/settings.gradle.kts +@@ -1,5 +1,8 @@ + dependencyResolutionManagement { + repositories { ++ maven { ++ url = uri("https://gitlab.com/api/v4/groups/6853927/-/packages/maven") // https://gitlab.com/groups/signald/-/packages ++ } + mavenCentral() + mavenLocal() + } -- -2.30.2 +2.39.2 diff --git a/update-hashes.py b/update-hashes.py index 6c808c9..78c23c4 100644 --- a/update-hashes.py +++ b/update-hashes.py @@ -3,16 +3,16 @@ import requests import hashlib import json -VERSION = "0.17.0" +VERSION = "0.36.1" TARGETS = [ "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "arm-unknown-linux-gnueabihf", "armv7-unknown-linux-gnueabihf", "x86_64-unknown-linux-gnu", - "x86_64-apple-darwin", - "x86_64-unknown-linux-musl", - "aarch64-apple-darwin" + # "x86_64-apple-darwin", + # "x86_64-unknown-linux-musl", + # "aarch64-apple-darwin" ] urlFormat = "https://gitlab.com/api/v4/groups/6853927/-/packages/maven/org/signald/libsignal-client-{target}/{version}/libsignal-client-{target}-{version}.{ext}"