-
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.
- Loading branch information
Showing
2 changed files
with
124 additions
and
50 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 |
---|---|---|
@@ -1,60 +1,133 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.jfrog.bintray' | ||
apply plugin: 'com.github.dcendents.android-maven' | ||
|
||
group = POM_GROUP_ID | ||
version = VERSION_NAME | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
|
||
pom{ | ||
groupId = POM_GROUP_ID | ||
artifactId = POM_ARTIFACT_ID | ||
version = VERSION_NAME + POM_PACKAGING | ||
} | ||
|
||
if (project.hasProperty("android")) { // Android libraries | ||
from components.release | ||
artifact androidSourcesJar | ||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
failOnError false | ||
source = android.sourceSets.main.kotlin.srcDirs | ||
options { | ||
links "http://docs.oracle.com/javase/7/docs/api/" | ||
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference" | ||
} | ||
classpath += project.android.libraryVariants.toList().first().javaCompile.classpath | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
} else { // Java libraries | ||
from components.java | ||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from sourceSets.main.java.srcDirs | ||
} | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives javadocJar | ||
archives sourcesJar | ||
} | ||
afterEvaluate { project -> | ||
install { | ||
repositories.mavenInstaller { | ||
configurePOM(pom); | ||
} | ||
} | ||
|
||
if (project.hasProperty("android")) { // Android libraries | ||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.srcDirs | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
failOnError false | ||
source = android.sourceSets.main.java.srcDirs | ||
options { | ||
links "http://docs.oracle.com/javase/7/docs/api/" | ||
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference" | ||
} | ||
classpath += project.android.libraryVariants.toList().first().javaCompile.classpath | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
} else { // Java libraries | ||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from sourceSets.main.java.srcDirs | ||
} | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives javadocJar | ||
archives sourcesJar | ||
} | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
from android.sourceSets.main.java.srcDirs | ||
private configurePOM(def pom) { | ||
pom.project { | ||
packaging POM_PACKAGING | ||
groupId POM_GROUP_ID | ||
artifactId POM_ARTIFACT_ID | ||
|
||
name POM_NAME | ||
description POM_DESCRIPTION | ||
url POM_URL | ||
|
||
version VERSION_NAME | ||
inceptionYear POM_INCEPTION_YEAR | ||
|
||
licenses { | ||
license { | ||
name POM_LICENCE_NAME | ||
url POM_LICENCE_URL | ||
distribution POM_LICENCE_DIST | ||
comments POM_LICENCE_COMMENTS | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id POM_DEVELOPER_ID | ||
name POM_DEVELOPER_NAME | ||
// email POM_DEVELOPER_EMAIL | ||
// url POM_DEVELOPER_URL | ||
} | ||
} | ||
|
||
scm { | ||
url POM_SCM_URL | ||
connection POM_SCM_CONNECTION | ||
developerConnection POM_SCM_DEV_CONNECTION | ||
} | ||
|
||
issueManagement { | ||
system POM_ISSUE_MANAGEMENT_SYSTEM | ||
url POM_ISSUE_MANAGEMENT_URL | ||
} | ||
} | ||
} | ||
|
||
// Default Bintray | ||
def getRepositoryUser() { | ||
return hasProperty('BINTRAY_USER') ? BINTRAY_USER : "" | ||
} | ||
|
||
def getRepositoryKey() { | ||
return hasProperty('BINTRAY_KEY') ? BINTRAY_KEY : "" | ||
} | ||
|
||
def getRepositoryGPGPassword() { | ||
return hasProperty('BINTRAY_GPG_PASSWORD') ? BINTRAY_GPG_PASSWORD : "" | ||
} | ||
|
||
bintray { | ||
user = getRepositoryUser(); | ||
key = getRepositoryKey(); | ||
|
||
group = POM_GROUP_ID | ||
version = VERSION_NAME | ||
|
||
configurations = ['archives'] | ||
|
||
pkg { | ||
repo = POM_BINTRAY_PRPO | ||
name = POM_BINTRAY_NAME | ||
desc = POM_DESCRIPTION | ||
websiteUrl = POM_URL | ||
vcsUrl = POM_GIT_URL | ||
licenses = POM_LICENCE_ALL | ||
publish = true | ||
publicDownloadNumbers = true | ||
version { | ||
desc = POM_DESCRIPTION | ||
gpg { | ||
sign = !(getRepositoryGPGPassword() == null || getRepositoryGPGPassword() == ""); | ||
// true //Determines whether to GPG sign the files. The default is false | ||
passphrase = getRepositoryGPGPassword(); | ||
//Optional. The passphrase for GPG signing' | ||
} | ||
} | ||
} | ||
} |