Skip to content

Instantly share code, notes, and snippets.

@tleyden
Created December 20, 2013 01:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tleyden/8048897 to your computer and use it in GitHub Desktop.
Save tleyden/8048897 to your computer and use it in GitHub Desktop.
build.gradle file
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android-library'
apply plugin: 'maven'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
// this library is only needed by test code (95% certain), and therefore
// instrumentTestCompile is used rather than compile.
instrumentTestCompile 'commons-io:commons-io:2.0.1'
// as discovered by trial and error, the build will fail if "compile" is
// used: Error: duplicate files during packaging of APK. I guess it is
// being implicitly included by being in the libs folder, and then "double included"
// because of a "compile" directive to explicitly include the jar.
instrumentTestCompile fileTree(dir: 'libs', include: 'td_collator_so.jar')
compile 'org.codehaus.jackson:jackson-core-asl:1.9.2'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.2'
}
android {
packagingOptions {
exclude 'META-INF/ASL2.0'
}
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 16
}
}
task createMavenDirectory(type: Exec) {
ext {
uploadUser = System.getenv("UPLOAD_USERNAME") + ":" + System.getenv("UPLOAD_PASSWORD")
mkcolPath = System.getenv("UPLOAD_MAVEN_REPO_URL") + "com/couchbase/cblite/CBLite/" + System.getenv("UPLOAD_VERSION_CBLITE") + "/"
}
commandLine "curl", "--user", uploadUser, "-X", "MKCOL", mkcolPath
}
// this hack is only needed for apache mod_dav based Maven repo's like file.couchbase.com. otherwise, skip it
createMavenDirectory.onlyIf { System.getenv("UPLOAD_MAVEN_REPO_URL").contains("files") }
task uploadArchivesWrapper(dependsOn: createMavenDirectory) << {
uploadArchives.execute()
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: System.getenv("UPLOAD_MAVEN_REPO_URL")) {
authentication(userName: System.getenv("UPLOAD_USERNAME"), password: System.getenv("UPLOAD_PASSWORD"))
}
pom.version = System.getenv("UPLOAD_VERSION_CBLITE")
pom.groupId = 'com.couchbase.cblite'
pom.artifactId = 'CBLite'
pom.project {
licenses {
license {
name 'Couchbase Community Edition License Agreement'
url 'http://www.couchbase.com/agreement/community'
distribution 'repo'
}
}
}
}
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task generateJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment