126 lines
3.2 KiB
Groovy

apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'
archivesBaseName = "signal-service-android"
version = versionNumber
group = groupName
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
api (project(':service:java')) {
exclude group: 'org.signal', module: 'signal-metadata-java'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
}
android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
defaultConfig {
minSdkVersion androidMinSdkVersion
targetSdkVersion androidCompileSdkVersion
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${archivesBaseName}-${version}.aar"
output.outputFileName = fileName
}
}
}
}
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-android'
packaging 'aar'
description 'Signal service communication library for Android'
url 'https://github.com/loki-project/session-android-service'
scm {
url 'scm:git@github.com:loki-project/session-android-service.git'
connection 'scm:git@github.com:loki-project/session-android-service.git'
developerConnection 'scm:git@github.com:loki-project/session-android-service.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"
}
}
}