2020-08-18 16:31:36 +02:00
|
|
|
#!/bin/bash -e
|
2020-08-18 18:23:30 +02:00
|
|
|
|
|
|
|
# Setup variables
|
2020-08-18 22:22:54 +02:00
|
|
|
if [ "$TRAVIS_OS_NAME_STANDARD" = "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"
|
|
|
|
else
|
|
|
|
export PATH="$PATH:/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)/bin"
|
|
|
|
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)"
|
|
|
|
export JAVA_INCLUDE_PATH="/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)/include"
|
|
|
|
fi
|
2020-08-18 18:23:30 +02:00
|
|
|
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"
|
|
|
|
|
2020-08-18 17:27:52 +02:00
|
|
|
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
|
|
|
|
export TRAVIS_CPU_ARCH_STANDARD="aarch64"
|
|
|
|
else
|
|
|
|
export TRAVIS_CPU_ARCH_STANDARD="${TRAVIS_CPU_ARCH,,}"
|
|
|
|
fi
|
|
|
|
export TRAVIS_OS_NAME_STANDARD="${TRAVIS_OS_NAME,,}"
|
|
|
|
|
|
|
|
echo "TRAVIS_OS_NAME: $TRAVIS_OS_NAME"
|
|
|
|
echo "TRAVIS_OS_NAME_STANDARD: $TRAVIS_OS_NAME_STANDARD"
|
|
|
|
echo "TRAVIS_CPU_ARCH: $TRAVIS_CPU_ARCH"
|
|
|
|
echo "TRAVIS_CPU_ARCH_STANDARD: $TRAVIS_CPU_ARCH_STANDARD"
|
2020-08-18 18:23:30 +02:00
|
|
|
# End setup variables
|
2020-08-18 17:27:52 +02:00
|
|
|
|
2020-08-18 18:25:39 +02:00
|
|
|
# Setup ssh
|
2020-08-18 18:45:26 +02:00
|
|
|
mkdir -p ~/.ssh
|
2020-08-18 20:08:49 +02:00
|
|
|
echo "$GIT_IGN_TRAVIS_DEPLOY_PRIVATE_KEY" | base64 -d > ~/.ssh/id_rsa
|
2020-08-18 18:52:49 +02:00
|
|
|
chmod 600 ~/.ssh/id_rsa || true
|
2020-08-18 17:31:59 +02:00
|
|
|
ssh-keyscan ssh.git.ignuranza.net >> $HOME/.ssh/known_hosts
|
|
|
|
ssh-keyscan git.ignuranza.net >> $HOME/.ssh/known_hosts
|
2020-08-18 18:25:39 +02:00
|
|
|
|
|
|
|
# Setup user
|
|
|
|
git config --global user.email "andrea@cavallium.it"
|
|
|
|
git config --global user.name "Andrea Cavalli"
|
|
|
|
|
2020-08-18 21:05:38 +02:00
|
|
|
# Prepare repository
|
2020-08-18 17:27:52 +02:00
|
|
|
git clone "git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD.git"
|
|
|
|
cd "tdlight-java-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD"
|
2020-08-18 21:05:38 +02:00
|
|
|
SRC_LIBNAME=""
|
|
|
|
LIBNAME=""
|
2020-08-18 18:23:30 +02:00
|
|
|
if [ "$TRAVIS_OS_NAME_STANDARD" = "windows" ]; then
|
2020-08-18 21:05:38 +02:00
|
|
|
SRC_LIBNAME="libtdjni.dll"
|
|
|
|
LIBNAME="tdjni.dll"
|
2020-08-18 18:23:30 +02:00
|
|
|
else
|
2020-08-18 21:05:38 +02:00
|
|
|
SRC_LIBNAME="libtdjni.so"
|
|
|
|
LIBNAME="tdjni.so"
|
2020-08-18 18:23:30 +02:00
|
|
|
fi
|
2020-08-18 21:05:38 +02:00
|
|
|
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"
|
|
|
|
|
|
|
|
# EXIT IF THE NATIVE LIBRARY ISN'T CHANGED
|
|
|
|
if (git diff --exit-code "src/main/resources/libs/$TRAVIS_OS_NAME_STANDARD/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"); then
|
2020-08-18 21:28:30 +02:00
|
|
|
echo "Binaries are already updated."
|
2020-08-18 21:05:38 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Do the upgrade of the repository
|
|
|
|
git add "src/main/resources/libs/$TRAVIS_OS_NAME_STANDARD/$TRAVIS_CPU_ARCH_STANDARD/$LIBNAME"
|
2020-08-18 20:08:49 +02:00
|
|
|
mvn build-helper:parse-version versions:set \
|
|
|
|
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} \
|
|
|
|
versions:commit
|
|
|
|
NEW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
2020-08-18 18:23:30 +02:00
|
|
|
git add pom.xml
|
|
|
|
git commit -m "Updated native library"
|
|
|
|
git tag -a "v$NEW_VERSION" -m "Version $NEW_VERSION"
|
|
|
|
git push origin "v$NEW_VERSION"
|
|
|
|
git push
|
2020-08-18 18:55:03 +02:00
|
|
|
mvn -B -V deploy
|
2020-08-18 21:28:30 +02:00
|
|
|
|
|
|
|
# Upgrade the dependency of tdlight-java
|
|
|
|
cd ~/build
|
|
|
|
git clone git@ssh.git.ignuranza.net:tdlight-team/tdlight-java.git
|
|
|
|
cd tdlight-java
|
|
|
|
git checkout master
|
|
|
|
mvn versions:use-latest-releases -Dincludes=it.tdlight:tdlight-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD
|
|
|
|
rm pom.xml.versionsBackup
|
|
|
|
git add pom.xml
|
|
|
|
git commit -m "Upgrade $TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD natives"
|
|
|
|
git push
|