Skip to content

Commit aaf4f79

Browse files
authored
Plugin/sdk 4764/vanniktech publish plugin (#822)
* task(SDK-4764) - Adds configuration to publish using vanniktech plugin to central portal * task(SDK-4764) - Adds configuration to publish using vanniktech plugin to central portal * plugin(SDK-4764) - Vanniktech plugin for publishing
1 parent fcbfc25 commit aaf4f79

File tree

3 files changed

+33
-78
lines changed

3 files changed

+33
-78
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buildscript {
1616
classpath(libs.kotlin.gradle.plugin)
1717
classpath(libs.google.services)
1818
classpath(libs.huawei.agcp.plugin)
19+
classpath(libs.vanniktech.maven.publish)
1920
}
2021
}
2122

gradle-scripts/commons.gradle

Lines changed: 28 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'maven-publish'
4-
apply plugin: 'signing'
3+
apply plugin: 'com.vanniktech.maven.publish'
54
apply from: "${project.rootDir}/gradle-scripts/jacoco_root.gradle"
65
apply from: "${project.rootDir}/gradle-scripts/checkstyle.gradle"
76
apply from: "${project.rootDir}/gradle-scripts/detekt.gradle"
87

98
ext {
10-
Repo = 'Maven'
119
publishedGroupId = 'com.clevertap.android'
1210

1311
siteUrl = 'https://github.com/CleverTap/clevertap-android-sdk'
@@ -18,13 +16,6 @@ ext {
1816
developerEmail = '[email protected]'
1917
}
2018

21-
ext["signing.keyId"] = ''
22-
ext["signing.password"] = ''
23-
ext["signing.secretKeyRingFile"] = ''
24-
ext["ossrhUsername"] = ''
25-
ext["ossrhPassword"] = ''
26-
ext["sonatypeStagingProfileId"] = ''
27-
2819
version = libraryVersion
2920
group = publishedGroupId
3021

@@ -100,82 +91,41 @@ if (project.rootProject.file('local.properties').exists()) {
10091
properties.each { name, value ->
10192
ext[name] = value
10293
}
103-
}else{
104-
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
105-
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
106-
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
107-
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
108-
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
109-
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
110-
}
111-
112-
task sourcesJar(type: Jar) {
113-
archiveBaseName.set("$artifact")
114-
from android.sourceSets.main.java.srcDirs
115-
archiveClassifier.set('sources')
11694
}
11795

118-
artifacts {
119-
archives sourcesJar
120-
}
12196

12297
afterEvaluate {
123-
publishing {
124-
publications {
125-
// Creates a Maven publication called "release".
126-
release(MavenPublication) {
127-
// Applies the component for the release build variant.
128-
from components.release
129-
130-
// You can then customize attributes of the publication as shown below.
131-
groupId publishedGroupId
132-
artifactId artifact
133-
version version
134-
135-
pom {
136-
name = artifact
137-
description = libraryDescription
138-
url = siteUrl
139-
packaging = "aar"
140-
licenses {
141-
license {
142-
name = licenseName
143-
url = licenseUrl
144-
}
145-
}
146-
developers {
147-
developer {
148-
id = developerId
149-
name = developerName
150-
email = developerEmail
151-
}
152-
// Add all other devs here...
153-
}
154-
// Version control info - if you're using GitHub, follow the format as seen here
155-
scm {
156-
connection = 'scm:git:github.com/CleverTap/clevertap-android-sdk.git'
157-
developerConnection = 'scm:git:ssh:github.com/CleverTap/clevertap-android-sdk.git'
158-
url = 'https://github.com/CleverTap/clevertap-android-sdk/tree/master'
159-
}
98+
mavenPublishing {
99+
publishToMavenCentral("CENTRAL_PORTAL")
100+
signAllPublications()
101+
102+
coordinates(publishedGroupId, artifact, libraryVersion)
103+
104+
pom {
105+
name.set("$artifact")
106+
description.set("$libraryDescription")
107+
url.set(siteUrl)
108+
109+
licenses {
110+
license {
111+
name.set(licenseName)
112+
url.set(licenseUrl)
160113
}
161114
}
162-
}
163-
// The repository to publish to, Sonatype/MavenCentral
164-
repositories {
165-
maven {
166-
// This is an arbitrary name, you may also use "mavencentral" or
167-
// any other name that's descriptive for you
168-
name = Repo
169-
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
170-
credentials {
171-
username ossrhUsername
172-
password ossrhPassword
115+
116+
developers {
117+
developer {
118+
id.set(developerId)
119+
name.set(developerName)
120+
email.set(developerEmail)
173121
}
174122
}
123+
124+
scm {
125+
connection.set("scm:git:$gitUrl")
126+
developerConnection.set("scm:git:$gitUrl")
127+
url.set(siteUrl)
128+
}
175129
}
176130
}
177131
}
178-
179-
signing {
180-
sign publishing.publications
181-
}

gradle/libs.versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sonarqube_plugin = "3.3"
88
android_buildTools = "34.0.0"
99
detekt_gradle_plugin = "1.23.3"
1010
firebase_gradle_crashlytics = "3.0.2"
11+
vanniktech_maven_pulish_plugin = "0.32.0"
1112

1213
# AndroidX
1314
annotation = "1.8.2"
@@ -156,6 +157,9 @@ google_services = { module = "com.google.gms:google-services", version.ref = "go
156157
huawei_agcp_plugin = { module = "com.huawei.agconnect:agcp", version.ref = "agcp" }
157158
huawei_push = { module = "com.huawei.hms:push", version.ref = "push" }
158159

160+
161+
vanniktech_maven_publish = { module = "com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin", version.ref = "vanniktech_maven_pulish_plugin" }
162+
159163
[bundles]
160164
exoplayer = ["exoplayer_exoplayer", "exoplayer_hls", "exoplayer_ui"]
161165
media3 = ["media3_exoplayer", "media3_hls", "media3_ui"]

0 commit comments

Comments
 (0)