Skip to content

Commit

Permalink
Update Maven publish script and prepare release 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ereza committed Feb 19, 2020
1 parent c25f2e8 commit 33bed14
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This library allows launching a custom activity when the app crashes, instead of
Add the following dependency to your build.gradle:
```gradle
dependencies {
compile 'cat.ereza:customactivityoncrash:2.2.0'
compile 'cat.ereza:customactivityoncrash:2.3.0'
}
```

Expand Down
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ buildscript {
}

allprojects {
version = VERSION_NAME
group = GROUP

repositories {
jcenter()
google()
Expand Down
15 changes: 0 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,5 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
VERSION_NAME=2.2.1-SNAPSHOT
VERSION_CODE=11
GROUP=cat.ereza

POM_DESCRIPTION=Android library that allows launching a custom activity when your app crashes, instead of showing the hated "Unfortunately, X has stopped" dialog.
POM_URL=https://github.com/Ereza/CustomActivityOnCrash
POM_SCM_URL=https://github.com/Ereza/CustomActivityOnCrash.git
POM_SCM_CONNECTION=scm:git@github.com:Ereza/CustomActivityOnCrash.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:Ereza/CustomActivityOnCrash.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=Ereza
POM_DEVELOPER_NAME=Eduard Ereza Martínez

android.useAndroidX=true
android.enableJetifier=true
10 changes: 8 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ android {
minSdkVersion 14
targetSdkVersion 29
versionCode 11
versionName "2.2.1-SNAPSHOT"
versionName "2.3.0"
}
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
ext {
PUBLISH_GROUP_ID = 'cat.ereza'
PUBLISH_ARTIFACT_ID = 'customactivityoncrash'
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "publish-mavencentral.gradle"

dependencies {
api 'androidx.appcompat:appcompat:1.1.0'
Expand Down
3 changes: 0 additions & 3 deletions library/gradle.properties

This file was deleted.

83 changes: 83 additions & 0 deletions library/publish-mavencentral.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}

artifacts {
archives androidSourcesJar
}

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

// Two artifacts, the `aar` and the sources
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar

// Self-explanatory metadata for the most part
pom {
name = 'CustomActivityOnCrash library'
description = 'Android library that allows launching a custom activity when your app crashes, instead of showing the hated "Unfortunately, X has stopped" dialog.'
url = 'https://github.com/Ereza/CustomActivityOnCrash'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'Ereza'
name = 'Eduard Ereza Martínez'
email = 'eduard@ereza.cat'
}
}
scm {
connection = 'scm:git:github.com/Ereza/CustomActivityOnCrash.git'
developerConnection = 'scm:git:ssh://github.com/Ereza/CustomActivityOnCrash.git'
url = 'https://github.com/Ereza/CustomActivityOnCrash/tree/master'
}
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name = "sonatype"

def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}

signing {
sign publishing.publications
}
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 14
targetSdkVersion 29
versionCode 11
versionName "2.2.1-SNAPSHOT"
versionName "2.3.0"
}
buildTypes {
debug {
Expand Down

0 comments on commit 33bed14

Please sign in to comment.