From dc883ce902e1c2027f934e53027963cf34c0b202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A3=99=E4=B8=8B=E5=AD=A4=E9=AD=82?= <46797568+zhangbo8418@users.noreply.github.com> Date: Sun, 1 Dec 2024 19:39:57 +0800 Subject: [PATCH] Add files via upload --- ...ter_3.13.9_dropdown_menu_enableFilter.diff | 38 ++++ ...ter_3.19.6_dropdown_menu_enableFilter.diff | 41 ++++ .github/workflows/bridge.yml | 4 +- .github/workflows/flutter-build.yml | 179 ++++++++++++++++-- 4 files changed, 244 insertions(+), 18 deletions(-) create mode 100644 .github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff create mode 100644 .github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff diff --git a/.github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff b/.github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff new file mode 100644 index 000000000000..fb24ee3e93d9 --- /dev/null +++ b/.github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff @@ -0,0 +1,38 @@ +diff --git a/packages/flutter/lib/src/material/dropdown_menu.dart b/packages/flutter/lib/src/material/dropdown_menu.dart +index 7e634cd2aa..c1e9acc295 100644 +--- a/packages/flutter/lib/src/material/dropdown_menu.dart ++++ b/packages/flutter/lib/src/material/dropdown_menu.dart +@@ -287,7 +28,7 @@ class _DropdownMenuState extends State> { + late List buttonItemKeys; + final MenuController _controller = MenuController(); + late final TextEditingController _textEditingController; +- late bool _enableFilter; ++ bool _enableFilter = false; + late List> filteredEntries; + List? _initialMenu; + int? currentHighlight; +@@ -317,4 +317,9 @@ class _DropdownMenuState extends State> { + super.didUpdateWidget(oldWidget); ++ if (oldWidget.enableFilter != widget.enableFilter) { ++ if (!widget.enableFilter) { ++ _enableFilter = false; ++ } ++ } + if (oldWidget.enableSearch != widget.enableSearch) { + if (!widget.enableSearch) { + currentHighlight = null; +@@ -447,5 +451,6 @@ class _DropdownMenuState extends State> { + currentHighlight = widget.enableSearch ? i : null; + widget.onSelected?.call(entry.value); ++ _enableFilter = false; + } + : null, + requestFocusOnHover: false, +@@ -517,5 +521,7 @@ class _DropdownMenuState extends State> { + if (_enableFilter) { + filteredEntries = filter(widget.dropdownMenuEntries, _textEditingController); ++ } else { ++ filteredEntries = widget.dropdownMenuEntries; + } + + if (widget.enableSearch) { diff --git a/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff b/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff new file mode 100644 index 000000000000..7414b4e60043 --- /dev/null +++ b/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff @@ -0,0 +1,41 @@ +diff --git a/packages/flutter/lib/src/material/dropdown_menu.dart b/packages/flutter/lib/src/material/dropdown_menu.dart +index 7e634cd2aa..c1e9acc295 100644 +--- a/packages/flutter/lib/src/material/dropdown_menu.dart ++++ b/packages/flutter/lib/src/material/dropdown_menu.dart +@@ -348,7 +348,7 @@ class _DropdownMenuState extends State> { + final GlobalKey _leadingKey = GlobalKey(); + late List buttonItemKeys; + final MenuController _controller = MenuController(); +- late bool _enableFilter; ++ bool _enableFilter = false; + late List> filteredEntries; + List? _initialMenu; + int? currentHighlight; +@@ -393,6 +393,11 @@ class _DropdownMenuState extends State> { + _localTextEditingController = null; + } + } ++ if (oldWidget.enableFilter != widget.enableFilter) { ++ if (!widget.enableFilter) { ++ _enableFilter = false; ++ } ++ } + if (oldWidget.enableSearch != widget.enableSearch) { + if (!widget.enableSearch) { + currentHighlight = null; +@@ -541,6 +546,7 @@ class _DropdownMenuState extends State> { + ); + currentHighlight = widget.enableSearch ? i : null; + widget.onSelected?.call(entry.value); ++ _enableFilter = false; + } + : null, + requestFocusOnHover: false, +@@ -613,5 +618,7 @@ class _DropdownMenuState extends State> { + if (_enableFilter) { + filteredEntries = filter(widget.dropdownMenuEntries, _textEditingController); ++ } else { ++ filteredEntries = widget.dropdownMenuEntries; + } + + if (widget.enableSearch) { diff --git a/.github/workflows/bridge.yml b/.github/workflows/bridge.yml index 9d56fbe6f2b5..69dddfa10593 100644 --- a/.github/workflows/bridge.yml +++ b/.github/workflows/bridge.yml @@ -6,7 +6,7 @@ on: workflow_call: env: - FLUTTER_VERSION: "3.22.3" + FLUTTER_VERSION: "3.19.6" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503 @@ -74,7 +74,7 @@ jobs: shell: bash run: | cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid" --locked - pushd flutter && sed -i -e 's/extended_text: 14.0.0/extended_text: 13.0.0/g' pubspec.yaml && flutter pub get && popd + pushd flutter && flutter pub get && popd - name: Run flutter rust bridge run: | diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index 5ac769ea65df..d9bb395c4274 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -25,15 +25,15 @@ env: SCITER_ARMV7_CMAKE_VERSION: "3.29.7" SCITER_NASM_DEBVERSION: "2.14-1" LLVM_VERSION: "15.0.6" - FLUTTER_VERSION: "3.24.5" - ANDROID_FLUTTER_VERSION: "3.24.5" + FLUTTER_VERSION: "3.19.6" + ANDROID_FLUTTER_VERSION: "3.13.9" # for arm64 linux because official Dart SDK does not work FLUTTER_ELINUX_VERSION: "3.16.9" TAG_NAME: "${{ inputs.upload-tag }}" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # vcpkg version: 2024.07.12 VCPKG_COMMIT_ID: "1de2026f28ead93ff1773e6e680387643e914ea1" - VERSION: "1.3.4" + VERSION: "1.3.3" NDK_VERSION: "r27c" #signing keys env variable checks ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}" @@ -56,7 +56,7 @@ jobs: target: windows-2022 configuration: Release platform: x64 - target_version: Windows10 + target_version: Windows7 strategy: fail-fast: false @@ -107,19 +107,20 @@ jobs: # https://github.com/flutter/flutter/issues/155685 - name: Replace engine with rustdesk custom flutter engine + if: false run: | flutter doctor -v flutter precache --windows Invoke-WebRequest -Uri https://github.com/rustdesk/engine/releases/download/main/windows-x64-release.zip -OutFile windows-x64-release.zip Expand-Archive -Path windows-x64-release.zip -DestinationPath windows-x64-release - mv -Force windows-x64-release/*  C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ + mv -Force windows-x64-release/* C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ - name: Patch flutter shell: bash run: | - cp .github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter))) + cp .github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter))) cd $(dirname $(dirname $(which flutter))) - [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply flutter_3.24.4_dropdown_menu_enableFilter.diff + [[ "3.19.6" == ${{env.FLUTTER_VERSION}} ]] && git apply flutter_3.19.6_dropdown_menu_enableFilter.diff - name: Install Rust toolchain uses: dtolnay/rust-toolchain@v1 @@ -226,7 +227,7 @@ jobs: pushd ./res/msi python preprocess.py --arp -d ../../rustdesk nuget restore msi.sln - msbuild msi.sln -p:Configuration=Release -p:Platform=x64 /p:TargetVersion=Windows10 + msbuild msi.sln -p:Configuration=Release -p:Platform=x64 /p:TargetVersion=Windows7 mv ./Package/bin/x64/Release/en-us/Package.msi ../../SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.msi sha256sum ../../SignOutput/rustdesk-*.msi @@ -387,6 +388,150 @@ jobs: files: | ./SignOutput/rustdesk-*.exe + # The fallback for the flutter version, we use Sciter for 64bit Windows. + build-for-windows-x86_64-sciter: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + # Temporarily disable this action due to additional test is needed. + # if: false + strategy: + fail-fast: false + matrix: + job: + # - { target: i686-pc-windows-msvc , os: windows-2022 } + # - { target: x86_64-pc-windows-gnu , os: windows-2022 } + - { + target: x86_64-pc-windows-msvc, + os: windows-2022, + arch: x86_64, + vcpkg-triplet: x64-windows-static, + } + # - { target: aarch64-pc-windows-msvc, os: windows-2022 } + steps: + - name: Set LIBCLANG_PATH + run: echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> $GITHUB_ENV + + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: ${{ env.LLVM_VERSION }} + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: nightly-2023-10-13-${{ matrix.job.target }} # must use nightly here, because of abi_thiscall feature required + targets: ${{ matrix.job.target }} + components: "rustfmt" + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: C:\vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + doNotCache: false + + - name: Install vcpkg dependencies + env: + VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }} + run: | + if ! $VCPKG_ROOT/vcpkg \ + install \ + --triplet ${{ matrix.job.vcpkg-triplet }} \ + --x-install-root="$VCPKG_ROOT/installed"; then + find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do + echo "$_1:" + echo "======" + cat "$_1" + echo "======" + echo "" + done + exit 1 + fi + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Patch sciter x86_64 + sed -i 's/branch = "dyn"/branch = "dyn"/g' ./Cargo.toml + cargo build --features inline,vram,hwcodec --release --bins + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x64/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT + curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip + unzip usbmmidd_v2.zip + # Do not remove x64 files, because the user may run the 32bit version on a 64bit system. + # Do not remove ./usbmmidd_v2/deviceinstaller64.exe, as x86 exe cannot install and uninstall drivers when running on x64, + # we need the x64 exe to install and uninstall the driver. + rm -rf ./usbmmidd_v2/deviceinstaller64.exe ./usbmmidd_v2/usbmmidd.bat + mv ./usbmmidd_v2 ./Release || true + + - name: find Runner.res + # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res + # Runner.rc does not contain actual version, but Runner.res does + continue-on-error: true + shell: bash + run: | + runner_res=$(find . -name "Runner.res"); + if [ "$runner_res" == "" ]; then + echo "Runner.res: not found"; + else + echo "Runner.res: $runner_res"; + cp $runner_res ./libs/portable/Runner.res; + echo "list ./libs/portable/Runner.res"; + ls -l ./libs/portable/Runner.res; + fi + + - name: Sign rustdesk files + if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' + shell: bash + run: | + pip3 install requests argparse + BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./Release/ + + - name: Build self-extracted executable + shell: bash + run: | + sed -i '/dpiAware/d' res/manifest.xml + pushd ./libs/portable + pip3 install -r requirements.txt + python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe + popd + mkdir -p ./SignOutput + mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.exe + + - name: Sign rustdesk self-extracted file + if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' + shell: bash + run: | + BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput/ + + - name: Publish Release + uses: softprops/action-gh-release@v1 + if: env.UPLOAD_ARTIFACT == 'true' + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./SignOutput/rustdesk-*.exe + build-for-macOS-arm64-selfhost: # use build-for-macOS instead if: false @@ -496,7 +641,7 @@ jobs: - name: Patch flutter run: | cd $(dirname $(dirname $(which flutter))) - [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + [[ "3.19.6" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff - name: Setup vcpkg with Github Actions binary cache uses: lukka/run-vcpkg@v11 @@ -708,13 +853,13 @@ jobs: - name: Patch flutter run: | cd $(dirname $(dirname $(which flutter))) - [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + [[ "3.19.6" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff - name: Workaround for flutter issue shell: bash run: | cd "$(dirname "$(which flutter)")" - # https://github.com/flutter/flutter/issues/1.3.43 + # https://github.com/flutter/flutter/issues/133533 sed -i -e 's/_setFramesEnabledState(false);/\/\/_setFramesEnabledState(false);/g' ../packages/flutter/lib/src/scheduler/binding.dart grep -n '_setFramesEnabledState(false);' ../packages/flutter/lib/src/scheduler/binding.dart @@ -955,8 +1100,9 @@ jobs: - name: Patch flutter run: | + cp .github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter))) cd $(dirname $(dirname $(which flutter))) - [[ "3.24.5" == ${{env.ANDROID_FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + [[ "3.13.9" == ${{env.ANDROID_FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff - uses: nttld/setup-ndk@v1 id: setup-ndk @@ -1232,8 +1378,9 @@ jobs: - name: Patch flutter run: | + cp .github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter))) cd $(dirname $(dirname $(which flutter))) - [[ "3.24.5" == ${{env.ANDROID_FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + [[ "3.13.9" == ${{env.ANDROID_FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.13.9_dropdown_menu_enableFilter.diff - name: Restore bridge files uses: actions/download-artifact@master @@ -1585,7 +1732,7 @@ jobs: ;; esac - if [[ "3.24.5" == ${{ env.FLUTTER_VERSION }} ]]; then + if [[ "3.19.6" == ${{ env.FLUTTER_VERSION }} ]]; then case ${{ matrix.job.arch }} in aarch64) pushd /opt/flutter-elinux/flutter @@ -1594,7 +1741,7 @@ jobs: pushd /opt/flutter ;; esac - git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + git apply ${{ github.workspace }}/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff popd fi @@ -2072,7 +2219,7 @@ jobs: shell: bash run: | cd $(dirname $(dirname $(which flutter))) - [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + [[ "3.19.6" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.19.6_dropdown_menu_enableFilter.diff # https://rustdesk.com/docs/en/dev/build/web/ - name: Build web