0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 03:52:17 +02:00

java: Build a "testable" signal-client-java as well

This is like signal-client-java, but also contains dylibs for Mac and
Windows for testing purposes. Gradle will automatically fetch these
artifacts from the corresponding GitHub release.
This commit is contained in:
Jordan Rose 2021-10-27 18:19:05 -07:00
parent a00cfd1e90
commit c65df8524d
3 changed files with 34 additions and 2 deletions

1
.gitignore vendored
View File

@ -24,5 +24,6 @@ java/gradle.properties
java/local.properties
java/android/src/main/jniLibs
java/java/src/main/resources
java/java/src/otherPlatformLibraries/resources
.DS_Store

View File

@ -50,7 +50,11 @@ Note that both the tag *and* the branch need to be pushed.
### Android: Sonatype
Set the environment variables `SONATYPE_USERNAME`, `SONATYPE_PASSWORD`, `KEYRING_FILE`, `SIGNING_KEY`, and `SIGNING_KEY_PASSSWORD`, then run `make -C java publish_java` to build through Docker. (Sonatype is pretty slow; even after the build completes it might take a while for it to show up.)
1. Wait for the "Publish JNI Artifacts to GitHub Release" action to complete. These artifacts, though not built reproducibly, will be included in the "testable" jar that supports running on macOS and Windows as well.
2. Set the environment variables `SONATYPE_USERNAME`, `SONATYPE_PASSWORD`, `KEYRING_FILE`, `SIGNING_KEY`, and `SIGNING_KEY_PASSSWORD`.
3. Run `make -C java publish_java` to build through Docker.
Note that Sonatype is pretty slow; even after the build completes it might take a while for it to show up.
### Node: NPM

View File

@ -5,6 +5,10 @@ buildscript {
}
}
plugins {
id "de.undercouch.download" version "4.1.1"
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
@ -25,6 +29,7 @@ sourceSets {
srcDirs = ['src/test/java/', project(':tests').file('src/test/java')]
}
}
otherPlatformLibraries {}
}
dependencies {
@ -63,7 +68,7 @@ def getRepositoryPassword() {
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
required { isReleaseBuild() && gradle.taskGraph.hasTask(":java:uploadArchives") }
sign configurations.archives
}
@ -125,12 +130,34 @@ task packageSources(type: Jar) {
classifier = 'sources'
}
task testableJar(type: Jar) {
from sourceSets.main.output
from sourceSets.otherPlatformLibraries.resources
classifier = 'testable'
onlyIf { gradle.taskGraph.hasTask(':java:uploadArchives') }
def extraResources = ['signal_jni.dll', 'libsignal_jni.dylib']
def extraResourcesDir = 'src/otherPlatformLibraries/resources'
doFirst {
mkdir extraResourcesDir
extraResources.each { name ->
download {
src 'https://github.com/signalapp/libsignal-client/releases/download/v' + project.version + '/' + name
dest extraResourcesDir + '/' + name
}
}
}
}
artifacts {
archives(packageJavadoc) {
type = 'javadoc'
}
archives packageSources
archives testableJar
}
tasks.withType(JavaCompile) {