133 lines
3.7 KiB
Groovy

apply plugin: "java-library"
apply plugin: "kotlin"
apply plugin: "maven"
apply plugin: "signing"
sourceCompatibility = 8
targetCompatibility = 8
archivesBaseName = "signal-service-java"
version = versionNumber
group = groupName
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.googlecode.libphonenumber:libphonenumber:8.10.7"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "org.whispersystems:curve25519-java:$curve25519Version"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "org.threeten:threetenbp:1.3.6"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
//FIXME AC: If we want to keep this library to target pure Java,
// we should remove Android related dependencies.
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
testImplementation "junit:junit:3.8.2"
testImplementation "org.assertj:assertj-core:1.7.1"
testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0"
}
tasks.whenTaskAdded { task ->
if (task.name.equals("lint")) {
task.enabled = false
}
}
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return ""
}
def getRepositoryUsername() {
return ""
}
def getRepositoryPassword() {
return ""
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("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-service-java"
packaging "jar"
description "Signal Service communication library for Java"
url 'https://github.com/loki-project/loki-messenger-android-core'
scm {
url 'scm:git@github.com:loki-project/loki-messenger-android-core.git'
connection 'scm:git@github.com:loki-project/loki-messenger-android-core.git'
developerConnection 'scm:git@github.com:loki-project/loki-messenger-android-core.git'
}
licenses {
license {
name "GPLv3"
url "https://www.gnu.org/licenses/gpl-3.0.txt"
distribution "repo"
}
}
developers {
developer {
name "Niels Andriesse"
}
}
}
}
}
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"
}
}
}
task packageJavadoc(type: Jar, dependsOn: "javadoc") {
from javadoc.destinationDir
classifier = "javadoc"
}
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = "sources"
}
artifacts {
archives packageJavadoc
archives packageSources
}