Browse Source

scripts: gha: Android deps and build scripts

pull/2/head
Velaron 1 year ago committed by Alibek Omarov
parent
commit
0073225549
  1. 27
      scripts/gha/build_android.sh
  2. 47
      scripts/gha/deps_android.sh

27
scripts/gha/build_android.sh

@ -1,25 +1,22 @@
#!/bin/bash #!/bin/bash
export ANDROID_SDK_HOME=$GITHUB_WORKSPACE/sdk unset ANDROID_SDK_ROOT
export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle export JAVA_HOME=$GITHUB_WORKSPACE/jdk-17.0.7+7
export ANDROID_HOME=$GITHUB_WORKSPACE/sdk
export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/tools/bin
pushd android pushd android
if [[ "$GH_CPU_ARCH" == "32" ]]; then
export ARCHS="armeabi armeabi-v7a x86"
elif [[ "$GH_CPU_ARCH" == "64" ]]; then
export ARCHS="aarch64 x86_64"
elif [[ "$GH_CPU_ARCH" == "32&64" ]]; then
export ARCHS="armeabi armeabi-v7a x86 aarch64 x86_64"
fi
sh compile.sh release ./gradlew assembleContinuous
pushd app/build/outputs/apk/continuous
$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks $GITHUB_WORKSPACE/android/debug.keystore --ks-key-alias androiddebugkey \
--ks-pass pass:android --key-pass pass:android --out app-continuous-signed.apk app-continuous-unsigned.apk
popd
popd popd
mkdir -p artifacts/ mkdir -p artifacts/
if [[ "$GH_CPU_ARCH" == "64" ]]; then mv android/app/build/outputs/apk/continuous/app-continuous-signed.apk artifacts/xash3d-fwgs-android.apk
mv android/xashdroid.apk artifacts/xashdroid-64.apk
else
mv android/xashdroid.apk artifacts/xashdroid-32.apk
fi

47
scripts/gha/deps_android.sh

@ -1,38 +1,43 @@
#!/bin/bash #!/bin/bash
echo "Download HLSDK"
cd $GITHUB_WORKSPACE cd $GITHUB_WORKSPACE
git clone --depth 1 --recursive https://github.com/FWGS/hlsdk-xash3d -b mobile_hacks hlsdk || exit 1
echo "Download and unpack Android SDK" echo "Download JDK 17"
wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz -qO jdk.tar.gz || exit 1
tar -xzf jdk.tar.gz
export JAVA_HOME=$GITHUB_WORKSPACE/jdk-17.0.7+7
export PATH=$PATH:$JAVA_HOME/bin
echo "Download hlsdk-portable"
git clone --depth 1 --recursive https://github.com/FWGS/hlsdk-portable -b mobile_hacks hlsdk || exit 1
echo "Download Android SDK"
mkdir -p sdk || exit 1 mkdir -p sdk || exit 1
pushd sdk pushd sdk
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -qO sdk.zip > /dev/null || exit 1 wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -qO sdk.zip || exit 1
unzip -q sdk.zip || exit 1 unzip -q sdk.zip || exit 1
mv cmdline-tools tools
mkdir -p cmdline-tools
mv tools cmdline-tools/tools
unset ANDROID_SDK_ROOT
export ANDROID_HOME=$GITHUB_WORKSPACE/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/tools/bin
popd popd
echo "Download all needed tools and NDK" echo "Download all needed tools and Android NDK"
yes | sdk/tools/bin/sdkmanager --licenses > /dev/null 2>/dev/null # who even reads licenses? :) yes | sdkmanager --licenses > /dev/null 2>/dev/null # who even reads licenses? :)
sdk/tools/bin/sdkmanager --install build-tools\;29.0.1 platform-tools platforms\;android-29 > /dev/null 2>/dev/null sdkmanager --install build-tools\;34.0.0 platform-tools platforms\;android-34 ndk\;26.0.10792818
wget https://dl.google.com/android/repository/android-ndk-r25-linux.zip -qO ndk.zip > /dev/null || exit 1
unzip -q ndk.zip || exit 1
mv android-ndk-r25 sdk/ndk-bundle || exit 1
echo "Download Xash3D FWGS Android source" echo "Download Xash3D FWGS Android source code"
git clone --depth 1 https://github.com/FWGS/xash3d-android-project -b waf android || exit 1 git clone --depth 1 --recursive https://github.com/Velaron/xash3d-android-project -b gradle android || exit 1
pushd android pushd android/app/src/main/cpp
mv xash3d-fwgs xash3d-fwgs-sub mv xash3d-fwgs xash3d-fwgs-sub
ln -s $GITHUB_WORKSPACE xash3d-fwgs ln -s $GITHUB_WORKSPACE xash3d-fwgs
echo "Installed Xash3D FWGS source symlink" echo "Installed Xash3D FWGS source symlink"
mv hlsdk-xash3d hlsdk-xash3d-sub mv hlsdk-portable hlsdk-portable-sub
ln -s $GITHUB_WORKSPACE/hlsdk hlsdk-xash3d ln -s $GITHUB_WORKSPACE/hlsdk hlsdk-portable
echo "Installed HLSDK source symlink" echo "Installed hlsdk-portable source symlink"
mv xash-extras xash-extras-sub
ln -s $GITHUB_WORKSPACE/xash-extras xash-extras
echo "Installed xash-extras symlink"
popd popd

Loading…
Cancel
Save