From 2292224693579052a28010ac160acec9f20fadfa Mon Sep 17 00:00:00 2001 From: signald Date: Thu, 18 Nov 2021 17:54:25 -0800 Subject: [PATCH] update gradle files --- java/build.gradle | 6 --- java/java/build.gradle | 98 +++++++----------------------------------- java/settings.gradle | 2 +- 3 files changed, 16 insertions(+), 90 deletions(-) diff --git a/java/build.gradle b/java/build.gradle index ae78254..07584d1 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -43,9 +43,3 @@ task clean(type: Delete) { } clean.dependsOn(cargoClean) -task makeAll() { - group 'Rust' - description 'Build the native libraries' - - dependsOn 'makeJniLibrariesDesktop', 'makeJniLibrariesAndroid' -} diff --git a/java/java/build.gradle b/java/java/build.gradle index 55b1ee2..8ae83c0 100644 --- a/java/java/build.gradle +++ b/java/java/build.gradle @@ -7,11 +7,10 @@ buildscript { plugins { id "de.undercouch.download" version "4.1.1" + id 'maven-publish' } apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'signing' sourceCompatibility = 1.7 archivesBaseName = "signal-client-java" @@ -24,18 +23,9 @@ repositories { } sourceSets { - test { - java { - srcDirs = ['src/test/java/', project(':tests').file('src/test/java')] - } - } otherPlatformLibraries {} } -dependencies { - testCompile ('junit:junit:4.12') -} - test { testLogging { events 'passed' @@ -67,55 +57,23 @@ def getRepositoryPassword() { return hasProperty('whisperSonatypePassword') ? whisperSonatypePassword : "" } -signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask(":java:uploadArchives") } - sign configurations.archives -} - -uploadArchives { - configuration = configurations.archives - repositories.mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - pom.project { - name 'signal-client-java' - packaging 'jar' - description 'Signal Protocol cryptography library for Java' - url 'https://github.com/signalapp/libsignal-client' - - scm { - url 'scm:git@github.com:signalapp/libsignal-client.git' - connection 'scm:git@github.com:signalapp/libsignal-client.git' - developerConnection 'scm:git@github.com:signalapp/libsignal-client.git' - } - - licenses { - license { - name 'AGPLv3' - url 'https://www.gnu.org/licenses/agpl-3.0.txt' - distribution 'repo' - } - } - - developers { - developer { - name 'Signal Messenger LLC' - } - } +publishing { + publications { + library(MavenPublication) { + from components.java + artifactId = archivesBaseName + "-" + System.getenv("TARGET") } } -} - -task installArchives(type: Upload) { - description "Installs the artifacts to the local Maven repository." - configuration = configurations['archives'] repositories { - mavenDeployer { - repository url: "file://${System.properties['user.home']}/.m2/repository" + 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) + } } } } @@ -130,36 +88,10 @@ 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) { - compileTask -> compileTask.dependsOn ':makeJniLibrariesDesktop' } diff --git a/java/settings.gradle b/java/settings.gradle index 7412250..4c0f3cd 100644 --- a/java/settings.gradle +++ b/java/settings.gradle @@ -1 +1 @@ -include ':java', ':android', ':tests' +include ':java' -- 2.20.1