From 1491dea9d81473cb66070e280226e1470da6228c Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 21 Nov 2022 17:10:38 +0800 Subject: [PATCH] fix: nightly build --- .github/workflows/flutter-nightly.yml | 372 ++++++++++++++++++++------ build.py | 35 ++- 2 files changed, 309 insertions(+), 98 deletions(-) diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 0b49b9893..76b82044d 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -10,7 +10,9 @@ env: LLVM_VERSION: "10.0" FLUTTER_VERSION: "3.0.5" TAG_NAME: "nightly" - VCPKG_COMMIT_ID: '6ca56aeb457f033d344a7106cb3f9f1abf8f4e98' + # vcpkg version: 2022.05.10 + # for multiarch gcc compatibility + VCPKG_COMMIT_ID: "14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44" VERSION: "1.2.0" jobs: @@ -23,7 +25,7 @@ jobs: job: # - { target: i686-pc-windows-msvc , os: windows-2019 } # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - - { target: x86_64-pc-windows-msvc , os: windows-2019 } + - { target: x86_64-pc-windows-msvc, os: windows-2019 } steps: - name: Checkout source code uses: actions/checkout@v3 @@ -36,9 +38,9 @@ jobs: - name: Install flutter uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" flutter-version: ${{ env.FLUTTER_VERSION }} - + - name: Replace engine with rustdesk custom flutter engine run: | flutter doctor -v @@ -100,18 +102,22 @@ jobs: files: | rustdesk-*.exe - builf-for-macOS: + build-for-macOS: name: ${{ matrix.job.target }} (${{ matrix.job.os }},${{ matrix.job.extra-build-args }}) runs-on: ${{ matrix.job.os }} strategy: fail-fast: false matrix: job: - - { target: x86_64-apple-darwin , os: macos-10.15, extra-build-args: ""} + - { + target: x86_64-apple-darwin, + os: macos-10.15, + extra-build-args: "", + } steps: - name: Checkout source code uses: actions/checkout@v3 - + - name: Install build runtime run: | brew install llvm create-dmg nasm yasm cmake gcc wget ninja @@ -119,7 +125,7 @@ jobs: - name: Install flutter uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" flutter-version: ${{ env.FLUTTER_VERSION }} - name: Install Rust toolchain @@ -143,7 +149,7 @@ jobs: pushd /tmp/flutter_rust_bridge/frb_codegen && cargo install --path . && popd pushd flutter && flutter pub get && popd ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart - + - name: Restore from cache and install vcpkg uses: lukka/run-vcpkg@v7 with: @@ -187,47 +193,85 @@ jobs: files: | rustdesk*-${{ matrix.job.target }}.dmg - build-for-linux: - name: ${{ matrix.job.target }} (${{ matrix.job.os }},${{ matrix.job.extra-build-args }}) + build-vcpkg-deps-linux: runs-on: ${{ matrix.job.os }} strategy: fail-fast: false matrix: job: - # - { target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true } - # - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } - # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } - # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, extra-build-args: ""} - - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, extra-build-args: "--flatpak"} - # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + # - { arch: armv7 , os: ubuntu-18.04} + - { arch: x86_64, os: ubuntu-18.04 } + # - { arch: aarch64 , os: ubuntu-18.04} + steps: + - name: Create vcpkg artifacts folder + run: mkdir -p /opt/artifacts + + - name: Cache Vcpkg + id: cache-vcpkg + uses: actions/cache@v3 + with: + path: /opt/artifacts + key: vcpkg-${{ matrix.job.arch }} + + - uses: Kingtous/run-on-arch-action@amd64-support + name: Run vcpkg install on ${{ matrix.job.arch }} + id: vcpkg + with: + arch: ${{ matrix.job.arch }} + distro: ubuntu18.04 + githubToken: ${{ github.token }} + setup: | + ls -l "/opt/artifacts" + dockerRunArgs: | + --volume "/opt/artifacts:/artifacts" + shell: /bin/bash + install: | + apt update -y + # CMake 3.15+ + apt install -y gpg wget ca-certificates + echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null + apt update -y + apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build + cmake --version + gcc -v + run: | + export VCPKG_FORCE_SYSTEM_BINARIES=1 + pushd /artifacts + git clone https://github.com/microsoft/vcpkg.git || true + git config --global --add safe.directory /artifacts/vcpkg || true + pushd vcpkg + git reset --hard ${{ env.VCPKG_COMMIT_ID }} + ./bootstrap-vcpkg.sh + ./vcpkg install libvpx libyuv opus + + - name: Upload artifacts + uses: actions/upload-artifact@master + with: + name: vcpkg-artifact-${{ matrix.job.arch }} + path: | + /opt/artifacts/vcpkg/installed + + generate-bridge-linux: + name: generate bridge + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { + target: x86_64-unknown-linux-gnu, + os: ubuntu-18.04, + extra-build-args: "", + } steps: - name: Checkout source code uses: actions/checkout@v3 - - name: Get build target triple - uses: jungwinter/split@v2 - id: build-target-triple - with: - separator: '-' - msg: ${{ matrix.job.target }} - - name: Install prerequisites run: | - case ${{ matrix.job.target }} in - x86_64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt install -y g++ gcc;; - arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; - aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; - esac - # common package - sudo apt 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 - - - name: Install flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: ${{ env.FLUTTER_VERSION }} + 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 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 @@ -239,49 +283,210 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - prefix-key: ${{ matrix.job.os }} + prefix-key: bridge-${{ matrix.job.os }} + + - name: Cache Bridge + id: cache-bridge + uses: actions/cache@v3 + with: + path: /tmp/flutter_rust_bridge + key: vcpkg-${{ matrix.job.arch }} + + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Install ffigen + run: | + dart pub global activate ffigen --version 5.0.1 - name: Install flutter rust bridge deps shell: bash run: | - dart pub global activate ffigen --version 5.0.1 - # flutter_rust_bridge - pushd /tmp && git clone https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge --depth=1 && popd + pushd /tmp && git clone https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge --depth=1 || true && popd pushd /tmp/flutter_rust_bridge/frb_codegen && cargo install --path . && popd pushd flutter && flutter pub get && popd + + - name: Run flutter rust bridge + run: | ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 + - name: Upload Artifcat + uses: actions/upload-artifact@master with: - setupOnly: true - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + name: bridge-artifact + path: | + ./src/bridge_generated.rs + ./flutter/lib/generated_bridge.dart + ./flutter/lib/generated_bridge.freezed.dart - - name: Install vcpkg dependencies + build-rustdesk-lib-linux: + needs: [generate-bridge-linux, build-vcpkg-deps-linux] + name: build-rust-lib ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true, extra-build-features: "" } + # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true, extra-build-features: "flatpak" } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-18.04, use-cross: true, extra-build-features: "" } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-18.04, use-cross: true, extra-build-features: "flatpak" } + # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } + # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + - { + arch: x86_64, + target: x86_64-unknown-linux-gnu, + os: ubuntu-18.04, + extra-build-features: "", + } + - { + arch: x86_64, + target: x86_64-unknown-linux-gnu, + os: ubuntu-18.04, + extra-build-features: "flatpak", + } + # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: bridge-${{ matrix.job.os }} + + - name: Disable rust bridge build run: | + sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Restore vcpkg files + uses: actions/download-artifact@master + with: + name: vcpkg-artifact-${{ matrix.job.arch }} + path: /opt/artifacts/vcpkg/installed + + - name: Output devs + run: | + ls -l ./ + tree -L 3 /opt/artifacts/vcpkg/installed + + - name: Install prerequisites + run: | + sudo apt update -y case ${{ matrix.job.target }} in - x86_64-unknown-linux-gnu) $VCPKG_ROOT/vcpkg install libvpx libyuv opus;; - arm-unknown-linux-*) $VCPKG_ROOT/vcpkg install libvpx:arm-linux libyuv:arm-linux opus:arm-linux;; - aarch64-unknown-linux-gnu) $VCPKG_ROOT/vcpkg install libvpx:arm64-linux libyuv:arm64-linux opus:arm64-linux;; + x86_64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt install -y g++ gcc;; + arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; + aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; esac - shell: bash + # common package + sudo apt 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 - - name: Install cargo bundle tools + - name: Build rustdesk lib run: | - cargo install cargo-bundle + export VCPKG_ROOT=/opt/artifacts/vcpkg + cargo build --lib --features hwcodec,flutter,${{ matrix.job.extra-build-features }} --release - - name: Show version information (Rust, cargo, GCC) - shell: bash + - name: Upload Artifacts + uses: actions/upload-artifact@master + with: + name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so + path: target/release/liblibrustdesk.so + + build-rustdesk-linux: + needs: [build-rustdesk-lib-linux] + name: build-rustdesk ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true, extra-build-features: "" } + # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true, extra-build-features: "flatpak" } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-18.04, use-cross: true, extra-build-features: "" } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-18.04, use-cross: true, extra-build-features: "flatpak" } + # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } + # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + - { + arch: x86_64, + target: x86_64-unknown-linux-gnu, + os: ubuntu-18.04, + extra-build-features: "", + } + - { + arch: x86_64, + target: x86_64-unknown-linux-gnu, + os: ubuntu-18.04, + extra-build-features: "flatpak", + } + # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Prepare env run: | - gcc --version || true - rustup -V - rustup toolchain list - rustup default - cargo -V - rustc -V + sudo apt update -y + sudo apt install -y git curl wget nasm yasm libgtk-3-dev + mkdir -p ./target/release/ - - name: Build rustdesk - run: ./build.py --flutter --hwcodec ${{ matrix.job.extra-build-args }} + - name: Restore rust lib files + uses: actions/download-artifact@master + with: + name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so + path: ./target/release/liblibrustdesk.so + + - uses: Kingtous/run-on-arch-action@amd64-support + name: Run vcpkg install on ${{ matrix.job.arch }} + id: vcpkg + with: + arch: ${{ matrix.job.arch }} + distro: ubuntu18.04 + githubToken: ${{ github.token }} + setup: | + ls -l "${PWD}" + dockerRunArgs: | + --volume "${PWD}:/workspace" + --volume "/opt/artifacts:/opt/artifacts" + shell: /bin/bash + install: | + apt update -y + apt install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev + run: | + # disable git safe.directory + git config --global --add safe.directory "*" + # Setup Flutter + pushd /opt + wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz + tar xf flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz + ls -l . + export PATH=/opt/flutter/bin:$PATH + flutter doctor -v + pushd /workspace + python3 ./build.py --flutter --hwcodec --skip-cargo - name: Rename rustdesk shell: bash @@ -297,21 +502,21 @@ jobs: tag_name: ${{ env.TAG_NAME }} files: | rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb - + - name: Upload Artifcat uses: actions/upload-artifact@master - if: ${{ contains(matrix.job.extra-build-args, 'flatpak') }} + if: ${{ contains(matrix.job.extra-build-features, 'flatpak') }} with: name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb path: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb - name: Patch archlinux PKGBUILD - if: ${{ matrix.job.extra-build-args == '' }} + if: ${{ matrix.job.extra-build-features == '' }} run: | - sed -i "s/arch=('x86_64')/arch=('${{ steps.build-target-triple.outputs._0 }}')/g" res/PKGBUILD + sed -i "s/arch=('x86_64')/arch=('${{ matrix.job.arch }}')/g" res/PKGBUILD - name: Build archlinux package - if: ${{ matrix.job.extra-build-args == '' }} + if: ${{ matrix.job.extra-build-features == '' }} uses: vufa/arch-makepkg-action@master with: packages: > @@ -346,7 +551,7 @@ jobs: cd res && HBB=`pwd`/.. FLUTTER=1 makepkg -f - name: Publish archlinux package - if: ${{ matrix.job.extra-build-args == '' }} + if: ${{ matrix.job.extra-build-features == '' }} uses: softprops/action-gh-release@v1 with: prerelease: true @@ -356,40 +561,34 @@ jobs: - name: Make RPM package shell: bash - if: ${{ matrix.job.extra-build-args == '' }} + if: ${{ matrix.job.extra-build-features == '' }} run: | sudo apt install -y rpm HBB=`pwd` rpmbuild ./res/rpm-flutter.spec -bb - pushd ~/rpmbuild/RPMS/${{ steps.build-target-triple.outputs._0 }} + pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }} for name in rustdesk*??.rpm; do mv "$name" "${name%%.rpm}-fedora28-centos8.rpm" done - name: Publish fedora28/centos8 package - if: ${{ matrix.job.extra-build-args == '' }} + if: ${{ matrix.job.extra-build-features == '' }} uses: softprops/action-gh-release@v1 with: prerelease: true tag_name: ${{ env.TAG_NAME }} files: | - /home/runner/rpmbuild/RPMS/${{ steps.build-target-triple.outputs._0 }}/*.rpm + /home/runner/rpmbuild/RPMS/${{ matrix.job.arch }}/*.rpm build-flatpak: name: Build Flatpak - needs: [build-for-linux] + needs: [build-rustdesk-linux] runs-on: ${{ matrix.job.os }} strategy: fail-fast: false matrix: job: - - { target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true } - # - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } - # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } - # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - # - { target: x86_64-apple-darwin , os: macos-10.15 } - - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, arch: x86_64} - # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + # - { target: aarch64-unknown-linux-gnu , os: ubuntu-18.04, use-cross: true, arch: arm64 } + - { target: x86_64-unknown-linux-gnu, os: ubuntu-18.04, arch: x86_64 } steps: - name: Checkout source code uses: actions/checkout@v3 @@ -404,11 +603,11 @@ jobs: with: name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb path: . - - - name: Rename Binary + + - name: Rename Binary run: | mv rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb rustdesk-${{ env.VERSION }}.deb - + - name: Install Flatpak deps run: | flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo @@ -429,4 +628,3 @@ jobs: tag_name: ${{ env.TAG_NAME }} files: | flatpak/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}.flatpak - diff --git a/build.py b/build.py index 445eb15bf..aa98ec17e 100755 --- a/build.py +++ b/build.py @@ -15,6 +15,7 @@ osx = platform.platform().startswith( hbb_name = 'rustdesk' + ('.exe' if windows else '') exe_path = 'target/release/' + hbb_name flutter_win_target_dir = 'flutter/build/windows/runner/Release/' +skip_cargo = False def get_version(): @@ -87,6 +88,11 @@ def make_parser(): action='store_true', help='Build rustdesk libs with the flatpak feature enabled' ) + parser.add_argument( + '--skip-cargo', + action='store_true', + help='Skip cargo build process, only flutter version + Linux supported currently' + ) return parser @@ -227,8 +233,9 @@ def ffi_bindgen_function_refactor(): def build_flutter_deb(version, features): - os.system(f'cargo build --features {features} --lib --release') - ffi_bindgen_function_refactor() + if not skip_cargo: + os.system(f'cargo build --features {features} --lib --release') + ffi_bindgen_function_refactor() os.chdir('flutter') os.system('flutter build linux --release') os.system('mkdir -p tmpdeb/usr/bin/') @@ -236,7 +243,6 @@ def build_flutter_deb(version, features): os.system('mkdir -p tmpdeb/usr/share/rustdesk/files/systemd/') os.system('mkdir -p tmpdeb/usr/share/applications/') os.system('mkdir -p tmpdeb/usr/share/polkit-1/actions') - os.system('rm tmpdeb/usr/bin/rustdesk') os.system( 'cp -r build/linux/x64/release/bundle/* tmpdeb/usr/lib/rustdesk/') @@ -266,7 +272,8 @@ def build_flutter_deb(version, features): def build_flutter_dmg(version, features): - os.system(f'cargo build --features {features} --lib --release') + if not skip_cargo: + os.system(f'cargo build --features {features} --lib --release') # copy dylib os.system( "cp target/release/liblibrustdesk.dylib target/release/librustdesk.dylib") @@ -282,7 +289,8 @@ def build_flutter_dmg(version, features): def build_flutter_arch_manjaro(version, features): - os.system(f'cargo build --features {features} --lib --release') + if not skip_cargo: + os.system(f'cargo build --features {features} --lib --release') ffi_bindgen_function_refactor() os.chdir('flutter') os.system('flutter build linux --release') @@ -292,10 +300,11 @@ def build_flutter_arch_manjaro(version, features): def build_flutter_windows(version, features): - os.system(f'cargo build --features {features} --lib --release') - if not os.path.exists("target/release/librustdesk.dll"): - print("cargo build failed, please check rust source code.") - exit(-1) + if not skip_cargo: + os.system(f'cargo build --features {features} --lib --release') + if not os.path.exists("target/release/librustdesk.dll"): + print("cargo build failed, please check rust source code.") + exit(-1) os.chdir('flutter') os.system('flutter build windows --release') os.chdir('..') @@ -320,6 +329,7 @@ def build_flutter_windows(version, features): def main(): + global skip_cargo parser = make_parser() args = parser.parse_args() @@ -339,6 +349,9 @@ def main(): flutter = args.flutter if not flutter: os.system('python3 res/inline-sciter.py') + print(args.skip_cargo) + if args.skip_cargo: + skip_cargo = True portable = args.portable if windows: # build virtual display dynamic library @@ -401,8 +414,8 @@ def main(): build_flutter_dmg(version, features) pass else: - os.system( - 'mv target/release/bundle/deb/rustdesk*.deb ./flutter/rustdesk.deb') + # os.system( + # 'mv target/release/bundle/deb/rustdesk*.deb ./flutter/rustdesk.deb') build_flutter_deb(version, features) else: os.system('cargo bundle --release --features ' + features)