summaryrefslogtreecommitdiff
path: root/autofill-parser
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-09-20 16:54:38 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-09-20 17:12:03 +0530
commite8bc41f1aa6a2ec61976b3e75124c66c509ba9c7 (patch)
tree502ee972a1bf84bc71d9d92c5a818bdedefc88e0 /autofill-parser
parente8e0cc791ffa92a9487d4bf2e1831f9ce34ee687 (diff)
autofill-parser: configure maven-publish plugin
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'autofill-parser')
-rw-r--r--autofill-parser/build.gradle.kts38
-rw-r--r--autofill-parser/gradle.properties15
2 files changed, 53 insertions, 0 deletions
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<MavenPublication>("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)
diff --git a/autofill-parser/gradle.properties b/autofill-parser/gradle.properties
new file mode 100644
index 00000000..24371c01
--- /dev/null
+++ b/autofill-parser/gradle.properties
@@ -0,0 +1,15 @@
+GROUP=com.github.androidpasswordstore
+VERSION_NAME=1.0.0
+POM_ARTIFACT_ID=autofill-parser
+
+POM_URL=https://github.com/Android-Password-Store/android-password-store
+POM_SCM_URL=https://github.com/Android-Password-Store/android-password-store
+POM_SCM_CONNECTION=scm:git:https://github.com/Android-Password-Store/android-password-store.git
+POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:Android-Password-Store/android-password-store
+
+POM_LICENSE_NAME=LGPL-3.0-only WITH LGPL-3.0-linking-exception
+POM_LICENSE_URL=https://www.gnu.org/licenses/lgpl-3.0.txt
+POM_LICENSE_DIST=repo
+
+POM_DEVELOPER_ID=android-password-store
+POM_DEVELOPER_NAME=The Android Password Store Authors