192 lines
No EOL
4.8 KiB
Groovy
192 lines
No EOL
4.8 KiB
Groovy
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'org.jetbrains.kotlin.jvm'
|
|
apply plugin: 'java-test-fixtures'
|
|
apply plugin: 'com.google.protobuf'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'org.jlleitschuh.gradle.ktlint'
|
|
apply plugin: 'com.squareup.wire'
|
|
|
|
archivesBaseName = "signal-service-java"
|
|
version = lib_signal_service_version_number
|
|
group = lib_signal_service_group_info
|
|
|
|
java {
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
sourceCompatibility = signalJavaVersion
|
|
targetCompatibility = signalJavaVersion
|
|
}
|
|
|
|
tasks.withType(KotlinCompile).configureEach {
|
|
kotlinOptions {
|
|
jvmTarget = signalKotlinJvmTarget
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
ideaTestFixturesImplementation { extendsFrom testFixturesImplementation; canBeConsumed false; canBeResolved true }
|
|
}
|
|
|
|
afterEvaluate {
|
|
[
|
|
'runKtlintCheckOverMainSourceSet',
|
|
'runKtlintFormatOverMainSourceSet'
|
|
].forEach { taskName ->
|
|
tasks.named(taskName) {
|
|
mustRunAfter tasks.named('generateMainProtos')
|
|
}
|
|
}
|
|
}
|
|
|
|
ktlint {
|
|
version.set("0.49.1")
|
|
|
|
filter {
|
|
exclude { entry ->
|
|
entry.file.toString().contains("build/generated/source/wire")
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation libs.google.protobuf.javalite
|
|
api libs.google.libphonenumber
|
|
api libs.jackson.core
|
|
api libs.jackson.module.kotlin
|
|
|
|
implementation libs.libsignal.client
|
|
api libs.square.okhttp3
|
|
api libs.square.okio
|
|
implementation libs.google.jsr305
|
|
|
|
api libs.rxjava3.rxjava
|
|
|
|
implementation libs.kotlin.stdlib.jdk8
|
|
|
|
testImplementation testLibs.junit.junit
|
|
testImplementation testLibs.assertj.core
|
|
testImplementation testLibs.conscrypt.openjdk.uber
|
|
testImplementation testLibs.mockito.core
|
|
|
|
testFixturesImplementation libs.libsignal.client
|
|
testFixturesImplementation testLibs.junit.junit
|
|
}
|
|
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name.equals("lint")) {
|
|
task.enabled = false
|
|
}
|
|
}
|
|
|
|
protobuf {
|
|
protoc {
|
|
artifact = 'com.google.protobuf:protoc:3.18.0'
|
|
}
|
|
generateProtoTasks {
|
|
all().each { task ->
|
|
task.builtins {
|
|
java {
|
|
option "lite"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
wire {
|
|
kotlin {
|
|
javaInterop = true
|
|
}
|
|
|
|
sourcePath {
|
|
srcDir 'src/main/protowire'
|
|
}
|
|
}
|
|
|
|
idea {
|
|
module {
|
|
generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
|
|
scopes.COMPILE.plus += [configurations.ideaTestFixturesImplementation]
|
|
}
|
|
}
|
|
|
|
def isReleaseBuild() {
|
|
return version.contains("SNAPSHOT") == false
|
|
}
|
|
|
|
def getReleaseRepositoryUrl() {
|
|
return hasProperty('sonatypeRepo') ? sonatypeRepo
|
|
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
|
|
}
|
|
|
|
def getRepositoryUsername() {
|
|
return hasProperty('whisperSonatypeUsername') ? whisperSonatypeUsername : ""
|
|
}
|
|
|
|
def getRepositoryPassword() {
|
|
return hasProperty('whisperSonatypePassword') ? whisperSonatypePassword : ""
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifactId = 'signal-service-java'
|
|
from components.java
|
|
|
|
pom {
|
|
name = 'signal-service-java'
|
|
packaging = 'jar'
|
|
description = 'Signal Service communication library for Java'
|
|
url = 'https://github.com/WhisperSystems/libsignal-service-java'
|
|
|
|
scm {
|
|
url = 'scm:git@github.com:WhisperSystems/libsignal-service-java.git'
|
|
connection = 'scm:git@github.com:WhisperSystems/libsignal-service-java.git'
|
|
developerConnection = 'scm:git@github.com:WhisperSystems/libsignal-service-java.git'
|
|
}
|
|
|
|
licenses {
|
|
license {
|
|
name = 'GPLv3'
|
|
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
|
|
distribution = 'repo'
|
|
}
|
|
}
|
|
|
|
developers {
|
|
developer {
|
|
name = 'Moxie Marlinspike'
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url = getReleaseRepositoryUrl()
|
|
credentials {
|
|
username getRepositoryUsername()
|
|
password getRepositoryPassword()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
signing {
|
|
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
|
|
sign publishing.publications.mavenJava
|
|
}
|
|
|
|
task installArchives(type: Upload) {
|
|
description "Installs the artifacts to the local Maven repository."
|
|
configuration = configurations['archives']
|
|
repositories {
|
|
mavenLocal()
|
|
}
|
|
} |