Skip to content

Commit 2a8809c

Browse files
authored
Merge pull request #2317 from OneSignal/publish/5.2_migrate_to_central_portal
[5.2.x] Migrate publishing to Central Portal
2 parents 7e163e8 + 4ae6907 commit 2a8809c

File tree

7 files changed

+59
-110
lines changed

7 files changed

+59
-110
lines changed

OneSignalSDK/build.gradle

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,29 @@ buildscript {
1919
ktlintVersion = '1.0.1'
2020
// DO NOT upgrade for tests, using an old version so it matches AOSP
2121
tdunningJsonForTest = '1.0'
22-
}
2322

24-
repositories {
25-
google()
26-
mavenCentral()
27-
gradlePluginPortal()
28-
// Huawei maven
29-
maven { url 'https://developer.huawei.com/repo/' }
23+
sharedRepos = {
24+
google()
25+
mavenCentral()
26+
gradlePluginPortal()
27+
// Huawei maven
28+
maven { url 'https://developer.huawei.com/repo/' }
29+
}
30+
sharedDeps = [
31+
"com.android.tools.build:gradle:$androidGradlePluginVersion",
32+
"com.google.gms:google-services:$googleServicesGradlePluginVersion",
33+
"com.huawei.agconnect:agcp:$huaweiAgconnectVersion",
34+
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion",
35+
"org.jlleitschuh.gradle:ktlint-gradle:$ktlintPluginVersion",
36+
"com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin:0.32.0"
37+
]
3038
}
31-
dependencies {
32-
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
33-
classpath "com.google.gms:google-services:$googleServicesGradlePluginVersion"
34-
classpath "com.huawei.agconnect:agcp:$huaweiAgconnectVersion"
35-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
36-
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlintPluginVersion"
39+
40+
buildscript {
41+
repositories sharedRepos
42+
dependencies {
43+
classpath sharedDeps
44+
}
3745
}
3846
}
3947

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://[email protected]/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)