From e8bc41f1aa6a2ec61976b3e75124c66c509ba9c7 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 20 Sep 2020 16:54:38 +0530 Subject: autofill-parser: configure maven-publish plugin Signed-off-by: Harsh Shandilya --- autofill-parser/build.gradle.kts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'autofill-parser/build.gradle.kts') diff --git a/autofill-parser/build.gradle.kts b/autofill-parser/build.gradle.kts index be90cd0a..23d3e304 100644 --- a/autofill-parser/build.gradle.kts +++ b/autofill-parser/build.gradle.kts @@ -1,5 +1,20 @@ plugins { kotlin("android") + id("maven-publish") +} + +// 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") + } } android { @@ -10,6 +25,29 @@ android { } } +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("apsMaven") { + from(components.getByName("release")) + groupId = findProperty("GROUP").toString() + artifactId = findProperty("POM_ARTIFACT_ID").toString() + version = findProperty("VERSION_NAME").toString() + } + } + } +} + dependencies { implementation(Dependencies.AndroidX.core_ktx) implementation(Dependencies.AndroidX.autofill) -- cgit v1.2.3