Skip to content

Commit af0eb3c

Browse files
committed
Update build process
1 parent f1339a8 commit af0eb3c

File tree

4 files changed

+46
-72
lines changed

4 files changed

+46
-72
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
plugins {
33
alias(libs.plugins.android.application) apply false
44
alias(libs.plugins.jetbrains.kotlin.android) apply false
5-
id("maven-publish")
5+
alias(libs.plugins.vanniktech.maven.publish) apply false
66
}

gradle.properties

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ kotlin.code.style=official
2020
# Enables namespacing of each library's R class so that its R class includes only the
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
23+
android.nonTransitiveRClass=true
24+
25+
# Maven Central publishing configuration
26+
# These properties are read from environment variables in CI/CD
27+
mavenCentralUsername=${SONATYPE_USERNAME}
28+
mavenCentralPassword=${SONATYPE_PASSWORD}
29+
30+
# GPG signing configuration for in-memory keys
31+
signingInMemoryKey=${SIGNING_SECRET_KEY_RING_FILE}
32+
signingInMemoryKeyId=${SIGNING_KEY_ID}
33+
signingInMemoryKeyPassword=${SIGNING_PASSWORD}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ espressoCore = "3.6.1"
88
appcompat = "1.7.0"
99
material = "1.12.0"
1010
coroutines = "1.8.1"
11+
vanniktech-maven-publish = "0.34.0"
1112

1213
[libraries]
1314
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -21,4 +22,5 @@ material = { group = "com.google.android.material", name = "material", version.r
2122
[plugins]
2223
android-application = { id = "com.android.library", version.ref = "agp" }
2324
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
25+
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-maven-publish" }
2426

supercel/build.gradle.kts

Lines changed: 32 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import groovy.json.JsonBuilder
2+
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
23

3-
buildscript {
4-
extra["awsAccessKeyId"] = System.getenv("AWS_ACCESS_KEY_ID") ?: findProperty("aws_access_key_id")
5-
extra["awsSecretAccessKey"] = System.getenv("AWS_SECRET_ACCESS_KEY") ?: findProperty("aws_secret_access_key")
6-
extra["sonatypeUsername"] = System.getenv("SONATYPE_USERNAME") ?: findProperty("sonatype_username")
7-
extra["sonatypePassword"] = System.getenv("SONATYPE_PASSWORD") ?: findProperty("sonatype_password")
8-
}
94

105
plugins {
116
alias(libs.plugins.android.application)
127
alias(libs.plugins.jetbrains.kotlin.android)
13-
id("maven-publish")
14-
id("signing")
8+
alias(libs.plugins.vanniktech.maven.publish)
159
}
1610

1711
version = "1.0.0"
@@ -20,7 +14,7 @@ android {
2014
compileSdk = 34
2115

2216
defaultConfig {
23-
minSdk = 22
17+
minSdk = 21
2418

2519
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2620

@@ -48,80 +42,48 @@ android {
4842
jvmTarget = "1.8"
4943
}
5044

51-
publishing {
52-
singleVariant("release") {
53-
withSourcesJar()
54-
}
55-
}
5645
}
5746

5847
dependencies {
5948
implementation("net.java.dev.jna:jna:5.17.0@aar")
6049
implementation(libs.coroutines)
6150
}
6251

63-
afterEvaluate {
64-
publishing {
65-
publications {
66-
create<MavenPublication>("release") {
67-
from(components["release"])
68-
groupId = "com.superwall.supercel"
69-
artifactId = "supercel"
70-
version = project.version.toString() // Set your library version
71-
72-
pom {
73-
name.set("SuperCEL")
74-
description.set("Superwall CEL Evaluator")
75-
url.set("https://superwall.com")
76-
77-
licenses {
78-
license {
79-
name.set("MIT License")
80-
url.set("https://github.com/superwall/Superwall-Android?tab=MIT-1-ov-file#")
81-
}
82-
}
83-
developers {
84-
developer {
85-
id.set("ianrumac")
86-
name.set("Ian Rumac")
87-
email.set("ian@superwall.com")
88-
}
89-
}
90-
scm {
91-
connection.set("scm:git:git@github.com:superwall/SuperCEL-Android.git")
92-
developerConnection.set("scm:git:ssh://github.com:superwall/SuperCEL-Android.git")
93-
url.set("scm:git:https://github.com/superwall/SuperCEL-Android.git")
94-
}
95-
}
52+
mavenPublishing {
53+
coordinates("com.superwall.supercel", "supercel", project.version.toString())
54+
55+
pom {
56+
name.set("SuperCEL")
57+
description.set("Superwall CEL Evaluator")
58+
inceptionYear.set("2024")
59+
url.set("https://superwall.com")
60+
licenses {
61+
license {
62+
name.set("MIT License")
63+
url.set("https://github.com/superwall/Superwall-Android?tab=MIT-1-ov-file#")
64+
distribution.set("https://github.com/superwall/Superwall-Android?tab=MIT-1-ov-file#")
9665
}
9766
}
98-
99-
repositories {
100-
mavenLocal()
101-
102-
val sonatypeUsername: String? by extra
103-
val sonatypePassword: String? by extra
104-
105-
if (sonatypeUsername != null && sonatypePassword != null) {
106-
maven {
107-
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
108-
credentials(PasswordCredentials::class.java) {
109-
username = sonatypeUsername
110-
password = sonatypePassword
111-
}
112-
}
67+
developers {
68+
developer {
69+
id.set("ianrumac")
70+
name.set("Ian Rumac")
71+
email.set("ian@superwall.com")
72+
url.set("https://superwall.com")
11373
}
11474
}
75+
scm {
76+
url.set("https://github.com/superwall/SuperCEL-Android")
77+
connection.set("scm:git:git://github.com/superwall/SuperCEL-Android.git")
78+
developerConnection.set("scm:git:ssh://git@github.com/superwall/SuperCEL-Android.git")
79+
}
11580
}
11681

117-
118-
signing {
119-
val signingKeyId: String? = System.getenv("SIGNING_KEY_ID")
120-
val signingPassword: String? = System.getenv("SIGNING_PASSWORD")
121-
val signingSecretKeyRingFile: String? = System.getenv("SIGNING_SECRET_KEY_RING_FILE")
122-
useInMemoryPgpKeys(signingKeyId, signingSecretKeyRingFile, signingPassword )
123-
sign(publishing.publications["release"])
124-
}
82+
configure(AndroidSingleVariantLibrary())
83+
84+
publishToMavenCentral()
85+
86+
signAllPublications()
12587
}
12688

12789
tasks.register("generateBuildInfo") {

0 commit comments

Comments
 (0)