Files
yoga/scripts/build_natives_for_gradle.sh
Robert Spencer 57898762a2 Bump NDK version and build all architectures
Summary: Until now we've been building only arm-v7 and x86 libraries.  This builds 64 bit versions too, and sets up the gradle script to publish them.  We also bump up the NDK version, and increase the min API to 21, as this is the first API supporting 64 bit NDK tools.

Reviewed By: emilsjolander

Differential Revision: D4674049

fbshipit-source-id: fbc87541fcaf72b83d376646c7aab70c317125e1
2017-03-09 03:12:42 -08:00

40 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
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"
)
# 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"
~/mybuck/bin/buck build //android/sample:sample
cp "../buck-out/gen/android/sample/sample#X86,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[0]}"
cp "../buck-out/gen/android/sample/sample#X86_64,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[1]}"
cp "../buck-out/gen/android/sample/sample#ARMV7,android-strip,libgnustl_shared.so/libgnustl_shared.so" "${DESTINATIONS[2]}"
cp "../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.
~/mybuck/bin/buck clean
rm -r ../buck-out
for (( i=0; i<4; i++ ));
do
echo "Build ${BUCK_TARGETS[i]}"
buck build "//java:jni#${BUCK_TARGETS[i]},shared"
mkdir -p ${DESTINATIONS[i]}
cp "../buck-out/gen/java/jni#${BUCK_TARGETS[i]},shared/libyoga.so" "${DESTINATIONS[i]}"
cp "../buck-out/gen/yoga#${BUCK_TARGETS[i]},shared/libyogacore.so" "${DESTINATIONS[i]}"
cp "../buck-out/gen/lib/fb/fbjni#${BUCK_TARGETS[i]},shared/liblib_fb_fbjni.so" "${DESTINATIONS[i]}"
done