Gradle for android library

Summary: Adds a buildscript for gradle as well as bintray upload capabilities for the YogaLayout library

Reviewed By: emilsjolander

Differential Revision: D4604712

fbshipit-source-id: bacbcc20b7ed6ee8689130287a48bd5d3826298c
This commit is contained in:
Robert Spencer
2017-02-23 04:57:18 -08:00
committed by Facebook Github Bot
parent 5519a73087
commit 60ffa1953b
5 changed files with 178 additions and 107 deletions

View File

@@ -12,43 +12,43 @@ group = 'com.facebook.yoga'
// We currently build the native libraries with buck and bundle them together
// at this point into the AAR
task buckBuildAndCopy(type: Exec) {
commandLine '../scripts/build_natives_for_gradle.sh'
commandLine '../scripts/build_natives_for_gradle.sh'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
java.srcDir 'com'
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
jniLibs.srcDirs = ['build/buck-out/jniLibs']
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
java.srcDir 'com'
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
jniLibs.srcDirs = ['build/buck-out/jniLibs']
}
}
}
}
preBuild.dependsOn buckBuildAndCopy
dependencies {
compile(name: 'jsr305')
compile(name: 'soloader-0.1.0', ext: 'aar')
compile(name: 'jsr305')
compile(name: 'soloader-0.1.0', ext: 'aar')
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'source'
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
@@ -64,85 +64,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
}
ext {
bintrayRepo = 'maven'
bintrayUserOrg = 'facebook'
bintrayName = "com.facebook.yoga:yoga"
siteURL = "https://facebook.github.io/yoga/"
projectLicenses = {
license {
name 'BSD License'
url 'https://github.com/facebook/yoga/blob/master/LICENSE'
distribution 'repo'
}
}
}
def pomConfig = {
licenses {
// TODO Can we grab this from above?
license {
name 'BSD License'
url 'https://github.com/facebook/yoga/blob/master/LICENSE'
distribution 'repo'
}
}
}
publishing {
publications {
yoga(MavenPublication) {
groupId group
artifact(sourcesJar)
artifact(javadocJar)
pom.withXml {
def root = asNode()
root.appendNode('name', 'Yoga')
root.appendNode('url', siteURL)
root.children().last() + pomConfig
}
}
}
}
bintray {
user = getBintrayUsername()
key = getBintrayApiKey()
publications = ['yoga']
configurations = ['archives']
pkg {
repo = bintrayRepo
userOrg = bintrayUserOrg
name = bintrayName
dryRun = dryRunOnly()
licenses = projectLicenses
override = true
publish = true
publicDownloadNumbers = true
version {
name = version
released = new Date()
gpg {
sign = true
passphrase = getBintrayGpgPassword()
}
}
}
}
def getBintrayUsername() {
return hasProperty('bintrayUsername') ? property('bintrayUsername') : System.getenv('BINTRAY_USERNAME')
}
def getBintrayApiKey() {
return hasProperty('bintrayApiKey') ? property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
}
def getBintrayGpgPassword() {
return hasProperty('bintrayGpgPassword') ? property('bintrayGpgPassword') : System.getenv('BINTRAY_GPG_PASSWORD')
}
def dryRunOnly() {
return hasProperty('dryRun') ? property('dryRun').toBoolean() : false
}
apply from: rootProject.file('gradle/android-jcenter-install.gradle')