1
0
This commit is contained in:
Andrea Cavalli 2020-10-05 00:19:18 +02:00
parent 1e85344547
commit d5d1b9fb73
4 changed files with 25 additions and 132 deletions

View File

@ -1,6 +1,4 @@
#!/bin/bash -e
set -e
# ====== Setup environment variables
source ./jenkins/scripts/setup_variables.sh
@ -8,58 +6,27 @@ source ./jenkins/scripts/setup_variables.sh
bash ./jenkins/scripts/setup_workspace.sh
# ====== Build Td
echo "JAVA_INCLUDE_PATH:$JAVA_INCLUDE_PATH"
echo "JAVA_INCLUDE_PATH2:$JAVA_INCLUDE_PATH2"
echo "JAVA_AWT_INCLUDE_PATH:$JAVA_AWT_INCLUDE_PATH"
# Prepare build
cd $TD_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=OFF -DTD_SKIP_TG_CLI=ON ${TD_SRC_DIR}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=OFF -DTD_SKIP_TG_CLI=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ ${TD_SRC_DIR}
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
nice -n 5 cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=OFF -DTD_SKIP_TG_CLI=ON -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake ${TD_SRC_DIR}
fi
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
while true; do free -h ; sleep 2; done &
fi
# Split sources
#if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j${TRAVIS_CPU_CORES}
# cd $TD_SRC_DIR
# php SplitSource.php
#fi
nice -n 5 cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j${TRAVIS_CPU_CORES}
cd $TD_SRC_DIR
nice -n 5 php SplitSource.php
# Build
cd $TD_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -m
fi
# Undo split-sources
#if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# cd $TD_SRC_DIR
# php SplitSource.php --undo
#fi
cd $TD_SRC_DIR
nice -n 5php SplitSource.php --undo
# ====== Build TdNatives
cd $TDNATIVES_CPP_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
nice -n 5 cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake $TDNATIVES_CPP_SRC_DIR
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -m
fi
# ====== Print results stats
echo "CCACHE statistics:"
@ -67,13 +34,5 @@ ccache -s
# ====== Copy output
cd $TDNATIVES_CPP_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mkdir -p $TDLIB_RESOURCES_OUTPUT_DIR
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/$DEST_TDJNI_LIBNAME
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
mkdir -p $TDLIB_RESOURCES_OUTPUT_DIR
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/$DEST_TDJNI_LIBNAME
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
mkdir -p $TDLIB_RESOURCES_OUTPUT_DIR
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/$DEST_TDJNI_LIBNAME
fi

View File

