2020-09-16 18:17:55 +00:00
|
|
|
plugins {
|
2020-10-16 15:18:11 +00:00
|
|
|
id("com.android.library")
|
|
|
|
id("maven-publish")
|
|
|
|
kotlin("android")
|
|
|
|
`aps-plugin`
|
2020-09-20 11:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Type safety can sometimes suck
|
|
|
|
fun getCredential(type: String): String {
|
|
|
|
return when (type) {
|
|
|
|
// Attempt to find credentials passed by -Pmaven.$type=
|
|
|
|
"user", "password" -> (findProperty("maven.$type")
|
|
|
|
// Fall back to MAVEN_$type from env
|
|
|
|
?: System.getenv("MAVEN_${type.toUpperCase()}"))?.toString()
|
|
|
|
// Finally fallthrough to an empty string to let task configuration complete
|
|
|
|
// even if actual publishing is going to fail
|
|
|
|
?: ""
|
|
|
|
else -> throw IllegalArgumentException("Invalid credential type: $type")
|
|
|
|
}
|
2020-09-16 18:17:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
defaultConfig {
|
|
|
|
versionCode = 1
|
|
|
|
versionName = "1.0"
|
|
|
|
consumerProguardFiles("consumer-rules.pro")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-20 11:24:38 +00:00
|
|
|
afterEvaluate {
|
|
|
|
publishing {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = "aps"
|
|
|
|
url = uri("https://maven.msfjarvis.dev/android-password-store/${findProperty("POM_ARTIFACT_ID")}")
|
|
|
|
credentials {
|
|
|
|
username = getCredential("user")
|
|
|
|
password = getCredential("password")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
publications {
|
|
|
|
create<MavenPublication>("apsMaven") {
|
2020-10-08 07:06:11 +00:00
|
|
|
fun getKey(propertyName: String): String {
|
|
|
|
return findProperty(propertyName)?.toString() ?: error("Failed to find property for $propertyName")
|
|
|
|
}
|
|
|
|
|
2020-09-20 11:24:38 +00:00
|
|
|
from(components.getByName("release"))
|
2020-10-08 07:06:11 +00:00
|
|
|
groupId = getKey("GROUP")
|
|
|
|
artifactId = getKey("POM_ARTIFACT_ID")
|
|
|
|
version = getKey("VERSION_NAME")
|
|
|
|
pom {
|
|
|
|
name.set(getKey("POM_ARTIFACT_ID"))
|
|
|
|
description.set(getKey("POM_ARTIFACT_DESCRIPTION"))
|
|
|
|
url.set(getKey("POM_URL"))
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name.set(getKey("POM_LICENSE_NAME"))
|
|
|
|
url.set(getKey("POM_LICENSE_URL"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id.set(getKey("POM_DEVELOPER_ID"))
|
|
|
|
name.set(getKey("POM_DEVELOPER_NAME"))
|
|
|
|
email.set(getKey("POM_DEVELOPER_EMAIL"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scm {
|
|
|
|
connection.set(getKey("POM_SCM_CONNECTION"))
|
|
|
|
developerConnection.set(getKey("POM_SCM_DEV_CONNECTION"))
|
|
|
|
url.set(getKey("POM_SCM_URL"))
|
|
|
|
}
|
|
|
|
}
|
2020-09-20 11:24:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-16 18:17:55 +00:00
|
|
|
dependencies {
|
2020-09-20 16:18:10 +00:00
|
|
|
compileOnly(Dependencies.AndroidX.annotation)
|
2020-09-16 18:17:55 +00:00
|
|
|
implementation(Dependencies.AndroidX.autofill)
|
|
|
|
implementation(Dependencies.Kotlin.Coroutines.android)
|
|
|
|
implementation(Dependencies.Kotlin.Coroutines.core)
|
|
|
|
implementation(Dependencies.ThirdParty.timberkt)
|
|
|
|
}
|