Skip to content

Commit

Permalink
Add tasks for publishing to maven
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorth committed Nov 6, 2016
1 parent e7ac8ce commit 06fe4d4
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
*.iml
.gradle
gradle.properties
local.properties
.DS_Store
build
/captures
74 changes: 74 additions & 0 deletions DeviceAutomator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'

android {
compileSdkVersion 25
Expand Down Expand Up @@ -27,3 +29,75 @@ dependencies {
testCompile 'org.robolectric:robolectric:3.1.2'
testCompile 'org.mockito:mockito-core:1.10.19'
}

/* maven deploy + signing */
task javadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocsJar(type: Jar, dependsOn: javadocs) {
classifier = 'javadoc'
from javadocs.destinationDir
}

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

artifacts {
archives javadocsJar
archives sourcesJar
}

signing {
sign configurations.archives
}

def sonatypeUsername = System.properties.containsKey('sonatypeUsername') ? System.properties['sonatypeUsername'] : ''
def sonatypePassword = System.properties.containsKey('sonatypePassword') ? System.properties['sonatypePassword'] : ''

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

repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}

pom.setArtifactId 'device-automator'

pom.project {
name 'device-automator'
groupId 'com.lukekorth'
version android.defaultConfig.versionName
packaging 'jar'
description 'An easy to use, Espresso like, syntax on top of the Android UI Automator testing framework'
url 'https://github.com/lkorth/device-automator'

scm {
url 'scm:[email protected]:lkorth/device-automator.git'
connection 'scm:[email protected]:lkorth/device-automator.git'
developerConnection 'scm:[email protected]:lkorth/device-automator.git'
}

licenses {
license {
name 'The MIT License (MIT)'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}

developers {
developer {
id 'lkorth'
name 'Luke Korth'
}
}
}
}
}
}

0 comments on commit 06fe4d4

Please sign in to comment.