-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusting graddle to support publishing to Maven
- Loading branch information
Showing
3 changed files
with
142 additions
and
2 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
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 |
---|---|---|
|
@@ -18,7 +18,144 @@ android { | |
} | ||
} | ||
|
||
ext { | ||
PUBLISH_GROUP_ID = 'com.shehabic.droppy' | ||
PUBLISH_ARTIFACT_ID = 'Droppy' | ||
PUBLISH_VERSION = '0.1' | ||
} | ||
|
||
|
||
// ./gradlew clean build generateRelease | ||
apply plugin: 'maven' | ||
|
||
def groupId = project.PUBLISH_GROUP_ID | ||
def artifactId = project.PUBLISH_ARTIFACT_ID | ||
def version = project.PUBLISH_VERSION | ||
|
||
def localReleaseDest = "file:///Users/shehabic/android/maven" | ||
|
||
task androidJavadocs(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
|
||
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { | ||
classifier = 'javadoc' | ||
from androidJavadocs.destinationDir | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.srcDirs | ||
} | ||
|
||
uploadArchives { | ||
repositories.mavenDeployer { | ||
pom.groupId = groupId | ||
pom.artifactId = artifactId | ||
pom.version = version | ||
// Add other pom properties here if you want (developer details / licenses) | ||
repository(url: "file://${localReleaseDest}") | ||
} | ||
} | ||
|
||
task zipRelease(type: Zip) { | ||
from localReleaseDest | ||
destinationDir buildDir | ||
archiveName "release-${version}.zip" | ||
} | ||
|
||
task generateReleases << { | ||
println "Release ${version} can be found at ${localReleaseDest}/" | ||
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip" | ||
} | ||
|
||
generateReleases.dependsOn(uploadArchives) | ||
generateReleases.dependsOn(zipRelease) | ||
|
||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives androidJavadocsJar | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:21.0.3' | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
group = groupId | ||
|
||
configurations { | ||
archives { | ||
extendsFrom configurations.default | ||
} | ||
} | ||
|
||
signing { | ||
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
|
||
|
||
uploadArchives { | ||
configuration = configurations.archives | ||
repositories.mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: sonatypeRepo) { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
|
||
pom.project { | ||
name 'Android Cache Library' | ||
packaging 'aar' | ||
description 'Cache library for Android applications' | ||
url 'https://github.com/shehabic/droppy' | ||
|
||
scm { | ||
url 'scm:[email protected]:shehabic/droppy.git' | ||
connection 'scm:[email protected]:shehabic/droppy.git' | ||
developerConnection 'scm:[email protected]:shehabic/droppy.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'shehabic' | ||
name 'Mohamed Shehab' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} |
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