Skip to content
This repository was archived by the owner on Sep 3, 2023. It is now read-only.

Commit f49016b

Browse files
committed
Migrate to MavenCentral
1 parent ff91342 commit f49016b

8 files changed

+136
-55
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ buildscript {
1010

1111
dependencies {
1212
classpath deps.gradle_plugins.android
13-
classpath deps.gradle_plugins.bintray_release
1413
classpath deps.gradle_plugins.kotlin
1514
classpath deps.gradle_plugins.spotless
1615
classpath deps.gradle_plugins.versions

dependencies.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ ext.versions = [
88

99
ext.deps = [
1010
gradle_plugins: [
11-
android: "com.android.tools.build:gradle:3.5.3",
11+
android: "com.android.tools.build:gradle:4.1.2",
1212
kotlin: "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61",
1313
spotless: "com.diffplug.spotless:spotless-plugin-gradle:3.27.1",
14-
versions: "com.github.ben-manes:gradle-versions-plugin:0.27.0",
15-
bintray_release: "com.novoda:bintray-release:0.9.2",
14+
versions: "com.github.ben-manes:gradle-versions-plugin:0.27.0"
1615
],
1716

1817
androidx: [

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ org.gradle.jvmargs=-Xmx1536m
1313
# This option should only be used with decoupled projects. More details, visit
1414
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1515
# org.gradle.parallel=true
16+
android.useAndroidX=true

gradle/android_application_config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ if (module_package_id == null) {
55
throw new IllegalStateException("module_package_id is missing!")
66
}
77

8-
android.defaultConfig.applicationId = module_package_id.replace('-', '')
8+
android.defaultConfig.applicationId = module_package_id.replace('-', '')

gradle/android_bintray_config.gradle

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apply plugin: "com.android.library"
22

33
apply from: rootProject.file("gradle/android_common_config.gradle")
4-
apply from: rootProject.file("gradle/android_bintray_config.gradle")
4+
apply from: rootProject.file("gradle/android_publish_mavencentral.gradle")
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
if (versions == null || versions.publish_version == null) {
2+
throw new IllegalStateException("Unable to reference publish_version!")
3+
} else if (module_group == null || module_name == null) {
4+
throw new IllegalStateException("Must provide module_group and module_name!")
5+
}
6+
7+
apply plugin: 'maven-publish'
8+
apply plugin: 'signing'
9+
10+
task androidSourcesJar(type: Jar) {
11+
archiveClassifier.set('sources')
12+
if (project.plugins.findPlugin("com.android.library")) {
13+
// For Android libraries
14+
from android.sourceSets.main.java.srcDirs
15+
from android.sourceSets.main.kotlin.srcDirs
16+
} else {
17+
// For pure Kotlin libraries, in case you have them
18+
from sourceSets.main.java.srcDirs
19+
from sourceSets.main.kotlin.srcDirs
20+
}
21+
}
22+
23+
artifacts {
24+
archives androidSourcesJar
25+
}
26+
27+
group = module_group
28+
version = versions.publish_version
29+
30+
// Default values
31+
ext["signing.keyId"] = ''
32+
ext["signing.password"] = ''
33+
ext["signing.secretKeyRingFile"] = ''
34+
ext["ossrhUsername"] = ''
35+
ext["ossrhPassword"] = ''
36+
ext["sonatypeStagingProfileId"] = ''
37+
38+
File secretPropsFile = project.rootProject.file('local.properties')
39+
if (secretPropsFile.exists()) {
40+
Properties p = new Properties()
41+
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
42+
p.each { name, value -> ext[name] = value }
43+
} else {
44+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
45+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
46+
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
47+
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
48+
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
49+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
50+
}
51+
52+
publishing {
53+
publications {
54+
release(MavenPublication) {
55+
// The coordinates of the library, being set from variables that
56+
// we'll set up later
57+
groupId module_group
58+
artifactId module_name
59+
version versions.publish_version
60+
61+
// Two artifacts, the `aar` (or `jar`) and the sources
62+
if (project.plugins.findPlugin("com.android.library")) {
63+
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
64+
} else {
65+
artifact("$buildDir/libs/${project.getName()}-${version}.jar")
66+
}
67+
artifact androidSourcesJar
68+
69+
// Mostly self-explanatory metadata
70+
pom {
71+
packaging 'aar'
72+
name = module_name
73+
description = '😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.'
74+
url = 'https://github.com/afollestad/material-dialogs'
75+
licenses {
76+
license {
77+
name = 'Apache 2.0 License'
78+
url = 'https://github.com/afollestad/material-dialogs/blob/main/LICENSE.md'
79+
}
80+
}
81+
developers {
82+
developer {
83+
id = 'afollestad'
84+
name = 'Aidan Follestad'
85+
86+
}
87+
// Add all other devs here...
88+
}
89+
// Version control info - if you're using GitHub, follow the format as seen here
90+
scm {
91+
connection = 'scm:git:github.com/afollestad/material-dialogs.git'
92+
developerConnection = 'scm:git:ssh://github.com/afollestad/material-dialogs.git'
93+
url = 'https://github.com/afollestad/material-dialogs/tree/main'
94+
}
95+
// A slightly hacky fix so that your POM will include any transitive dependencies
96+
// that your library builds upon
97+
withXml {
98+
def dependenciesNode = asNode().appendNode('dependencies')
99+
project.configurations.implementation.allDependencies.each {
100+
def dependencyNode = dependenciesNode.appendNode('dependency')
101+
dependencyNode.appendNode('groupId', it.group)
102+
dependencyNode.appendNode('artifactId', it.name)
103+
dependencyNode.appendNode('version', it.version)
104+
}
105+
}
106+
}
107+
}
108+
}
109+
// The repository to publish to, Sonatype/MavenCentral
110+
repositories {
111+
maven {
112+
// This is an arbitrary name, you may also use "mavencentral" or
113+
// any other name that's descriptive for you
114+
name = "sonatype"
115+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
116+
credentials {
117+
username ossrhUsername
118+
password ossrhPassword
119+
}
120+
}
121+
}
122+
}
123+
124+
signing {
125+
sign publishing.publications
126+
}
127+
128+
afterEvaluate {
129+
publishReleasePublicationToSonatypeRepository.dependsOn assembleRelease
130+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip

0 commit comments

Comments
 (0)