Skip to content

Commit 4ae6907

Browse files
committed
Switch publishing to the Central Portal
OSSRH is shutting down soon so we need to migrate to the Central Portal for publishing. * There are no changes to those consuming this SDK, only for mainliners to publish. Add the "plugin com.vanniktech.maven.publish" plugin to publish to the Central Portal. To publish the following command must be used now: ./gradlew publishToMavenCentral --no-configuration-cache \ -PmavenCentralUsername=USER_TOKEN_USERNAME_HERE \ -PmavenCentralPassword=USER_TOKEN_PASSWORD_HERE \ -Psigning.keyId=ID_HERE \ -Psigning.password=PASSWORD_HERE \ -Psigning.secretKeyRingFile=/FULL/PATH/TO/GPG_FILE_HERE Can switch to publishAndReleaseToMavenCentral once we do a release manually and test end-to-end.
1 parent ca8fe19 commit 4ae6907

File tree

6 files changed

+38
-97
lines changed

6 files changed

+38
-97
lines changed

OneSignalSDK/onesignal/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
// however consumers look for an .aar file, which this causes it
55
// to be created.
66
id 'kotlin-android'
7+
id 'com.vanniktech.maven.publish'
78
}
89

910
android {

OneSignalSDK/onesignal/core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'com.android.library'
33
id 'kotlin-android'
44
id 'org.jlleitschuh.gradle.ktlint'
5+
id 'com.vanniktech.maven.publish'
56
}
67

78
android {

OneSignalSDK/onesignal/in-app-messages/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'com.android.library'
33
id 'kotlin-android'
44
id 'org.jlleitschuh.gradle.ktlint'
5+
id 'com.vanniktech.maven.publish'
56
}
67

78
android {

OneSignalSDK/onesignal/location/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'com.android.library'
33
id 'kotlin-android'
44
id 'org.jlleitschuh.gradle.ktlint'
5+
id 'com.vanniktech.maven.publish'
56
}
67

78
android {
Lines changed: 33 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,44 @@
1-
/**
2-
* Modified MIT License
3-
*
4-
* Copyright 2021 OneSignal
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* 1. The above copyright notice and this permission notice shall be included in
14-
* all copies or substantial portions of the Software.
15-
*
16-
* 2. All copies of substantial portions of the Software may only be used in connection
17-
* with services provided by OneSignal.
18-
*
19-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25-
* THE SOFTWARE.
26-
*/
1+
buildscript {
2+
repositories sharedRepos
3+
dependencies {
4+
classpath sharedDeps
5+
}
6+
}
277

28-
apply plugin: 'maven-publish'
29-
apply plugin: 'signing'
8+
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
9+
import com.vanniktech.maven.publish.SonatypeHost
3010

31-
class Global {
32-
static def POM_PACKAGING = 'aar'
11+
mavenPublishing {
12+
configure(new AndroidSingleVariantLibrary("release", true, true))
13+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
3314

34-
static def POM_URL = 'https://github.com/onesignal/onesignal-android-sdk'
35-
static def POM_SCM_URL = 'https://github.com/onesignal/onesignal-android-sdk'
36-
static def POM_SCM_CONNECTION = 'scm:git:https://github.com/onesignal/onesignal-android-sdk'
37-
static def POM_SCM_DEV_CONNECTION = 'scm:git:https://github.com/onesignal/onesignal-android-sdk'
38-
static def POM_LICENCE_NAME = 'MIT License'
39-
static def POM_LICENCE_URL = 'https://raw.githubusercontent.com/onesignal/onesignal-android-sdk/master/LICENSE'
40-
static def POM_LICENCE_DIST = 'repo'
41-
static def POM_DEVELOPER_ID = 'OneSignal'
42-
static def POM_DEVELOPER_NAME = 'Josh Kasten'
43-
static def SNAPSHOT_REPOSITORY_URL = 'https://oss.sonatype.org/content/repositories/snapshots'
44-
static def RELEASE_REPOSITORY_URL = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
45-
}
15+
signAllPublications()
4616

47-
def getRepositoryUsername() {
48-
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
49-
}
17+
coordinates(project.group, project.name, project.version)
5018

51-
def getRepositoryPassword() {
52-
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
53-
}
54-
55-
afterEvaluate {
56-
publishing {
57-
repositories {
58-
maven {
59-
url = Global.RELEASE_REPOSITORY_URL
60-
credentials {
61-
username = getRepositoryUsername()
62-
password = getRepositoryPassword()
63-
}
19+
pom {
20+
name = "OneSignal Android SDK"
21+
description = "OneSignal is a free email, sms, push notification, and in-app message service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal."
22+
inceptionYear = "2015"
23+
url = "https://github.com/onesignal/onesignal-android-sdk/"
24+
licenses {
25+
license {
26+
name = "Modified MIT License"
27+
url = "https://raw.githubusercontent.com/onesignal/onesignal-android-sdk/main/LICENSE"
28+
distribution = "repo"
6429
}
6530
}
66-
67-
publications {
68-
release(MavenPublication) {
69-
afterEvaluate {
70-
from components.findByName('release')
71-
}
72-
73-
pom {
74-
name = projectName
75-
description = projectDescription
76-
packaging = Global.POM_PACKAGING
77-
url = Global.POM_URL
78-
79-
scm {
80-
url = Global.POM_SCM_URL
81-
connection = Global.POM_SCM_CONNECTION
82-
developerConnection = Global.POM_SCM_DEV_CONNECTION
83-
}
84-
85-
licenses {
86-
license {
87-
name = Global.POM_LICENCE_NAME
88-
url = Global.POM_LICENCE_URL
89-
distribution = Global.POM_LICENCE_DIST
90-
}
91-
}
92-
93-
developers {
94-
developer {
95-
id = Global.POM_DEVELOPER_ID
96-
name = Global.POM_DEVELOPER_NAME
97-
}
98-
}
99-
}
31+
developers {
32+
developer {
33+
id = "OneSignal"
34+
name = "OneSignal"
35+
url = "https://github.com/OneSignal/"
10036
}
10137
}
102-
}
103-
104-
signing {
105-
required { true }
106-
sign publishing.publications.release
38+
scm {
39+
url = "https://github.com/onesignal/onesignal-android-sdk"
40+
connection = "scm:git:git://github.com/onesignal/onesignal-android-sdk.git"
41+
developerConnection = "scm:git:ssh://git@github.com/onesignal/onesignal-android-sdk.git"
42+
}
10743
}
10844
}

OneSignalSDK/onesignal/notifications/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'com.android.library'
33
id 'kotlin-android'
44
id 'org.jlleitschuh.gradle.ktlint'
5+
id 'com.vanniktech.maven.publish'
56
}
67

78
android {

0 commit comments

Comments
 (0)