Skip to content

Commit

Permalink
Refactor the maven upload build stuff
Browse files Browse the repository at this point in the history
This also adds the required javadoc jars
  • Loading branch information
JesusFreke committed Jan 18, 2014
1 parent 0845df7 commit 1d28b32
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 79 deletions.
9 changes: 0 additions & 9 deletions baksmali/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ uploadArchives {
}
}

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

artifacts {
archives sourcesJar
}

task proguard(type: JavaExec, dependsOn: fatJar) {
def outFile = fatJar.destinationDir.getPath() + '/' + fatJar.baseName + '-' + fatJar.version + '-small' + '.' + fatJar.extension
inputs.file fatJar.archivePath
Expand Down
98 changes: 60 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ if (!('release' in gradle.startParameter.taskNames)) {
task release() {
}

// The projects that get pushed to maven
def maven_release_projects = ['smali', 'baksmali', 'dexlib2', 'util']

subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'

group = 'org.smali'
version = parent.version

ext {
Expand All @@ -93,52 +93,74 @@ subprojects {
mavenCentral()
}

signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
if (project.name in maven_release_projects) {
apply plugin: 'maven'
apply plugin: 'signing'

uploadArchives {
repositories.mavenDeployer {
configuration = configurations.archives
group = 'org.smali'

beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}

if (rootProject.hasProperty('sonatypeUsername') && rootProject.hasProperty('sonatypePassword')) {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}

artifacts {
archives javadocJar
archives sourcesJar
}

signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

uploadArchives {
repositories.mavenDeployer {
configuration = configurations.archives

beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.artifactId = project.name

pom.project {
name project.name
url 'http://smali.org'
packaging 'jar'
licenses {
license {
name 'The BSD 3-Clause License'
url 'http://opensource.org/licenses/BSD-3-Clause'
distribution 'repo'
if (rootProject.hasProperty('sonatypeUsername') && rootProject.hasProperty('sonatypePassword')) {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
scm {
connection 'scm:git:git://github.com/JesusFreke/smali.git'
developerConnection 'scm:git:git@github.com:JesusFreke/smali.git'
}
developers {
developer {
id 'jesusfreke'
name 'Ben Gruver'
email 'jesusfreke@jesusfreke.com'

pom.artifactId = project.name

pom.project {
name project.name
url 'http://smali.org'
packaging 'jar'
licenses {
license {
name 'The BSD 3-Clause License'
url 'http://opensource.org/licenses/BSD-3-Clause'
distribution 'repo'
}
}
scm {
connection 'scm:git:git://github.com/JesusFreke/smali.git'
developerConnection 'scm:git:git@github.com:JesusFreke/smali.git'
}
developers {
developer {
id 'jesusfreke'
name 'Ben Gruver'
email 'jesusfreke@jesusfreke.com'
}
}
}
}
}
}

tasks.getByPath(':release').dependsOn(uploadArchives)
tasks.getByPath(':release').dependsOn(uploadArchives)
}
}

buildscript {
Expand Down
6 changes: 1 addition & 5 deletions dexlib2/accessorTestGenerator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@ dependencies {
compile 'org.antlr:ST4:4.0.7'

testCompile 'junit:junit:4.6'
}

// this is a test-only project that we don't need to upload to maven
signArchives.enabled = false
uploadArchives.enabled = false
}
9 changes: 0 additions & 9 deletions dexlib2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ task accessorTest(type: Test, dependsOn: generateAccessorTestDex) {
classpath = project.sourceSets.accessorTest.runtimeClasspath
}

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

artifacts {
archives sourcesJar
}

uploadArchives {
repositories.mavenDeployer {
pom.project {
Expand Down
9 changes: 0 additions & 9 deletions smali/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,6 @@ uploadArchives {
}
}

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

artifacts {
archives sourcesJar
}

task proguard(type: JavaExec, dependsOn: fatJar) {
def outFile = fatJar.destinationDir.getPath() + '/' + fatJar.baseName + '-' + fatJar.version + '-small' + '.' + fatJar.extension
inputs.file fatJar.archivePath
Expand Down
9 changes: 0 additions & 9 deletions util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ dependencies {
testCompile depends.junit
}

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

artifacts {
archives sourcesJar
}

uploadArchives {
repositories.mavenDeployer {
pom.project {
Expand Down

0 comments on commit 1d28b32

Please sign in to comment.