fix: android ci

opt: android ci

opt: bridge compile time

fix: android sign

fix: android so

opt: format
This commit is contained in:
Kingtous 2022-11-28 20:20:45 +08:00
parent 8b1449cf8b
commit 99d6ec2697
5 changed files with 70 additions and 26 deletions

View File

@ -302,7 +302,7 @@ jobs:
- name: Install prerequisites - name: Install prerequisites
run: | run: |
sudo apt update -y sudo apt update -y
sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang cmake libclang-dev ninja-build llvm-dev libclang-10-dev llvm-10-dev pkg-config
- name: Install Rust toolchain - name: Install Rust toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@ -315,6 +315,7 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
prefix-key: bridge-${{ matrix.job.os }} prefix-key: bridge-${{ matrix.job.os }}
workspace: "/tmp/flutter_rust_bridge/frb_codegen"
- name: Cache Bridge - name: Cache Bridge
id: cache-bridge id: cache-bridge
@ -328,6 +329,7 @@ jobs:
with: with:
channel: "stable" channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }} flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install ffigen - name: Install ffigen
run: | run: |
@ -355,7 +357,7 @@ jobs:
build-rustdesk-android-arm64: build-rustdesk-android-arm64:
needs: [generate-bridge-linux] needs: [generate-bridge-linux]
name: build-rust-lib-android-arm64 ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] name: build rustdesk android apk ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}]
runs-on: ${{ matrix.job.os }} runs-on: ${{ matrix.job.os }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -367,13 +369,24 @@ jobs:
os: ubuntu-18.04, os: ubuntu-18.04,
extra-build-features: "", extra-build-features: "",
} }
# - {
# arch: x86_64,
# target: armv7-linux-androideabi,
# os: ubuntu-18.04,
# extra-build-features: "",
# }
steps: steps:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt update sudo apt update
sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ libc6-dev g++-multilib sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ libc6-dev gcc-multilib g++-multilib openjdk-11-jdk-headless
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
- uses: nttld/setup-ndk@v1 - uses: nttld/setup-ndk@v1
id: setup-ndk id: setup-ndk
with: with:
@ -408,43 +421,73 @@ jobs:
- name: Disable rust bridge build - name: Disable rust bridge build
run: | run: |
sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs
# only build cdylib
sed -i "s/\[\"cdylib\", \"staticlib\", \"rlib\"\]/\[\"cdylib\"\]/g" Cargo.toml - name: Build rustdesk lib
- name: Build rustdesk arm64 so
env: env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
VCPKG_ROOT: /opt/vcpkg VCPKG_ROOT: /opt/vcpkg
run: | run: |
rustup target add aarch64-linux-android rustup target add ${{ matrix.job.target }}
cargo install cargo-ndk cargo install cargo-ndk
./flutter/ndk_arm64.sh case ${{ matrix.job.target }} in
mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a aarch64-linux-android)
cp ./target/aarch64-linux-android/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so ./flutter/ndk_arm64.sh
mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
;;
armv7-linux-androideabi)
./flutter/ndk_arm.sh
mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
;;
esac
- name: Build rustdesk - name: Build rustdesk
shell: bash shell: bash
env:
JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64
run: | run: |
export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH
# download so
pushd flutter pushd flutter
flutter build apk --release --target-platform android-arm64 --split-per-abi wget -O so.tar.gz https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/so.tar.gz
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../rustdesk-${{ env.VERSION }}-arm64-v8a-release.apk tar xzvf so.tar.gz
popd
# temporary use debug sign config
sed -i "s/signingConfigs.release/signingConfigs.debug/g" ./flutter/android/app/build.gradle
case ${{ matrix.job.target }} in
aarch64-linux-android)
mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
# build flutter
pushd flutter
flutter build apk --release --target-platform android-arm64 --split-per-abi
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk
;;
armv7-linux-androideabi)
mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a
cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
# build flutter
pushd flutter
flutter build apk --release --target-platform android-arm --split-per-abi
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk
;;
esac
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
with: with:
name: rustdesk-${{ env.VERSION }}-arm64-v8a-release.apk name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk
path: rustdesk-${{ env.VERSION }}-arm64-v8a-release.apk path: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk
- name: Publish apk package - name: Publish apk package
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
prerelease: true prerelease: true
tag_name: ${{ env.TAG_NAME }} tag_name: ${{ env.TAG_NAME }}
files: | files: |
rustdesk-${{ env.VERSION }}-arm64-v8a-release.apk rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk
build-rustdesk-lib-linux-amd64: build-rustdesk-lib-linux-amd64:
needs: [generate-bridge-linux, build-vcpkg-deps-linux] needs: [generate-bridge-linux, build-vcpkg-deps-linux]
@ -678,7 +721,6 @@ jobs:
key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }}
cache-directories: "/opt/rust-registry" cache-directories: "/opt/rust-registry"
- name: Install local registry - name: Install local registry
run: | run: |
mkdir -p /opt/rust-registry mkdir -p /opt/rust-registry
@ -907,7 +949,6 @@ jobs:
mv "$name" "/opt/artifacts/rpm/${name%%.rpm}-fedora28-centos8.rpm" mv "$name" "/opt/artifacts/rpm/${name%%.rpm}-fedora28-centos8.rpm"
done done
- name: Rename rustdesk - name: Rename rustdesk
shell: bash shell: bash
run: | run: |
@ -1208,7 +1249,7 @@ jobs:
# apt install -y rpm # apt install -y rpm
# run: | # run: |
# pushd /workspace # pushd /workspace
# # install # # install
# apt update -y # apt update -y
# apt install -y flatpak flatpak-builder cmake g++ gcc git curl wget nasm yasm libgtk-3-dev git # apt install -y flatpak flatpak-builder cmake g++ gcc git curl wget nasm yasm libgtk-3-dev git
# # flatpak deps # # flatpak deps

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cargo ndk --platform 21 --target armv7-linux-androideabi build --release cargo ndk --platform 21 --target armv7-linux-androideabi build --release --features flutter

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cargo ndk --platform 21 --target aarch64-linux-android build --release cargo ndk --platform 21 --target aarch64-linux-android build --release --features flutter

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cargo ndk --platform 21 --target x86_64-linux-android build --release cargo ndk --platform 21 --target x86_64-linux-android build --release --features flutter

View File

@ -876,7 +876,10 @@ pub fn check_zombie(children: Children) {
} }
pub fn start_option_status_sync() { pub fn start_option_status_sync() {
let _sender = SENDER.lock().unwrap(); #[cfg(not(any(target_os = "android", target_os = "ios")))]
{
let _sender = SENDER.lock().unwrap();
}
} }
// not call directly // not call directly