Update deploy_master.sh and win.sh

This commit is contained in:
Andrea 2020-08-19 11:40:49 +02:00
parent b3bb3ab807
commit 294e5ae97a
2 changed files with 24 additions and 35 deletions

View File

@ -16,7 +16,7 @@ echo "TD_SRC_DIR=${TD_SRC_DIR}"
echo "TD_BIN_DIR=${TD_BIN_DIR}"
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
if [ "$TRAVIS_OS_NAME_STANDARD" = "windows" ]; then
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
export PATH="$PATH:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools"
export JAVA_HOME="/c/Program Files/OpenJDK/openjdk-11.0.8_10"
export JAVA_INCLUDE_PATH="/c/Program Files/OpenJDK/openjdk-11.0.8_10/include"
@ -33,9 +33,15 @@ else
export TRAVIS_CPU_ARCH_STANDARD="${TRAVIS_CPU_ARCH,,}"
fi
export TRAVIS_OS_NAME_STANDARD="${TRAVIS_OS_NAME,,}"
if [ "$TRAVIS_OS_NAME_STANDARD" = "windows" ]; then
export TRAVIS_OS_NAME_SHORT="win"
else
export TRAVIS_OS_NAME_SHORT=$TRAVIS_OS_NAME_STANDARD
fi
echo "TRAVIS_OS_NAME: $TRAVIS_OS_NAME"
echo "TRAVIS_OS_NAME_STANDARD: $TRAVIS_OS_NAME_STANDARD"
echo "TRAVIS_OS_NAME_SHORT: $TRAVIS_OS_NAME_SHORT"
echo "TRAVIS_CPU_ARCH: $TRAVIS_CPU_ARCH"
echo "TRAVIS_CPU_ARCH_STANDARD: $TRAVIS_CPU_ARCH_STANDARD"
# End setup variables
@ -64,13 +70,13 @@ else
SRC_LIBNAME="libtdjni.so"
LIBNAME="tdjni.so"
fi
mkdir -p "src/main/resources/libs/$TRAVIS_OS_NAME_STANDARD/$TRAVIS_CPU_ARCH_STANDARD"
mv "$TRAVIS_BUILD_DIR/out/$SRC_LIBNAME" "src/main/resources/libs/$TRAVIS_OS_NAME_STANDARD/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"
mkdir -p "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD"
mv "$TRAVIS_BUILD_DIR/out/$SRC_LIBNAME" "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"
# IF THE NATIVE LIBRARY IS CHANGED
if ! (git diff --exit-code "src/main/resources/libs/$TRAVIS_OS_NAME_STANDARD/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"); then
if ! (git diff --exit-code "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"); then
# Do the upgrade of the repository
git add "src/main/resources/libs/$TRAVIS_OS_NAME_STANDARD/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"
git add "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"
mvn build-helper:parse-version versions:set \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} \
versions:commit

View File

@ -17,8 +17,9 @@ echo "TD_BIN_DIR=${TD_BIN_DIR}"
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
# ====== OS Variables
export PATH="$PATH:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools:/c/ProgramData/chocolatey/lib/nasm/tools:/c/ProgramData/chocolatey/lib/nasm:/c/Program Files/NASM:/c/Program Files/NASM/bin"
export PATH="$PATH:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/C/Program Files/CMake/bin:/c/ProgramData/chocolatey/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
# ====== Cleanup
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/TdApi.java || true
@ -28,47 +29,29 @@ rm $JAVA_SRC_DIR/it/tdlight/tdnatives/new_TdApi.java || true
mkdir -p $TRAVIS_BUILD_DIR/out || true
mkdir $TD_BUILD_DIR || true
mkdir $TDNATIVES_CPP_BUILD_DIR || true
choco install visualstudio2019buildtools
tree "/c/"
choco install ccache
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 visualstudio2019buildtools --package-parameters "--allWorkloads --includeRecommended --passive --locale en-US"
# Install OpenSSL and ZLib
cd $TRAVIS_BUILD_DIR
# openssl
mkdir $TRAVIS_BUILD_DIR/openssl-root
git clone https://github.com/openssl/openssl.git -b OpenSSL_1_1_1-stable
cd openssl
perl Configure enable-static-engine enable-capieng no-ssl2 -utf-8 VC-WIN64A --prefix=$TRAVIS_BUILD_DIR/openssl-root --openssldir=$TRAVIS_BUILD_DIR/openssl-root no-shared
nmake
nmake install
cd ..
# zlib
cd $TRAVIS_BUILD_DIR
mkdir $TRAVIS_BUILD_DIR/zlib-root
git clone https://github.com/madler/zlib.git -b v1.2.11
cd zlib
cmake -DCMAKE_INSTALL_PREFIX:PATH=$TRAVIS_BUILD_DIR/zlib-root -DSKIP_BUILD_EXAMPLES=ON .
cmake --build . --target install
cd ..
ls $TRAVIS_BUILD_DIR/openssl-root
ls $TRAVIS_BUILD_DIR/zlib-root
git clone -b windows-amd64-prebuilt-libraries --single-branch https://github.com/tdlight-team/tdlight-java windowsenv
mv windowsenv/vcpkg $VCPKG_DIR
# ====== Build Td
cd $TD_BUILD_DIR
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR}
cmake --build $TD_BUILD_DIR --target install
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake ${TD_SRC_DIR}
cmake --build $TD_BUILD_DIR --target install --config Release
# ====== Build TdNatives
cd $TDNATIVES_CPP_BUILD_DIR
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 $TDNATIVES_CPP_SRC_DIR
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install
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
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release
# ====== Copy output
mv $TDNATIVES_BIN_DIR/libtdjni.dll $TRAVIS_BUILD_DIR/out/libtdjni.dll
ls -alch $TDNATIVES_BIN_DIR
ls -alch $TDNATIVES_BIN_DIR/Release
mv $TDNATIVES_BIN_DIR/tdjni.dll $TRAVIS_BUILD_DIR/out/libtdjni.dll