Skip to content

Commit

Permalink
ci: Github action fixes and mobile_build script cleanup (#3073)
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Jul 14, 2021
2 parents c3a60dc + 17a60e4 commit def5de6
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 77 deletions.
6 changes: 3 additions & 3 deletions base_layer/wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ blake2 = "0.9.0"
chrono = { version = "0.4.6", features = ["serde"]}
crossbeam-channel = "0.3.8"
digest = "0.9.0"
diesel_migrations = "1.4"
diesel = {version="1.4.7", features = ["sqlite", "serde_json", "chrono"]}
diesel = { version="1.4.7", features = ["sqlite", "serde_json", "chrono"]}
diesel_migrations = "1.4.0"
libsqlite3-sys = { version = ">=0.8.0, <0.13.0", features = ["bundled"], optional=true }
fs2 = "0.3.0"
futures = { version = "^0.3.1", features =["compat", "std"]}
lazy_static = "1.4.0"
libsqlite3-sys = { version = ">=0.8.0, <0.13.0", features = ["bundled"] }
log = "0.4.6"
log4rs = {version = "0.8.3", features = ["console_appender", "file_appender", "file", "yaml_format"]}
lmdb-zero = "0.4.4"
Expand Down
4 changes: 2 additions & 2 deletions base_layer/wallet_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ version = "0.17.0"
edition = "2018"

[dependencies]
tari_comms = { version = "^0.9", path = "../../comms" }
tari_comms_dht = { version = "^0.9", path = "../../comms/dht" }
tari_comms = { version = "^0.9", path = "../../comms", default-features = false}
tari_comms_dht = { version = "^0.9", path = "../../comms/dht", default-features = false }
tari_crypto = "0.11.1"
tari_key_manager = { version = "^0.9", path = "../key_manager" }
tari_p2p = { version = "^0.9", path = "../p2p" }
Expand Down
158 changes: 88 additions & 70 deletions base_layer/wallet_ffi/mobile_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NC='\033[0m' # No Color
source build.config
TARI_REPO_PATH=${TARI_REPO_PATH:-$(git rev-parse --show-toplevel)}
CURRENT_DIR=${TARI_REPO_PATH}/base_layer/wallet_ffi
cd ${CURRENT_DIR} || exit
cd "${CURRENT_DIR}" || exit
mkdir -p logs
cd logs || exit
mkdir -p ios
Expand Down Expand Up @@ -57,36 +57,39 @@ fi

DEPENDENCIES=${IOS_WALLET_PATH}
# PKG_PATH, BUILD_IOS is defined in build.config
# shellcheck disable=SC2153
if [ -n "${DEPENDENCIES}" ] && [ "${BUILD_IOS}" -eq 1 ] && [ "${MACHINE}" == "Mac" ]; then
if [ -n "${DEPENDENCIES}" ] && [ -n "${PKG_PATH}" ] && [ "${BUILD_IOS}" -eq 1 ] && [ "${MACHINE}" == "Mac" ]; then
echo "${GREEN}Commencing iOS build${NC}"
echo "${YELLOW}Build logs can be found at ${IOS_LOG_PATH}${NC}"
# shellcheck disable=SC2028
echo "\t${CYAN}Configuring Rust${NC}"
rustup target add aarch64-apple-ios x86_64-apple-ios >> ${IOS_LOG_PATH}/rust.txt 2>&1
cargo install cargo-lipo >> ${IOS_LOG_PATH}/rust.txt 2>&1
rustup target add aarch64-apple-ios x86_64-apple-ios >> "${IOS_LOG_PATH}/rust.txt" 2>&1
cargo install cargo-lipo >> "${IOS_LOG_PATH}/rust.txt" 2>&1
# shellcheck disable=SC2028
echo "\t${CYAN}Configuring complete${NC}"
#below line is temporary
cd ${DEPENDENCIES} || exit
cd "${DEPENDENCIES}" || exit
mkdir -p build
cd build || exit
BUILD_ROOT=$PWD
cd ..
cd ${CURRENT_DIR} || exit
cd "${CURRENT_DIR}" || exit
if [ "${CARGO_CLEAN}" -eq "1" ]; then
cargo clean >> ${IOS_LOG_PATH}/cargo.txt 2>&1
cargo clean >> "${IOS_LOG_PATH}/cargo.txt" 2>&1
fi
cp wallet.h "${DEPENDENCIES}/MobileWallet/TariLib/"
export PKG_CONFIG_PATH=${PKG_PATH}
# shellcheck disable=SC2028
echo "\t${CYAN}Building Wallet FFI${NC}"
cargo-lipo lipo --release > ${IOS_LOG_PATH}/cargo.txt 2>&1
cargo-lipo lipo --release > "${IOS_LOG_PATH}/cargo.txt" 2>&1
cd ../..
cd target || exit
cd aarch64-apple-ios || exit
# Copy the fat library (which contains symbols for all built iOS architectures) created by the lipo tool
# XCode will select the relevant set of symbols to be included in the mobile application depending on which arch is built
cd universal || exit
cd release || exit
cp libtari_wallet_ffi.a "${DEPENDENCIES}/MobileWallet/TariLib/"
cd ../../.. || exit
rm -rf target
cd ${DEPENDENCIES} || exit
cd "${DEPENDENCIES}" || exit
echo "${GREEN}iOS build completed${NC}"
elif [ "${BUILD_IOS}" -eq 1 ]; then
echo "${RED}Cannot configure iOS Wallet Library build${NC}"
Expand All @@ -96,53 +99,54 @@ fi

DEPENDENCIES=$ANDROID_WALLET_PATH
# PKG_PATH, BUILD_ANDROID, NDK_PATH is defined in build.config
# shellcheck disable=SC2153
if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq 1 ]; then
if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ -n "${PKG_PATH}" ] && [ "${BUILD_ANDROID}" -eq 1 ]; then
echo "${GREEN}Commencing Android build${NC}"
echo "${YELLOW}Build logs can be found at ${ANDROID_LOG_PATH}${NC}"
# shellcheck disable=SC2028
echo "\t${CYAN}Configuring Rust${NC}"
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android arm-linux-androideabi > ${ANDROID_LOG_PATH}/rust.txt 2>&1
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android arm-linux-androideabi > "${ANDROID_LOG_PATH}/rust.txt" 2>&1
if [ "${MAC_MAIN_VERSION}" -le 10 ]; then
if [ "${MAC_SUB_VERSION}" -lt 15 ]; then
cargo install cargo-ndk >> ${ANDROID_LOG_PATH}/rust.txt 2>&1
cargo install cargo-ndk > "${ANDROID_LOG_PATH}/rust.txt" 2>&1
fi
fi
# shellcheck disable=SC2028
echo "\t${CYAN}Configuring complete${NC}"
export NDK_HOME=${NDK_PATH}
export PKG_CONFIG_PATH=${PKG_PATH}
export NDK_TOOLCHAIN_VERSION=clang
DEPENDENCIES=${DEPENDENCIES}/jniLibs

