forked from facebook/yoga
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This builds the java bindings with gradle, and adds a script for Facebook employees to upload the generated artifacts to JCenter. Reviewed By: emilsjolander Differential Revision: D4597335 fbshipit-source-id: 4c01695a8638000a417bfb49deba4b9b9b4e114b
- Loading branch information
1 parent
67717a7
commit 5519a73
Showing
11 changed files
with
264 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,6 @@ Pods/ | |
# Carthage/Checkouts | ||
|
||
Carthage/Build | ||
|
||
# Gradle | ||
.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:2.2.2' | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' | ||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' | ||
classpath 'com.nabilhachicha:android-native-dependencies:0.1' | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
flatDir { | ||
dirs "${rootDir}/lib/jsr-305" | ||
dirs "${rootDir}/lib/soloader" | ||
dirs "${rootDir}/lib/appcompat" | ||
dirs "${rootDir}/lib/android-support" | ||
} | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.facebook.yoga"> | ||
|
||
<application/> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
apply plugin: "com.jfrog.bintray" | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'com.github.dcendents.android-maven' | ||
apply plugin: 'maven-publish' | ||
|
||
targetCompatibility = '1.7' | ||
sourceCompatibility = '1.7' | ||
|
||
version = '1.0.0' | ||
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' | ||
} | ||
|
||
android { | ||
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'] | ||
} | ||
} | ||
} | ||
|
||
preBuild.dependsOn buckBuildAndCopy | ||
|
||
dependencies { | ||
compile(name: 'jsr305') | ||
compile(name: 'soloader-0.1.0', ext: 'aar') | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'source' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
failOnError false | ||
source = android.sourceSets.main.java.sourceFiles | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
classpath += configurations.compile | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- | ||
Copyright (c) 2014-present, Facebook, Inc. | ||
All rights reserved. | ||
This source code is licensed under the BSD-style license found in the | ||
LICENSE file in the root directory of this source tree. An additional grant | ||
of patent rights can be found in the PATENTS file in the same directory. | ||
--> | ||
|
||
<resources> | ||
<string name="app_name">Yoga</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
buck build //android:android | ||
|
||
X86_DEST=build/buck-out/jniLibs/x86 | ||
ARMV7_DEST=build/buck-out/jniLibs/armabi-v7a | ||
|
||
mkdir -p $X86_DEST | ||
mkdir -p $ARMV7_DEST | ||
|
||
cp ../buck-out/gen/java/jni#android-armv7,shared/libyoga.so $ARMV7_DEST | ||
cp ../buck-out/gen/java/jni#android-x86,shared/libyoga.so $X86_DEST | ||
|
||
cp ../buck-out/gen/yoga#android-armv7,shared/libyogacore.so $ARMV7_DEST | ||
cp ../buck-out/gen/yoga#android-x86,shared/libyogacore.so $X86_DEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo | ||
echo -e "\033[1;34m** We'll need your Bintray credentials. If you don't remember them go to https://bintray.com/profile/edit\033[0m" | ||
|
||
echo -e "\033[1;34m** [1/3] Please enter your Bintray username (probably not your email address): \033[0m" | ||
read -r BINTRAY_USER | ||
echo -e "\033[1;34m** [2/3] Please enter your Bintray API key: \033[0m" | ||
read -r BINTRAY_KEY | ||
echo -e "\033[1;34m** [3/3] Please enter your GPG passphrase: \033[0m" | ||
read -r GPG_PASS | ||
|
||
uploadcmd="gradle clean build bintrayUpload --info -PbintrayUsername='$BINTRAY_USER' -PbintrayApiKey='$BINTRAY_KEY' -PbintrayGpgPassword='$GPG_PASS'" | ||
|
||
echo | ||
echo -e "\033[1;34m** Dry run\033[0m" | ||
(cd java; eval "$uploadcmd -PdryRun=true") | ||
|
||
echo | ||
echo -e "\033[1;34m** Are you happy to conintue?: [yN]\033[0m" | ||
read -p "" -n 1 yn | ||
case $yn in | ||
[Yy]* ) ;; | ||
* ) echo -e "\n\033[1;34m** Run $0 when you're ready to try again\033[0m" && exit;; | ||
esac | ||
|
||
echo | ||
echo -e "\033[1;34m** Publishing\033[0m" | ||
eval "$uploadcmd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include ':yoga' | ||
project(':yoga').projectDir = file('java') |