Update .travis.yml, pom.template.xml, and 11 more files...

This commit is contained in:
Andrea Cavalli 2020-10-10 04:03:20 +02:00
parent f05cbe18a6
commit 70fbdea77c
13 changed files with 193 additions and 1 deletions

64
.travis.yml Normal file
View File

@ -0,0 +1,64 @@
language: shell
os:
- linux
- windows
- osx
arch:
- amd64
- arm64
osx_image: xcode11.3
dist: bionic
before_install:
- cp .travis.settings.xml $HOME/.m2/settings.xml
- chmod +x travis/build.sh
- chmod +x travis/build_success.sh
- chmod +x travis/install_dependencies.sh
- chmod +x travis/setup_variables.sh
addons:
apt:
update: true
packages:
- make
- git
- zlib1g-dev
- libssl-dev
- gperf
- php
- cmake
- g++
- ccache
- maven
- openjdk-11-jdk
- python3
- php7.2-cli
cache:
bundler: true
cocoapods: true
ccache: true
directories:
- ".autoconf"
- "$HOME/.m2"
- "$HOME/.ccache"
deploy:
- provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: false
local-dir: out/docs
repo: tdlight-team/tdlight-docs
target_branch: master
email: andrea@cavallium.it
name: "Andrea Cavalli"
verbose: true
on:
branch: dev
condition: $TRAVIS_OS_NAME = linux && $TRAVIS_CPU_ARCH = amd64
# - provider: script
# skip-cleanup: true
# script: "mvn -B -V deploy"
install: ./travis/install_dependencies.sh
script: ./travis/build.sh
after_success: ./travis/build_success.sh

View File

@ -87,7 +87,7 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name</pattern> <pattern>it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name</pattern>
<shadedPattern>it.tdlight.jni.${IMPLEMENTATION_NAME}.${OPERATING_SYSTEM_NAME}.${CPU_ARCHITECTURE_NAME}</shadedPattern> <shadedPattern>it.tdlight.jni.${IMPLEMENTATION_NAME}.${OPERATING_SYSTEM_NAME_SHORT}.${CPU_ARCHITECTURE_NAME}</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

View File

@ -71,7 +71,18 @@ cmake \
# Build # Build
echo "Compiling ${IMPLEMENTATION_NAME} jni..." echo "Compiling ${IMPLEMENTATION_NAME} jni..."
cmake --build . --target install --parallel ${CPU_CORES} cmake --build . --target install --parallel ${CPU_CORES}
cd ..
# Copy to resources
echo "Copying to resources..."
[ -d ./src/main/resources/libs/${OPERATING_SYSTEM_NAME_SHORT}/${CPU_ARCHITECTURE_NAME}/ ] || mkdir -p ./src/main/resources/libs/${OPERATING_SYSTEM_NAME_SHORT}/${CPU_ARCHITECTURE_NAME}/
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
cp ./tdjni_bin/tdjni.dll ./src/main/resources/libs/${OPERATING_SYSTEM_NAME_SHORT}/${CPU_ARCHITECTURE_NAME}/tdjni.dll
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cp ./tdjni_bin/libtdjni.dylib ./src/main/resources/libs/${OPERATING_SYSTEM_NAME_SHORT}/${CPU_ARCHITECTURE_NAME}/tdjni.dylib
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
cp ./tdjni_bin/libtdjni.so ./src/main/resources/libs/${OPERATING_SYSTEM_NAME_SHORT}/${CPU_ARCHITECTURE_NAME}/tdjni.so
fi
echo "Done." echo "Done."
exit 0 exit 0

View File

@ -1,3 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/linux/ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/ s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlib/ s/${IMPLEMENTATION_NAME}/tdlib/

View File

@ -1,3 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/linux/ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/ s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlight/ s/${IMPLEMENTATION_NAME}/tdlight/

View File

@ -1,3 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/linux/ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/ s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/ s/${IMPLEMENTATION_NAME}/tdlib/

View File

@ -1,3 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/linux/ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/ s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/ s/${IMPLEMENTATION_NAME}/tdlight/

View File

@ -1,3 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/windows/ s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/ s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/ s/${IMPLEMENTATION_NAME}/tdlib/

View File

@ -1,3 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/windows/ s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/ s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/ s/${IMPLEMENTATION_NAME}/tdlight/

14
travis/build.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash -e
source ./travis/setup_variables.sh
cd ./scripts/
./generate_maven_project.sh
./generate_td_tools.sh
./compile_td.sh
./generate_tdapi_java_file.sh
./compile_tdjni.sh
./build_generated_maven_project.sh
echo "Done."
exit 0

4
travis/build_success.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash -e
echo "Build success"
exit 0

View File

@ -0,0 +1,29 @@
#!/bin/bash -e
set -e
# ====== Setup environment variables
source ./travis/setup_variables.sh
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "==Linux===="
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 https://github.com/tdlight-team/windows-amd64-prebuilt-libraries.git windowsenv
mv windowsenv/vcpkg $VCPKG_DIR
else
echo "Unrecognized os: $TRAVIS_OS_NAME"
exit 1
fi

64
travis/setup_variables.sh Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash -e
set -e
# ====== Variables
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 CPU_ARCHITECTURE_NAME="aarch64"
export CPU_CORES="2"
else
CPU_ARCHITECTURE_NAME="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export CPU_ARCHITECTURE_NAME;
export CPU_CORES="2"
fi
OPERATING_SYSTEM_NAME="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_OS_NAME}")"
export OPERATING_SYSTEM_NAME
if [ "$OPERATING_SYSTEM_NAME" = "windows" ]; then
export OPERATING_SYSTEM_NAME_SHORT="win"
else
export OPERATING_SYSTEM_NAME_SHORT=$OPERATING_SYSTEM_NAME
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
# ====== Print variables
echo "TD_SRC_DIR=${TD_SRC_DIR}"
echo "TD_BIN_DIR=${TD_BIN_DIR}"
echo "TDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR}"
echo "TDNATIVES_CPP_SRC_DIR=${TDNATIVES_CPP_SRC_DIR}"
echo "TDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR}"
echo "TD_BUILD_DIR=${TD_BUILD_DIR}"
echo "TDNATIVES_CPP_BUILD_DIR=${TDNATIVES_CPP_BUILD_DIR}"
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
echo "TDLIB_SERIALIZER_DIR=${TDLIB_SERIALIZER_DIR}"
echo "PATH=${PATH}"
echo "JAVA_HOME=${JAVA_HOME}"
echo "JAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH}"
echo "VCPKG_DIR=${VCPKG_DIR}"
echo "MAVEN_OPTS=${MAVEN_OPTS}"
echo "TRAVIS_CPU_ARCH=${TRAVIS_CPU_ARCH}"
echo "TRAVIS_CPU_ARCH_JAVA=${TRAVIS_CPU_ARCH_JAVA}"
echo "TRAVIS_CPU_ARCH_STANDARD=${TRAVIS_CPU_ARCH_STANDARD}"
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 "SRC_TDJNI_LIBNAME=${SRC_TDJNI_LIBNAME}"
echo "DEST_TDJNI_LIBNAME=${DEST_TDJNI_LIBNAME}"