ci: separate android runner, github release download, telegram notifications and release upload
Reviewed-on: https://code.gri.mw/GUI/grim/pulls/33
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- run: mkdir release
|
||||
- name: Setup Java build
|
||||
run: |
|
||||
chmod +x android/gradlew
|
||||
echo "${{ secrets.ANDROID_KEYSTORE }}" > release.keystore.txt
|
||||
base64 -d release.keystore.txt > android/keystore
|
||||
echo "${{ secrets.ANDROID_KEYSTORE_PROPS }}" > release.keystore.props.txt
|
||||
base64 -d release.keystore.props.txt > android/keystore.properties
|
||||
- name: Release APKs
|
||||
run: |
|
||||
chmod +x scripts/android.sh && ./scripts/android.sh release ${{ inputs.version }}
|
||||
mv android/grim* release
|
||||
- uses: forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: release_android
|
||||
path: release/*
|
||||
@@ -1,10 +1,11 @@
|
||||
name: Test build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- "*"
|
||||
branches-ignore:
|
||||
- master
|
||||
- ci
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -14,4 +15,20 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build
|
||||
run: cargo build --release
|
||||
run: cargo build --release
|
||||
- name: Telegram Notify Channel
|
||||
if: always()
|
||||
uses: actions/telegram-notifier@ardocrat
|
||||
with:
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
chat_id: ${{ secrets.TELEGRAM_CHANNEL_ID }}
|
||||
status: ${{ job.status }}
|
||||
notify_fields: "actor,repository,workflow,branch,commit"
|
||||
- name: Telegram Notify Group
|
||||
if: always()
|
||||
uses: actions/telegram-notifier@ardocrat
|
||||
with:
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
chat_id: ${{ secrets.TELEGRAM_GROUP_ID }}
|
||||
status: ${{ job.status }}
|
||||
notify_fields: "actor,repository,workflow,branch,commit"
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
- name: Checksum AppImage ARM
|
||||
working-directory: release
|
||||
run: sha256sum grim-${{ inputs.version }}-linux-arm.AppImage > grim-${{ inputs.version }}-linux-arm-appimage-sha256sum.txt
|
||||
- uses: forgejo/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release_linux
|
||||
path: release/*
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
- name: Checksum Release Universal
|
||||
working-directory: release
|
||||
run: sha256sum grim-${{ inputs.version }}-macos-universal.zip > grim-${{ inputs.version }}-macos-universal-sha256sum.txt
|
||||
- uses: forgejo/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release_macos
|
||||
path: release/*
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu
|
||||
|
||||
steps:
|
||||
- name: Telegram Notify Channel
|
||||
uses: actions/telegram-notifier@ardocrat
|
||||
with:
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
chat_id: ${{ secrets.TELEGRAM_CHANNEL_ID }}
|
||||
status: ${{ job.status }}
|
||||
notify_fields: "actor,repository"
|
||||
+126
-19
@@ -2,7 +2,6 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- ci
|
||||
tags-ignore:
|
||||
- "*-dev*"
|
||||
|
||||
@@ -12,7 +11,9 @@ jobs:
|
||||
outputs:
|
||||
v: ${{ steps.version.outputs.v }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Get version
|
||||
id: version
|
||||
run: |
|
||||
@@ -34,7 +35,7 @@ jobs:
|
||||
echo "exists=${exists}" >> "$FORGEJO_OUTPUT"
|
||||
echo ${exists}
|
||||
mkdir release
|
||||
- uses: actions/forgejo-release@v2.7.3
|
||||
- uses: ardocrat/forgejo-release@grim
|
||||
if: ${{ forgejo.ref_type == 'tag' && steps.check.outputs.exists == 'true' }}
|
||||
with:
|
||||
direction: download
|
||||
@@ -45,7 +46,7 @@ jobs:
|
||||
if: ${{ forgejo.ref_type == 'tag' && steps.check.outputs.exists == 'true' }}
|
||||
working-directory: release
|
||||
run: for f in *; do mv "$f" "$(echo "$f" | sed s/-dev-/-/)"; done
|
||||
- uses: actions/forgejo-release@v2.7.3
|
||||
- uses: ardocrat/forgejo-release@grim
|
||||
if: ${{ forgejo.ref_type == 'tag' && steps.check.outputs.exists == 'true' }}
|
||||
with:
|
||||
direction: upload
|
||||
@@ -56,22 +57,92 @@ jobs:
|
||||
release-dir: ./release
|
||||
release-notes: ""
|
||||
|
||||
android:
|
||||
android_libs:
|
||||
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
||||
runs-on: ubuntu
|
||||
needs: version
|
||||
uses: ./.forgejo/workflows/android.yaml
|
||||
with:
|
||||
version: ${{ needs.version.outputs.v }}
|
||||
secrets:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
|
||||
ANDROID_KEYSTORE_PROPS: ${{ secrets.ANDROID_KEYSTORE_PROPS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build libs
|
||||
run: |
|
||||
chmod +x scripts/android.sh && ./scripts/android.sh lib ${{ needs.version.outputs.v }}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: libs_android
|
||||
path: android/app/src/main/jniLibs/*
|
||||
|
||||
android_release:
|
||||
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
||||
runs-on: ubuntu-android
|
||||
needs: [version, android_libs]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- run: mkdir libs
|
||||
- name: Download Libs Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: libs
|
||||
pattern: libs_*
|
||||
merge-multiple: true
|
||||
- name: Setup Java build
|
||||
run: |
|
||||
chmod +x android/gradlew
|
||||
echo "${{ secrets.ANDROID_KEYSTORE }}" > release.keystore.txt
|
||||
base64 -d release.keystore.txt > android/keystore
|
||||
echo "${{ secrets.ANDROID_KEYSTORE_PROPS }}" > release.keystore.props.txt
|
||||
base64 -d release.keystore.props.txt > android/keystore.properties
|
||||
- name: Prepare build
|
||||
run: |
|
||||
mkdir release
|
||||
chmod +x android/gradlew
|
||||
- name: Release ARMv7+v8 APK
|
||||
working-directory: android
|
||||
run: |
|
||||
jni_path=app/src/main/jniLibs
|
||||
mkdir ${jni_path}
|
||||
mv ../libs/armeabi-v7a ${jni_path}
|
||||
mv ../libs/arm64-v8a ${jni_path}
|
||||
./gradlew assembleSignedRelease
|
||||
apk_path=app/build/outputs/apk/signedRelease/app-signedRelease.apk
|
||||
name=grim-${{ needs.version.outputs.v }}-android.apk
|
||||
mv ${apk_path} "${name}"
|
||||
- name: Checksum ARM APK
|
||||
working-directory: android
|
||||
run: |
|
||||
name=grim-${{ needs.version.outputs.v }}-android.apk
|
||||
checksum=grim-${{ needs.version.outputs.v }}-android-sha256sum.txt
|
||||
sha256sum "${name}" > "${checksum}"
|
||||
- name: Release x86_64 APK
|
||||
working-directory: android
|
||||
run: |
|
||||
./gradlew clean
|
||||
jni_path=app/src/main/jniLibs
|
||||
rm -rf ${jni_path}/*
|
||||
mv ../libs/x86_64 ${jni_path}
|
||||
./gradlew assembleSignedRelease
|
||||
apk_path=app/build/outputs/apk/signedRelease/app-signedRelease.apk
|
||||
name=grim-${{ needs.version.outputs.v }}-android-x86_64.apk
|
||||
mv ${apk_path} "${name}"
|
||||
- name: Checksum x86_64 APK
|
||||
working-directory: android
|
||||
run: |
|
||||
name=grim-${{ needs.version.outputs.v }}-android.apk
|
||||
checksum=grim-${{ needs.version.outputs.v }}-android-x86_64-sha256sum.txt
|
||||
sha256sum "${name}" > "${checksum}"
|
||||
- run: mv android/grim* release
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release_android
|
||||
path: release/*
|
||||
|
||||
linux:
|
||||
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
||||
runs-on: ubuntu
|
||||
needs: [version, android]
|
||||
needs: [version, android_libs, android_release]
|
||||
uses: ./.forgejo/workflows/linux.yaml
|
||||
with:
|
||||
version: ${{ needs.version.outputs.v }}
|
||||
@@ -81,7 +152,7 @@ jobs:
|
||||
macos:
|
||||
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
||||
runs-on: ubuntu
|
||||
needs: [version, android, linux]
|
||||
needs: [version, android_libs, android_release, linux]
|
||||
uses: ./.forgejo/workflows/macos.yaml
|
||||
with:
|
||||
version: ${{ needs.version.outputs.v }}
|
||||
@@ -91,7 +162,7 @@ jobs:
|
||||
windows:
|
||||
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
||||
runs-on: ubuntu
|
||||
needs: [version, android, linux, macos]
|
||||
needs: [version, android_libs, android_release, linux, macos]
|
||||
uses: ./.forgejo/workflows/windows.yaml
|
||||
with:
|
||||
version: ${{ needs.version.outputs.v }}
|
||||
@@ -101,16 +172,17 @@ jobs:
|
||||
release:
|
||||
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
||||
runs-on: ubuntu
|
||||
needs: [version, android, linux, macos, windows]
|
||||
needs: [version, android_libs, android_release, linux, macos, windows]
|
||||
steps:
|
||||
- run: mkdir release
|
||||
- name: Download All Artifacts
|
||||
uses: forgejo/download-artifact@v4
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release
|
||||
pattern: release_*
|
||||
merge-multiple: true
|
||||
- uses: actions/forgejo-release@v2.7.3
|
||||
- name: Upload release to Forgejo
|
||||
uses: ardocrat/forgejo-release@grim
|
||||
with:
|
||||
direction: upload
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
@@ -118,4 +190,39 @@ jobs:
|
||||
override: true
|
||||
prerelease: ${{ needs.version.outputs.pre }}
|
||||
release-dir: release
|
||||
release-notes: ""
|
||||
release-notes: ""
|
||||
- name: Telegram Notify Channel
|
||||
if: always()
|
||||
uses: actions/telegram-notifier@ardocrat
|
||||
with:
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
chat_id: ${{ secrets.TELEGRAM_CHANNEL_ID }}
|
||||
status: ${{ job.status }}
|
||||
notify_fields: "actor,repository,workflow,branch,commit"
|
||||
- name: Telegram Notify Group
|
||||
if: always()
|
||||
uses: actions/telegram-notifier@ardocrat
|
||||
with:
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
chat_id: ${{ secrets.TELEGRAM_GROUP_ID }}
|
||||
status: ${{ job.status }}
|
||||
notify_fields: "actor,repository,workflow,branch,commit"
|
||||
- name: Upload files to Telegram
|
||||
uses: actions/tg-file@main
|
||||
with:
|
||||
api-url: ${{ secrets.TELEGRAM_API_URL }}
|
||||
chat-id: |
|
||||
${{ secrets.TELEGRAM_CHANNEL_ID }}
|
||||
${{ secrets.TELEGRAM_GROUP_ID }}
|
||||
body: "🎁 Release ${{ needs.version.outputs.v }} is ready!"
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
pin: true
|
||||
files: |
|
||||
release/grim-${{ needs.version.outputs.v }}-android.apk
|
||||
release/grim-${{ needs.version.outputs.v }}-android-x86_64.apk
|
||||
release/grim-${{ needs.version.outputs.v }}-linux-arm.AppImage
|
||||
release/grim-${{ needs.version.outputs.v }}-linux-x86_64.AppImage
|
||||
release/grim-${{ needs.version.outputs.v }}-macos-arm.zip
|
||||
release/grim-${{ needs.version.outputs.v }}-macos-x86_64.zip
|
||||
release/grim-${{ needs.version.outputs.v }}-macos-universal.zip
|
||||
release/grim-${{ needs.version.outputs.v }}-win-x86_64.zip
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Checksum Archive x86
|
||||
working-directory: release
|
||||
run: sha256sum grim-${{ inputs.version }}-win-x86_64.zip > grim-${{ inputs.version }}-win-x86_64-sha256sum.txt
|
||||
- uses: forgejo/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release_windows
|
||||
path: release/*
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
HOST=https://code.gri.mw
|
||||
REPO_NAME=$1
|
||||
TAG=$2
|
||||
DOWNLOAD_URL=${HOST}/${REPO_NAME}/releases/download/${TAG}
|
||||
|
||||
FILES=( "grim-${TAG}-android.apk" "grim-${TAG}-android-x86_64.apk" "grim-${TAG}-linux-arm.AppImage" "grim-${TAG}-linux-x86_64.AppImage" "grim-${TAG}-macos-arm.zip" "grim-${TAG}-macos-x86_64.zip" "grim-${TAG}-macos-universal.zip" "grim-${TAG}-win-x86_64.zip" )
|
||||
|
||||
# Download release files
|
||||
for f in "${FILES[@]}"; do
|
||||
wget -q ${DOWNLOAD_URL}/${f}
|
||||
echo Downloading ${f}...
|
||||
while [ ! -f ${f} ]; do
|
||||
sleep 5
|
||||
echo Retry ${f}...
|
||||
wget -q ${DOWNLOAD_URL}/${f}
|
||||
done
|
||||
done
|
||||
|
||||
# Save release notes
|
||||
INFO_URL=${HOST}/api/v1/repos/${REPO_NAME}/releases/tags/${TAG}
|
||||
curl -s "${INFO_URL}" | jq -r '.body' > release_notes.txt
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
create_release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Download release
|
||||
run: chmod +x .github/download_release.sh && .github/download_release.sh ${{ github.repository }} ${{ github.ref_name }}
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body_path: release_notes.txt
|
||||
overwrite_files: true
|
||||
files: |
|
||||
grim-${{ github.ref_name }}-android.apk
|
||||
grim-${{ github.ref_name }}-android-x86_64.apk
|
||||
grim-${{ github.ref_name }}-linux-arm.AppImage
|
||||
grim-${{ github.ref_name }}-linux-x86_64.AppImage
|
||||
grim-${{ github.ref_name }}-macos-arm.zip
|
||||
grim-${{ github.ref_name }}-macos-x86_64.zip
|
||||
grim-${{ github.ref_name }}-macos-universal.zip
|
||||
grim-${{ github.ref_name }}-win-x86_64.zip
|
||||
@@ -3,8 +3,9 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 36
|
||||
ndkVersion '26.0.10792818'
|
||||
compileSdk = 36
|
||||
ndkVersion '29.0.14206865'
|
||||
buildToolsVersion = '36.1.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "mw.gri.android"
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/>
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
|
||||
<application
|
||||
android:hardwareAccelerated="true"
|
||||
|
||||
@@ -13,10 +13,8 @@ import android.provider.Settings;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.util.Log;
|
||||
import android.util.Size;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
@@ -26,7 +24,6 @@ import androidx.camera.lifecycle.ProcessCameraProvider;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.os.BuildCompat;
|
||||
import androidx.core.view.DisplayCutoutCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
@@ -62,7 +59,6 @@ public class MainActivity extends GameActivity {
|
||||
};
|
||||
|
||||
private final ImageAnalysis mImageAnalysis = new ImageAnalysis.Builder()
|
||||
.setTargetResolution(new Size(640, 480))
|
||||
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '8.13.1' apply false
|
||||
id 'com.android.library' version '8.13.1' apply false
|
||||
id 'com.android.application' version '8.10.0' apply false
|
||||
id 'com.android.library' version '8.10.0' apply false
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#Mon May 02 15:39:12 BST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://code.gri.mw/ardocrat/gradle/releases/download/v8.13/gradle-8.13-bin.zip
|
||||
distributionUrl=https\://code.gri.mw/ardocrat/gradle/releases/download/v8.11.1/gradle-8.11.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+22
-16
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage="Usage: android.sh [type] [platform|version]\n - type: 'build', 'release'\n - platform, for 'build' type: 'v7', 'v8', 'x86'\n - version for 'release', example: '0.2.2'"
|
||||
usage="Usage: android.sh [type] [platform|version]\n - type: 'build' to run locally, 'lib' - .so for all platforms, 'release' - .apk for all platforms\n - platform, for 'build' type: 'v7', 'v8', 'x86'\n - version for 'lib' and 'release', example: '0.2.2'"
|
||||
case $1 in
|
||||
build|release)
|
||||
build|lib|release)
|
||||
;;
|
||||
*)
|
||||
printf "$usage"
|
||||
@@ -42,18 +42,12 @@ function build_lib() {
|
||||
sed -i -e 's/"rlib"]/"cdylib","rlib"]/g' Cargo.toml
|
||||
|
||||
# Fix for https://stackoverflow.com/questions/57193895/error-use-of-undeclared-identifier-pthread-mutex-robust-cargo-build-liblmdb-s
|
||||
# Comment 3 lines below for faster 2nd+ build:
|
||||
export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0"
|
||||
cargo ndk -t ${arch} build --profile release-apk
|
||||
unset CPPFLAGS && unset CFLAGS
|
||||
|
||||
cargo ndk -t "${arch}" -o android/app/src/main/jniLibs build --profile release-apk
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
success=1
|
||||
else
|
||||
if [ $? -ne 0 ]; then
|
||||
success=0
|
||||
fi
|
||||
unset CPPFLAGS && unset CFLAGS
|
||||
|
||||
sed -i -e 's/"cdylib","rlib"]/"rlib"]/g' Cargo.toml
|
||||
rm -f Cargo.toml-e
|
||||
@@ -66,13 +60,19 @@ function build_apk() {
|
||||
# Build signed apk if keystore exists
|
||||
if [ ! -f keystore.properties ]; then
|
||||
./gradlew assembleDebug
|
||||
if [ $? -ne 0 ]; then
|
||||
success=0
|
||||
fi
|
||||
apk_path=app/build/outputs/apk/debug/app-debug.apk
|
||||
else
|
||||
./gradlew assembleSignedRelease
|
||||
if [ $? -ne 0 ]; then
|
||||
success=0
|
||||
fi
|
||||
apk_path=app/build/outputs/apk/signedRelease/app-signedRelease.apk
|
||||
fi
|
||||
|
||||
if [[ $1 == "" ]]; then
|
||||
if [[ $1 == "" ]] && [ $success -eq 1 ]; then
|
||||
# Launch application at all connected devices.
|
||||
for SERIAL in $(adb devices | grep -v List | cut -f 1);
|
||||
do
|
||||
@@ -80,7 +80,7 @@ function build_apk() {
|
||||
sleep 1s
|
||||
adb -s "$SERIAL" shell am start -n mw.gri.android/.MainActivity;
|
||||
done
|
||||
else
|
||||
elif [ $success -eq 1 ]; then
|
||||
# Get version
|
||||
version=$2
|
||||
if [[ -z "$version" ]]; then
|
||||
@@ -91,7 +91,6 @@ function build_apk() {
|
||||
[[ $1 == "arm" ]] && name=grim-${version}-android.apk
|
||||
rm -f "${name}"
|
||||
mv ${apk_path} "${name}"
|
||||
|
||||
# Calculate checksum
|
||||
checksum=grim-${version}-android-$1-sha256sum.txt
|
||||
[[ $1 == "arm" ]] && checksum=grim-${version}-android-sha256sum.txt
|
||||
@@ -103,20 +102,27 @@ function build_apk() {
|
||||
}
|
||||
|
||||
rm -rf android/app/src/main/jniLibs/*
|
||||
|
||||
if [[ $1 == "build" ]]; then
|
||||
if [[ $1 == "lib" ]]; then
|
||||
build_lib "v7"
|
||||
[ $success -eq 1 ] && build_lib "v8"
|
||||
[ $success -eq 1 ] && build_lib "x86"
|
||||
[ $success -eq 1 ] && exit 0
|
||||
elif [[ $1 == "build" ]]; then
|
||||
build_lib "$2"
|
||||
[ $success -eq 1 ] && build_apk
|
||||
[ $success -eq 1 ] && exit 0
|
||||
else
|
||||
rm -rf target/release-apk
|
||||
rm -rf target/aarch64-linux-android
|
||||
rm -rf target/x86_64-linux-android
|
||||
rm -rf target/armv7-linux-androideabi
|
||||
|
||||
build_lib "v7"
|
||||
[ $success -eq 1 ] && build_lib "v8"
|
||||
[ $success -eq 1 ] && build_apk "arm" "$2"
|
||||
rm -rf android/app/src/main/jniLibs/*
|
||||
[ $success -eq 1 ] && build_lib "x86"
|
||||
[ $success -eq 1 ] && build_apk "x86_64" "$2"
|
||||
[ $success -eq 1 ] && exit 0
|
||||
fi
|
||||
|
||||
exit 1
|
||||
Reference in New Issue
Block a user