Begone buckBuildAndCopy!
Summary: I'm actually quite excited about this one! No more buck shelling out for building the Yoga AARs/JARs via Gradle. It's now all done via Gradle. This commit is the only one that should actually change anything about the entry points to the gradle builds and release process. **So if anything goes wrong with the next release, reverting this one here should be enough!** Reviewed By: emilsjolander Differential Revision: D4913600 fbshipit-source-id: 4a54562ad5be69f62a7781d43fddad211f99ab25
This commit is contained in:
committed by
Facebook Github Bot
parent
034ab0b3b1
commit
6be1c2cdb4
40
java/CMakeLists.txt
Normal file
40
java/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.1)
|
||||||
|
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
||||||
|
# configure import libs
|
||||||
|
set(libfb_DIR ${CMAKE_SOURCE_DIR}/../lib/fb/src/main/cpp)
|
||||||
|
set(yogacore_DIR ${CMAKE_SOURCE_DIR}/..)
|
||||||
|
|
||||||
|
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
|
||||||
|
|
||||||
|
set(libfb_build_DIR ${build_DIR}/libfb/${ANDROID_ABI})
|
||||||
|
set(yogacore_build_DIR ${build_DIR}/yogacore/${ANDROID_ABI})
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY ${build_DIR})
|
||||||
|
|
||||||
|
add_subdirectory(${libfb_DIR} ${libfb_build_DIR})
|
||||||
|
add_subdirectory(${yogacore_DIR} ${yogacore_build_DIR})
|
||||||
|
|
||||||
|
add_compile_options(
|
||||||
|
-fno-omit-frame-pointer
|
||||||
|
-fexceptions
|
||||||
|
-Wall
|
||||||
|
-std=c++11)
|
||||||
|
|
||||||
|
add_library(yoga SHARED jni/YGJNI.cpp)
|
||||||
|
|
||||||
|
target_include_directories(yoga PRIVATE
|
||||||
|
${libfb_DIR}/include
|
||||||
|
${yogacore_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(yoga yogacore fb)
|
@@ -6,12 +6,6 @@ apply plugin: 'maven-publish'
|
|||||||
version = '1.4.2'
|
version = '1.4.2'
|
||||||
group = 'com.facebook.yoga'
|
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 "$rootDir/scripts/build_natives_for_gradle.sh"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion rootProject.compileSdkVersion
|
compileSdkVersion rootProject.compileSdkVersion
|
||||||
buildToolsVersion rootProject.buildToolsVersion
|
buildToolsVersion rootProject.buildToolsVersion
|
||||||
@@ -19,6 +13,22 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion rootProject.minSdkVersion
|
minSdkVersion rootProject.minSdkVersion
|
||||||
targetSdkVersion rootProject.targetSdkVersion
|
targetSdkVersion rootProject.targetSdkVersion
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path 'CMakeLists.txt'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -36,8 +46,6 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preBuild.dependsOn buckBuildAndCopy
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.code.findbugs:jsr305:3.0.1'
|
compile 'com.google.code.findbugs:jsr305:3.0.1'
|
||||||
compile 'com.facebook.soloader:soloader:0.2.0'
|
compile 'com.facebook.soloader:soloader:0.2.0'
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
BASEDIR=$(dirname $0)
|
|
||||||
|
|
||||||
DESTINATIONS=(
|
|
||||||
"build/buck-out/jniLibs/x86"
|
|
||||||
"build/buck-out/jniLibs/x86_64"
|
|
||||||
"build/buck-out/jniLibs/armeabi-v7a"
|
|
||||||
"build/buck-out/jniLibs/arm64-v8a"
|
|
||||||
)
|
|
||||||
|
|
||||||
BUCK_TARGETS=(
|
|
||||||
"android-x86"
|
|
||||||
"android-x86_64"
|
|
||||||
"android-armv7"
|
|
||||||
"android-arm64"
|
|
||||||
)
|
|
||||||
|
|
||||||
for (( i=0; i<4; i++ ));
|
|
||||||
do
|
|
||||||
mkdir -p "${DESTINATIONS[i]}"
|
|
||||||
done
|
|
||||||
|
|
||||||
# There must be a better way to get gnustl_shared than building the android target.
|
|
||||||
# But for now, we include that target simply for that shared library...
|
|
||||||
echo "Build libgnustl_shared.so"
|
|
||||||
buck build //android/sample:sample
|
|
||||||
|
|
||||||
cp "$BASEDIR/../buck-out/gen/android/sample/sample#X86,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[0]}"
|
|
||||||
cp "$BASEDIR/../buck-out/gen/android/sample/sample#X86_64,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[1]}"
|
|
||||||
cp "$BASEDIR/../buck-out/gen/android/sample/sample#ARMV7,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[2]}"
|
|
||||||
cp "$BASEDIR/../buck-out/gen/android/sample/sample#ARM64,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[3]}"
|
|
||||||
|
|
||||||
# This is to clean up after the mess above. Yes, it is required.
|
|
||||||
buck clean
|
|
||||||
rm -r "$BASEDIR/../buck-out"
|
|
||||||
|
|
||||||
for (( i=0; i<4; i++ ));
|
|
||||||
do
|
|
||||||
echo "Build ${BUCK_TARGETS[i]}"
|
|
||||||
buck build "//java:jni#${BUCK_TARGETS[i]},shared"
|
|
||||||
cp "$BASEDIR/../buck-out/gen/java/jni#${BUCK_TARGETS[i]},shared/libyoga.so" "${DESTINATIONS[i]}"
|
|
||||||
cp "$BASEDIR/../buck-out/gen/yoga#${BUCK_TARGETS[i]},shared/libyogacore.so" "${DESTINATIONS[i]}"
|
|
||||||
cp "$BASEDIR/../buck-out/gen/lib/fb/fbjni#${BUCK_TARGETS[i]},shared/liblib_fb_fbjni.so" "${DESTINATIONS[i]}"
|
|
||||||
done
|
|
@@ -1,10 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
ROOTDIR="$(dirname $0)/.."
|
||||||
echo -e "\033[1;34m** We can deploy two libraries\n** (1) Java bindings to Yoga\n** (2) Android YogaLayout\n** Which do you want to ship today? \033[0m"
|
echo -e "\033[1;34m** We can deploy two libraries\n** (1) Java bindings to Yoga\n** (2) Android YogaLayout\n** Which do you want to ship today? \033[0m"
|
||||||
read -p "" -n 1 mod
|
read -p "" -n 1 mod
|
||||||
case $mod in
|
case $mod in
|
||||||
1 ) MODULE="java";;
|
1 ) MODULE="yoga";;
|
||||||
2 ) MODULE="android";;
|
2 ) MODULE="yoga-layout";;
|
||||||
* ) echo -e "\n\033[1;34m** Invalid selection" && exit
|
* ) echo -e "\n\033[1;34m** Invalid selection" && exit
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -17,12 +18,12 @@ read -r BINTRAY_KEY
|
|||||||
echo -e "\033[1;34m** [3/3] Please enter your GPG passphrase: \033[0m"
|
echo -e "\033[1;34m** [3/3] Please enter your GPG passphrase: \033[0m"
|
||||||
read -r GPG_PASS
|
read -r GPG_PASS
|
||||||
|
|
||||||
uploadcmd="gradle clean build bintrayUpload --info -PbintrayUsername='$BINTRAY_USER' -PbintrayApiKey='$BINTRAY_KEY' -PbintrayGpgPassword='$GPG_PASS'"
|
uploadcmd="$ROOTDIR/gradlew clean :${MODULE}:build bintrayUpload --info -PbintrayUsername='$BINTRAY_USER' -PbintrayApiKey='$BINTRAY_KEY' -PbintrayGpgPassword='$GPG_PASS'"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo -e "\033[1;34m** Dry run\033[0m"
|
echo -e "\033[1;34m** Dry run\033[0m"
|
||||||
|
|
||||||
(cd $MODULE ; eval "$uploadcmd -PdryRun=true")
|
eval "$uploadcmd -PdryRun=true"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo -e "\033[1;34m** Are you happy to conintue?: [yN]\033[0m"
|
echo -e "\033[1;34m** Are you happy to conintue?: [yN]\033[0m"
|
||||||
@@ -35,4 +36,4 @@ read -p "" -n 1 yn
|
|||||||
echo
|
echo
|
||||||
echo -e "\033[1;34m** Publishing\033[0m"
|
echo -e "\033[1;34m** Publishing\033[0m"
|
||||||
|
|
||||||
(cd $MODULE ; eval "$uploadcmd")
|
eval "$uploadcmd"
|
||||||
|
Reference in New Issue
Block a user