@ -1,5 +1,4 @@
#!/bin/bash -e
set -e
# ====== Variables
export TD_SRC_DIR=$TRAVIS_BUILD_DIR/dependencies/tdlight
@ -12,51 +11,18 @@ export TDNATIVES_CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/build-tdlib
export JAVA_SRC_DIR=$TRAVIS_BUILD_DIR/src/tdlib-java
export TDLIB_SERIALIZER_DIR=$TRAVIS_BUILD_DIR/dependencies/tdlib-serializer
export MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
export TRAVIS_CPU_ARCH_STANDARD="aarch64"
export TRAVIS_CPU_CORES="2"
else
TRAVIS_CPU_ARCH_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export TRAVIS_CPU_ARCH_STANDARD;
export TRAVIS_CPU_CORES="2"
fi
TRAVIS_OS_NAME_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_OS_NAME}")"
export TRAVIS_OS_NAME_STANDARD
if [ "$TRAVIS_OS_NAME_STANDARD" = "windows" ]; then
export TRAVIS_OS_NAME_SHORT="win"
else
export TRAVIS_OS_NAME_SHORT=$TRAVIS_OS_NAME_STANDARD
fi
if [ "$TRAVIS_OS_NAME_STANDARD" = "windows" ]; then
export SRC_TDJNI_LIBNAME="tdjni.dll"
export DEST_TDJNI_LIBNAME="tdjni.dll"
elif [ "$TRAVIS_OS_NAME_STANDARD" = "osx" ]; then
export SRC_TDJNI_LIBNAME="libtdjni.dylib"
export DEST_TDJNI_LIBNAME="tdjni.dylib"
else
export SRC_TDJNI_LIBNAME="libtdjni.so"
export DEST_TDJNI_LIBNAME="tdjni.so"
fi
# ====== OS Variables
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
export PATH="$PATH:/c/tools/php74:/c/PHP:/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/Program Files/CMake/bin:/c/ProgramData/chocolatey/bin:/c/Program Files/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools:/c/Program Files/NASM"
export JAVA_HOME="/c/Program Files/OpenJDK/openjdk-11.0.8_10"
export VCPKG_DIR=$TRAVIS_BUILD_DIR/vcpkg
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
PATH="$PATH:$(/usr/libexec/java_home -v 14)"
export PATH
JAVA_HOME="$(/usr/libexec/java_home -v 14)"
export JAVA_HOME
JAVA_INCLUDE_PATH="$(/usr/libexec/java_home -v 14)/include"
export JAVA_INCLUDE_PATH
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
TRAVIS_CPU_ARCH_JAVA="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export TRAVIS_CPU_ARCH_JAVA
#export PATH="$PATH:/usr/lib/jvm/java-11-openjdk-$TRAVIS_CPU_ARCH_JAVA/bin"
#export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$TRAVIS_CPU_ARCH_JAVA"
#export JAVA_INCLUDE_PATH="/usr/lib/jvm/java-11-openjdk-$TRAVIS_CPU_ARCH_JAVA/include"
fi
export TDLIB_RESOURCES_OUTPUT_DIR="$TRAVIS_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD"
# ====== Print variables
@ -72,6 +38,8 @@ echo "TDLIB_SERIALIZER_DIR=${TDLIB_SERIALIZER_DIR}"
echo "PATH=${PATH}"
echo "JAVA_HOME=${JAVA_HOME}"
echo "JAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH}"
echo "JAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2}"
echo "JAVA_AWT_INCLUDE_PATH=${JAVA_AWT_INCLUDE_PATH}"
echo "VCPKG_DIR=${VCPKG_DIR}"
echo "MAVEN_OPTS=${MAVEN_OPTS}"
echo "TRAVIS_CPU_ARCH=${TRAVIS_CPU_ARCH}"

View File

@ -1,44 +1,10 @@
#!/bin/bash -e
set -e
# ====== Setup environment variables
source ./jenkins/scripts/setup_variables.sh
# ====== Finish clone
#cd $TRAVIS_BUILD_DIR
#git submodule sync
#git submodule update --init --recursive
# ====== Environment cleanup
[ -f $JAVA_SRC_DIR/it/tdlight/tdlib/TdApi.java ] && rm $JAVA_SRC_DIR/it/tdlight/tdlib/TdApi.java
[ -f $JAVA_SRC_DIR/it/tdlight/tdlib/new_TdApi.java ] && rm $JAVA_SRC_DIR/it/tdlight/tdlib/new_TdApi.java
# ====== Environment setup
[ -d $TRAVIS_BUILD_DIR/out ] || mkdir -p $TRAVIS_BUILD_DIR/out
[ -d $TD_BUILD_DIR ] || mkdir $TD_BUILD_DIR
[ -d $TDNATIVES_CPP_BUILD_DIR ] || mkdir $TDNATIVES_CPP_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "Linux"
echo "CCACHE statistics:"
ccache -s
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo "OSX"
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
echo "Windows"
choco install ccache
choco install visualstudio2019buildtools --version=16.7.0.0 --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
choco install openjdk11 --version=11.0.8.10
choco install maven --version=3.6.3
choco install base64
choco install gperf
choco install strawberryperl
choco install nasm
choco install php --version=7.4.9 --package-parameters='"/ThreadSafe ""/InstallDir:C:\PHP"""'
git clone --depth=1 -b windows-amd64-prebuilt-libraries --single-branch https://github.com/tdlight-team/tdlight-java windowsenv
mv windowsenv/vcpkg $VCPKG_DIR
else
echo "Unrecognized os: $TRAVIS_OS_NAME"
exit 1
fi

@ -1 +1 @@
Subproject commit 30cee83f14da62278a9789363237105dae05e18b
Subproject commit d5009ed98a801caa36370af15e8391d589a76d16