forked from gabrielemariotti/cardslib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script gradle to push in Maven Central as aar
- Loading branch information
1 parent
b5c3203
commit a1a85e2
Showing
6 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:0.5.+' | ||
} | ||
} | ||
|
||
def isReleaseBuild() { | ||
return version.contains("SNAPSHOT") == false | ||
} | ||
|
||
allprojects { | ||
version = VERSION_NAME | ||
group = GROUP | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
apply plugin: 'android-reporting' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
VERSION_NAME=0.2.1-SNAPSHOT | ||
VERSION_CODE=5 | ||
GROUP=com.github.gabrielemariotti.cards | ||
|
||
POM_DESCRIPTION=Android Library to build a UI Card | ||
POM_URL=https://github.com/gabrielemariotti/cardslib | ||
POM_SCM_URL=https://github.com/gabrielemariotti/cardslib | ||
POM_SCM_CONNECTION=scm:[email protected]:gabrielemariotti/cardslib.git | ||
POM_SCM_DEV_CONNECTION=scm:[email protected]:gabrielemariotti/cardslib.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=gabrielemariotti | ||
POM_DEVELOPER_NAME=Gabriele Mariotti |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
POM_NAME=Card Library | ||
POM_ARTIFACT_ID=library | ||
POM_PACKAGING=aar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
def sonatypeRepositoryUrl | ||
if (isReleaseBuild()) { | ||
println 'RELEASE BUILD' | ||
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
} else { | ||
println 'DEBUG BUILD' | ||
sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
|
||
afterEvaluate { project -> | ||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
pom.artifactId = POM_ARTIFACT_ID | ||
|
||
repository(url: sonatypeRepositoryUrl) { | ||
authentication(userName: nexusUsername, password: nexusPassword) | ||
} | ||
|
||
pom.project { | ||
name POM_NAME | ||
packaging POM_PACKAGING | ||
description POM_DESCRIPTION | ||
url POM_URL | ||
|
||
scm { | ||
url POM_SCM_URL | ||
connection POM_SCM_CONNECTION | ||
developerConnection POM_SCM_DEV_CONNECTION | ||
} | ||
|
||
licenses { | ||
license { | ||
name POM_LICENCE_NAME | ||
url POM_LICENCE_URL | ||
distribution POM_LICENCE_DIST | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id POM_DEVELOPER_ID | ||
name POM_DEVELOPER_NAME | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
task androidJavadocs(type: Javadoc) { | ||
source = android.sourceSets.main.allJava | ||
} | ||
|
||
task androidJavadocsJar(type: Jar) { | ||
classifier = 'javadoc' | ||
//basename = artifact_id | ||
from androidJavadocs.destinationDir | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
//basename = artifact_id | ||
from android.sourceSets.main.allSource | ||
} | ||
|
||
artifacts { | ||
//archives packageReleaseJar | ||
archives androidSourcesJar | ||
archives androidJavadocsJar | ||
} | ||
} |