Skip to content

Commit

Permalink
Added a method for generating the javadoc and sources jars.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwernick committed Mar 21, 2015
1 parent 0284a26 commit 269480c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}

Expand Down
35 changes: 35 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven'

def versionMajor = 1
Expand Down Expand Up @@ -60,4 +61,38 @@ uploadArchives {
uniqueVersion = false // don't put in a timestamp on the filename (other project will not be able to depend on it)
}
}
}

// Use ./gradlew aRel install to build the javadoc and source jars
// The idea was pulled from https://www.virag.si/2015/01/publishing-gradle-android-library-to-jcenter/, eventually this will be the only
// mechanism to publish (vs uploadArchives above)
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
}
}
}
}

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

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.getDestinationDir()
}

artifacts {
archives javadocJar
archives sourcesJar
}

0 comments on commit 269480c

Please sign in to comment.