Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit e8bc41f

Browse files
committed
autofill-parser: configure maven-publish plugin
Signed-off-by: Harsh Shandilya <[email protected]>
1 parent e8e0cc7 commit e8bc41f

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

autofill-parser/build.gradle.kts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
plugins {
22
kotlin("android")
3+
id("maven-publish")
4+
}
5+
6+
// Type safety can sometimes suck
7+
fun getCredential(type: String): String {
8+
return when (type) {
9+
// Attempt to find credentials passed by -Pmaven.$type=
10+
"user", "password" -> (findProperty("maven.$type")
11+
// Fall back to MAVEN_$type from env
12+
?: System.getenv("MAVEN_${type.toUpperCase()}"))?.toString()
13+
// Finally fallthrough to an empty string to let task configuration complete
14+
// even if actual publishing is going to fail
15+
?: ""
16+
else -> throw IllegalArgumentException("Invalid credential type: $type")
17+
}
318
}
419

520
android {
@@ -10,6 +25,29 @@ android {
1025
}
1126
}
1227

28+
afterEvaluate {
29+
publishing {
30+
repositories {
31+
maven {
32+
name = "aps"
33+
url = uri("https://maven.msfjarvis.dev/android-password-store/${findProperty("POM_ARTIFACT_ID")}")
34+
credentials {
35+
username = getCredential("user")
36+
password = getCredential("password")
37+
}
38+
}
39+
}
40+
publications {
41+
create<MavenPublication>("apsMaven") {
42+
from(components.getByName("release"))
43+
groupId = findProperty("GROUP").toString()
44+
artifactId = findProperty("POM_ARTIFACT_ID").toString()
45+
version = findProperty("VERSION_NAME").toString()
46+
}
47+
}
48+
}
49+
}
50+
1351
dependencies {
1452
implementation(Dependencies.AndroidX.core_ktx)
1553
implementation(Dependencies.AndroidX.autofill)

autofill-parser/gradle.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
GROUP=com.github.androidpasswordstore
2+
VERSION_NAME=1.0.0
3+
POM_ARTIFACT_ID=autofill-parser
4+
5+
POM_URL=https://github.com/Android-Password-Store/android-password-store
6+
POM_SCM_URL=https://github.com/Android-Password-Store/android-password-store
7+
POM_SCM_CONNECTION=scm:git:https://github.com/Android-Password-Store/android-password-store.git
8+
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]:Android-Password-Store/android-password-store
9+
10+
POM_LICENSE_NAME=LGPL-3.0-only WITH LGPL-3.0-linking-exception
11+
POM_LICENSE_URL=https://www.gnu.org/licenses/lgpl-3.0.txt
12+
POM_LICENSE_DIST=repo
13+
14+
POM_DEVELOPER_ID=android-password-store
15+
POM_DEVELOPER_NAME=The Android Password Store Authors

settings.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@
44
*/
55
include(":autofill-parser")
66
include(":app")
7+
8+
pluginManagement {
9+
repositories {
10+
gradlePluginPortal()
11+
jcenter()
12+
}
13+
}

0 commit comments

Comments
 (0)