2020-10-07 15:20:59 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
# ====== Setup workspace
|
|
|
|
source ./jenkins/scripts/setup_workspace.sh
|
|
|
|
|
|
|
|
# ====== Prepare tools
|
|
|
|
cd $TD_CROSS_BIN_DIR
|
|
|
|
nice -n 5 chrt -b 0 cmake \
|
|
|
|
-DTD_ENABLE_JNI=ON \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} \
|
|
|
|
-DCMAKE_INSTALL_BINDIR:PATH=${TD_BIN_DIR}/bin \
|
|
|
|
$TD_SRC_DIR
|
|
|
|
nice -n 5 chrt -b 0 cmake --build . --target prepare_cross_compiling --parallel ${TRAVIS_CPU_CORES}
|
|
|
|
nice -n 5 chrt -b 0 cmake --build . --target td_generate_java_api --parallel ${TRAVIS_CPU_CORES}
|
|
|
|
|
|
|
|
# ====== Build TdApi
|
|
|
|
cd $TDNATIVES_CPP_BUILD_DIR
|
|
|
|
nice -n 5 chrt -b 0 cmake -DCMAKE_BUILD_TYPE=Release -DTD_SRC_DIR=${TD_SRC_DIR} -DTD_GENERATED_BINARIES_DIR=${TD_BIN_DIR}/td/generate \
|
2020-10-07 15:41:48 +02:00
|
|
|
-DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DJAVA_SRC_DIR=${JAVA_SRC_DIR} $TDNATIVES_CPP_SRC_DIR
|
2020-10-07 15:20:59 +02:00
|
|
|
nice -n 5 chrt -b 0 cmake --build $TDNATIVES_CPP_BUILD_DIR --target td_generate_java_api --config Release -- -j${TRAVIS_CPU_CORES}
|
|
|
|
|
|
|
|
# ====== Patch generated java code
|
|
|
|
echo "Compilation done. Patching TdApi.java"
|
2020-10-11 16:46:47 +02:00
|
|
|
python3 $TDLIB_SERIALIZER_DIR $JAVA_SRC_DIR/it/tdlight/jni/TdApi.java $JAVA_SRC_DIR/it/tdlight/jni/new_TdApi.java $TDLIB_SERIALIZER_DIR/headers.txt
|
|
|
|
rm $JAVA_SRC_DIR/it/tdlight/jni/TdApi.java
|
|
|
|
unexpand --tabs=2 $JAVA_SRC_DIR/it/tdlight/jni/new_TdApi.java > $JAVA_SRC_DIR/it/tdlight/jni/TdApi.java
|
|
|
|
rm $JAVA_SRC_DIR/it/tdlight/jni/new_TdApi.java
|
2020-10-07 15:49:35 +02:00
|
|
|
|
|
|
|
# ====== Clean unwanted directories
|
|
|
|
rm -r "${TD_BIN_DIR}"
|