SQLITE_BUILD_FOUND=0
if [ -f ${DEPENDENCIES}/x86_64/libsqlite3.a ] && [ -f ${DEPENDENCIES}/armeabi-v7a/libsqlite3.a ] && [ -f ${DEPENDENCIES}/arm64-v8a/libsqlite3.a ]; then
if [ -f "${DEPENDENCIES}/x86_64/libsqlite3.a" ] && [ -f "${DEPENDENCIES}/armeabi-v7a/libsqlite3.a" ] && [ -f "${DEPENDENCIES}/arm64-v8a/libsqlite3.a" ]; then
SQLITE_BUILD_FOUND=1
fi

SSL_BUILD_FOUND=0
if [ -f ${DEPENDENCIES}/x86_64/libssl.a ] && [ -f ${DEPENDENCIES}/x86_64/libcrypto.a ] && \
[ -f ${DEPENDENCIES}/armeabi-v7a/libssl.a ] && [ -f ${DEPENDENCIES}/armeabi-v7a/libcrypto.a ] && \
[ -f ${DEPENDENCIES}/arm64-v8a/libssl.a ] && [ -f ${DEPENDENCIES}/arm64-v8a/libcrypto.a ]; then
if [ -f "${DEPENDENCIES}/x86_64/libssl.a" ] && [ -f "${DEPENDENCIES}/x86_64/libcrypto.a" ] && \
[ -f "${DEPENDENCIES}/armeabi-v7a/libssl.a" ] && [ -f "${DEPENDENCIES}/armeabi-v7a/libcrypto.a" ] && \
[ -f "${DEPENDENCIES}/arm64-v8a/libssl.a" ] && [ -f "${DEPENDENCIES}/arm64-v8a/libcrypto.a" ]; then
SSL_BUILD_FOUND=1
fi

cd ${DEPENDENCIES} || exit
cd "${DEPENDENCIES}" || exit
mkdir -p build
cd build || exit
BUILD_ROOT=${PWD}
if [ "${MACHINE}" == "Mac" ]; then
if [ "${MAC_MAIN_VERSION}" -le 10 ]; then
if [ "${MAC_SUB_VERSION}" -ge 15 ]; then
cd ${NDK_HOME}/sources/cxx-stl/llvm-libc++/include || exit
cd "${NDK_HOME}/sources/cxx-stl/llvm-libc++/include" || exit
mkdir -p sys
#Fix for missing header, c code should reference limits.h instead of syslimits.h, happens with code that has been around for a long time.
cp "${NDK_HOME}/sources/cxx-stl/llvm-libc++/include/limits.h" "${NDK_HOME}/sources/cxx-stl/llvm-libc++/include/sys/syslimits.h"
cd ${BUILD_ROOT} || exit
cd "${BUILD_ROOT}" || exit
fi
else
cd ${NDK_HOME}/sources/cxx-stl/llvm-libc++/include || exit
cd "${NDK_HOME}/sources/cxx-stl/llvm-libc++/include" || exit
mkdir -p sys
cp "${NDK_HOME}/sources/cxx-stl/llvm-libc++/include/limits.h" "${NDK_HOME}/sources/cxx-stl/llvm-libc++/include/sys/syslimits.h"
cd ${BUILD_ROOT} || exit
cd "${BUILD_ROOT}" || exit
fi
fi
cd ..
Expand All @@ -155,18 +159,19 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
#21 22 23 26 26 27 28 29 not included at present
do
if [ ${SSL_BUILD_FOUND} -eq 0 ]; then
touch ${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt
touch "${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt"
fi

if [ ${SQLITE_BUILD_FOUND} -eq 0 ]; then
touch ${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt
touch "${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt"
fi

touch ${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt
touch "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt"

PLATFORM=$(cut -d'-' -f1 <<<"${PLATFORMABI}")

PLATFORM_OUTDIR=""
# Below "null" is to prevent it exiting with mismatched '"' once it reaches the end of the script
PLATFORM_OUTDIR="null"
if [ "${PLATFORM}" == "i686" ]; then
PLATFORM_OUTDIR="x86"
elif [ "${PLATFORM}" == "x86_64" ]; then
Expand All @@ -178,19 +183,19 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
else
PLATFORM_OUTDIR=${PLATFORM}
fi
cd ${BUILD_ROOT} || exit
mkdir -p ${PLATFORM_OUTDIR}
OUTPUT_DIR=${BUILD_ROOT}/${PLATFORM_OUTDIR}
cd "${BUILD_ROOT}" || exit
mkdir -p "${PLATFORM_OUTDIR}"
OUTPUT_DIR="${BUILD_ROOT}/${PLATFORM_OUTDIR}"

if [ ${SQLITE_BUILD_FOUND} -eq 1 ]; then
mkdir -p ${BUILD_ROOT}/${PLATFORM_OUTDIR}/lib
mkdir -p "${BUILD_ROOT}/${PLATFORM_OUTDIR}/lib"
fi

if [ ${SSL_BUILD_FOUND} -eq 1 ]; then
mkdir -p ${BUILD_ROOT}/${PLATFORM_OUTDIR}/usr/local/lib
mkdir -p "${BUILD_ROOT}/${PLATFORM_OUTDIR}/usr/local/lib"
fi

cd ${DEPENDENCIES} || exit
cd "${DEPENDENCIES}" || exit

PLATFORMABI_TOOLCHAIN=${PLATFORMABI}
PLATFORMABI_COMPILER=${PLATFORMABI}
Expand All @@ -199,8 +204,8 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
PLATFORMABI_COMPILER="armv7a-linux-androideabi"
fi
# set toolchain path
TOOLCHAIN_PATH=${NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/
export TOOLCHAIN=${TOOLCHAIN_PATH}${PLATFORMABI_TOOLCHAIN}
TOOLCHAIN_PATH="${NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/"
export TOOLCHAIN="${TOOLCHAIN_PATH}${PLATFORMABI_TOOLCHAIN}"

# undo compiler configuration (if set) of previous iteration for ssl scripts
unset AR;
Expand All @@ -218,11 +223,14 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
mkdir -p ${SSL_FOLDER}
cd ${SSL_FOLDER} || exit
if [ ${SSL_BUILD_FOUND} -eq 0 ]; then
# shellcheck disable=SC2028
echo "\t${CYAN}Fetching SSL source${NC}"
OPENSSL_SOURCE="https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
curl -s ${OPENSSL_SOURCE} | tar -xvf - -C ${PWD} >> ${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt 2>&1 || exit
curl -s "${OPENSSL_SOURCE}" | tar -xvf - -C "${PWD}" >> "${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt" 2>&1 || exit
# shellcheck disable=SC2028
echo "\t${CYAN}Source fetched${NC}"
cd openssl-${OPENSSL_VERSION} || exit
cd "openssl-${OPENSSL_VERSION}" || exit
# shellcheck disable=SC2028
echo "\t${CYAN}Building SSL${NC}"
# Required by openssl-build-script
ANDROID_NDK=${NDK_PATH}
Expand All @@ -242,13 +250,15 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
;;
esac
# Required by openssl-build-script
export PATH=${TOOLCHAIN}/bin:${TOOLCHAIN_PATH}/bin:"${PATH}"
make clean >> ${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt 2>&1
./Configure ${SSL_TARGET} ${SSL_OPTIONS} >> ${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt 2>&1
make >> ${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt 2>&1
make install DESTDIR=${OUTPUT_DIR} >> ${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt 2>&1
export PATH="${TOOLCHAIN}/bin:${TOOLCHAIN_PATH}/bin:${PATH}"
make clean > "${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt" 2>&1
./Configure "${SSL_TARGET}" "${SSL_OPTIONS}" > "${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt" 2>&1
make >> "${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt" 2>&1
make install DESTDIR="${OUTPUT_DIR}" >> "${ANDROID_LOG_PATH}/ssl_${PLATFORMABI}_${LEVEL}.txt" 2>&1
# shellcheck disable=SC2028
echo "\t${CYAN}SSL built${NC}"
else
# shellcheck disable=SC2028
echo "\t${CYAN}SSL located${NC}"
fi
cd ../..
Expand Down Expand Up @@ -287,16 +297,21 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
mkdir -p ${SQLITE_FOLDER}
cd ${SQLITE_FOLDER} || exit
if [ ${SQLITE_BUILD_FOUND} -eq 0 ]; then
# shellcheck disable=SC2028
echo "\t${CYAN}Fetching Sqlite3 source${NC}"
curl -s ${SQLITE_SOURCE} | tar -xvf - -C ${PWD} >> ${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt 2>&1
curl -s "${SQLITE_SOURCE}" | tar -xvf - -C "${PWD}" >> "${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt" 2>&1
# shellcheck disable=SC2028
echo "\t${CYAN}Source fetched${NC}"
cd "$(find . -type d -maxdepth 1 -print | grep -m1 'sqlite')" || exit
# shellcheck disable=SC2028
echo "\t${CYAN}Building Sqlite3${NC}"
make clean >> ${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt 2>&1
./configure --host=${PLATFORMABI} --prefix=${OUTPUT_DIR} >> ${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt 2>&1
make install >> ${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt 2>&1
make clean > "${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt" 2>&1
./configure --host=${PLATFORMABI} --prefix="${OUTPUT_DIR}" > "${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt" 2>&1
make install > "${ANDROID_LOG_PATH}/sqlite_${PLATFORMABI}_${LEVEL}.txt" 2>&1
# shellcheck disable=SC2028
echo "\t${CYAN}Sqlite3 built${NC}"
else
# shellcheck disable=SC2028
echo "\t${CYAN}Sqlite3 located${NC}"
fi
cd ../..
Expand All @@ -312,21 +327,22 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${NDK_PATH}" ] && [ "${BUILD_ANDROID}" -eq
fi
fi
export LDFLAGS="-L${NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/${PLATFORMABI_TOOLCHAIN}/${LEVEL} -L${OUTPUT_DIR}/lib -L${OUTPUT_DIR}/usr/local/lib -lc++ -lsqlite3 -lcrypto -lssl"
cd ${OUTPUT_DIR}/lib || exit
cd "${OUTPUT_DIR}/lib" || exit

if [ ${SQLITE_BUILD_FOUND} -eq 1 ]; then
cp ${DEPENDENCIES}/${PLATFORM_OUTDIR}/libsqlite3.a ${OUTPUT_DIR}/lib/libsqlite3.a
cp "${DEPENDENCIES}/${PLATFORM_OUTDIR}/libsqlite3.a" "${OUTPUT_DIR}/lib/libsqlite3.a"
fi

if [ ${SSL_BUILD_FOUND} -eq 1 ]; then
cp ${DEPENDENCIES}/${PLATFORM_OUTDIR}/libcrypto.a ${OUTPUT_DIR}/usr/local/lib/libcrypto.a
cp ${DEPENDENCIES}/${PLATFORM_OUTDIR}/libssl.a ${OUTPUT_DIR}/usr/local/lib/libssl.a
cp "${DEPENDENCIES}/${PLATFORM_OUTDIR}/libcrypto.a" "${OUTPUT_DIR}/usr/local/lib/libcrypto.a"
cp "${DEPENDENCIES}/${PLATFORM_OUTDIR}/libssl.a" "${OUTPUT_DIR}/usr/local/lib/libssl.a"
fi

# shellcheck disable=SC2028
echo "\t${CYAN}Configuring Cargo${NC}"
cd ${CURRENT_DIR} || exit
cd "${CURRENT_DIR}" || exit
if [ "${CARGO_CLEAN}" -eq "1" ]; then
cargo clean >> ${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt 2>&1
cargo clean > "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt" 2>&1
fi
mkdir -p .cargo
cd .cargo || exit
Expand All @@ -343,7 +359,6 @@ linker = "${CC}"
rustflags = "-L${OUTPUT_DIR}/lib -L${OUTPUT_DIR}/usr/local/lib"
EOF

else
cat > config <<EOF
[target.${PLATFORMABI}]
Expand All @@ -368,16 +383,18 @@ EOF

fi
fi
# shellcheck disable=SC2028
echo "\t${CYAN}Configuring complete${NC}"
cd .. || exit
# shellcheck disable=SC2028
echo "\t${CYAN}Building Wallet FFI${NC}"
#note: add -vv to below to see verbose and build script output
if [ "${MACHINE}" == "Mac" ]; then
if [ "${MAC_MAIN_VERSION}" -le 10 ]; then
if [ "${MAC_SUB_VERSION}" -ge 15 ]; then
cargo build --lib --release >> ${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt 2>&1
cargo build --lib --release > "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt" 2>&1
else
cargo ndk --target ${PLATFORMABI} --android-platform ${LEVEL} -- build --release >> ${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt 2>&1
cargo ndk --target ${PLATFORMABI} --android-platform ${LEVEL} -- build --release > "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt" 2>&1
fi
else
# Fix for lmdb-sys compilation for armv7 on Big Sur
Expand All @@ -388,7 +405,7 @@ EOF
# shellcheck disable=SC2028
echo "\t${CYAN}Extraction complete, continuing build ${NC}"
fi
cargo build --lib --release >> ${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt 2>&1
cargo build --lib --release > "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt" 2>&1
if [ "${PLATFORMABI}" == "armv7-linux-androideabi" ]; then
BACKTRACK=${PWD}
# shellcheck disable=SC2028
Expand All @@ -399,37 +416,38 @@ EOF
fi
fi
else
cargo ndk --target ${PLATFORMABI} --android-platform ${LEVEL} -- build --release >> ${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt 2>&1
cargo ndk --target ${PLATFORMABI} --android-platform ${LEVEL} -- build --release > "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt" 2>&1
fi
cp wallet.h ${DEPENDENCIES}/
cp wallet.h "${DEPENDENCIES}/"
rm -rf .cargo
cd ../..
cd target || exit
cd ${PLATFORMABI} || exit
cd release || exit
cp libtari_wallet_ffi.a ${OUTPUT_DIR}
cp libtari_wallet_ffi.a "${OUTPUT_DIR}"
cd ../..
rm -rf target
cd ${DEPENDENCIES} || exit
mkdir -p ${PLATFORM_OUTDIR}
cd ${PLATFORM_OUTDIR} || exit
cd "${DEPENDENCIES}" || exit
mkdir -p "${PLATFORM_OUTDIR}"
cd "${PLATFORM_OUTDIR}" || exit
if [ ${SQLITE_BUILD_FOUND} -eq 0 ]; then
cp ${OUTPUT_DIR}/lib/libsqlite3.a ${PWD}
cp "${OUTPUT_DIR}/lib/libsqlite3.a" "${PWD}"
fi
if [ ${SSL_BUILD_FOUND} -eq 0 ]; then
cp ${OUTPUT_DIR}/usr/local/lib/libcrypto.a ${PWD}
cp ${OUTPUT_DIR}/usr/local/lib/libssl.a ${PWD}
cp "${OUTPUT_DIR}/usr/local/lib/libcrypto.a" "${PWD}"
cp "${OUTPUT_DIR}/usr/local/lib/libssl.a" "${PWD}"
fi
cp ${OUTPUT_DIR}/libtari_wallet_ffi.a ${PWD}
cp "${OUTPUT_DIR}/libtari_wallet_ffi.a" "${PWD}"
# shellcheck disable=SC2028
echo "\t${GREEN}Wallet library built for android architecture ${PLATFORM_OUTDIR} with minimum platform level support of ${LEVEL}${NC}"
done
done
cd ${DEPENDENCIES} || exit
cd "${DEPENDENCIES}" || exit
rm -rf build
rm -rf ${SQLITE_FOLDER}
rm -rf ${SSL_FOLDER}
echo "${GREEN}Android build completed${NC}"
elif [ ${BUILD_ANDROID} -eq 1 ]; then
elif [ "${BUILD_ANDROID}" -eq 1 ]; then
echo "${RED}Cannot configure Android Wallet Library build${NC}"
else
echo "${GREEN}Android Wallet is configured not to build${NC}"
Expand Down
Loading

0 comments on commit def5de6

Please sign in to comment.