diff --git a/.github/workflows/test_exe.yml b/.github/workflows/test_exe.yml new file mode 100644 index 00000000..d6340f44 --- /dev/null +++ b/.github/workflows/test_exe.yml @@ -0,0 +1,78 @@ +name: Build windows exe + +on: + workflow_dispatch: + +env: + FLUTTER_VERSION: "3.41.9" + +jobs: + build_windows_exe: + runs-on: windows-latest + environment: packaging + + steps: + - name: Fix long file paths + run: git config --system core.longpaths true + + - name: Checkout repository + uses: actions/checkout@v6 + + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: "stable" + + - name: Build MSIX helper + run: '& ''C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe'' pack /o /d support\build\msix /nv /p app\windows\localsend_msix_helper.msix' + + - name: Dependencies + working-directory: app + run: flutter pub get + + - name: Compile for Windows + working-directory: app + run: flutter build windows + + - name: Prepare Inno Setup payload + run: | + New-Item -ItemType Directory -Force -Path "${{ runner.temp }}\inno" | Out-Null + Copy-Item -Path "app\build\windows\x64\runner\Release\*" -Destination "${{ runner.temp }}\inno" -Recurse + Copy-Item -Path "app\assets\packaging\logo.ico" -Destination "${{ runner.temp }}\inno" + Copy-Item -Path "support\build\windows\x64\*" -Destination "${{ runner.temp }}\inno" -Recurse + New-Item -ItemType Directory -Force -Path "${{ runner.temp }}\inno-result" | Out-Null + + - name: Compile installer (unsigned) + run: iscc /DSkipSignTool "/DPayloadDir=${{ runner.temp }}\inno" "/DResultDir=${{ runner.temp }}\inno-result" support\scripts\compile_windows_exe-inno.iss + + - name: Upload unsigned installer + id: unsigned-installer + uses: actions/upload-artifact@v6 + with: + name: windows-exe-unsigned + path: ${{ runner.temp }}\inno-result\localsend.exe + if-no-files-found: error + + - name: Sign installer (SignPath) + uses: signpath/github-action-submit-signing-request@v2 + with: + api-token: ${{ secrets.SIGNPATH_API_TOKEN }} + organization-id: ${{ vars.SIGNPATH_ORG_ID }} + project-slug: localsend + signing-policy-slug: test-signing + artifact-configuration-slug: installer + github-artifact-id: ${{ steps.unsigned-installer.outputs.artifact-id }} + wait-for-completion: true + output-artifact-directory: signed/installer + + - name: Verify signature + continue-on-error: true + run: | + $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1 + & $signtool.FullName verify /pa /v signed\installer\localsend.exe + + - name: Upload signed installer + uses: actions/upload-artifact@v6 + with: + name: windows-exe-x86-64-result + path: signed/installer/localsend.exe diff --git a/app/pubspec.lock b/app/pubspec.lock index 372258e1..45fed95c 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -586,10 +586,10 @@ packages: dependency: transitive description: name: gal - sha256: "969598f986789127fd407a750413249e1352116d4c2be66e81837ffeeaafdfee" + sha256: f71e79840fe023a21f2f949771375444b6efcd34b9e625d5f4f5504971380a77 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" glob: dependency: "direct main" description: diff --git a/app/windows/runner/CMakeLists.txt b/app/windows/runner/CMakeLists.txt index 4734da91..b0099974 100644 --- a/app/windows/runner/CMakeLists.txt +++ b/app/windows/runner/CMakeLists.txt @@ -21,6 +21,11 @@ add_executable(${BINARY_NAME} WIN32 # that need different build settings. apply_standard_settings(${BINARY_NAME}) +# winrt_ext.cpp uses C++/WinRT, which needs C++20 for the standard +# header; under C++17 it falls back to , which recent +# MSVC STLs reject with error STL1011. +target_compile_features(${BINARY_NAME} PRIVATE cxx_std_20) + # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") @@ -35,6 +40,9 @@ target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +# C++/WinRT (winrt_ext.cpp): newer Windows SDKs require linking the WinRT +# activation functions (RoGetActivationFactory etc.) explicitly. +target_link_libraries(${BINARY_NAME} PRIVATE "runtimeobject.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") # Run the Flutter tool portions of the build. This must not be removed. diff --git a/packages/localsend_isolates/pubspec.yaml b/packages/localsend_isolates/pubspec.yaml index 17fd94b8..9e0463b1 100644 --- a/packages/localsend_isolates/pubspec.yaml +++ b/packages/localsend_isolates/pubspec.yaml @@ -10,28 +10,28 @@ environment: dependencies: collection: ^1.17.2 # allow newer versions, so it can compile with newer Flutter versions - dart_mappable: 4.8.0 + dart_mappable: ^4.8.0 flutter: sdk: flutter - flutter_foreground_task: 9.2.2 - flutter_rust_bridge: 2.12.0 - freezed_annotation: 3.1.0 - gal: 2.3.2 - logging: 1.3.0 - mime: 2.0.0 - path: 1.9.1 - pool: 1.5.2 + flutter_foreground_task: ^9.2.2 + flutter_rust_bridge: ^2.12.0 + freezed_annotation: ^3.1.0 + gal: ^2.3.3 + logging: ^1.3.0 + mime: ^2.0.0 + path: ^1.9.1 + pool: ^1.5.2 refena_flutter: ^3.4.0 rust_lib_localsend_app: path: rust_builder typed_isolates: path: ../typed_isolates - uuid: 4.5.3 + uuid: ^4.5.3 dev_dependencies: - build_runner: 2.15.1 - dart_mappable_builder: 4.8.0 - flutter_lints: 6.0.0 + build_runner: ^2.15.1 + dart_mappable_builder: ^4.8.0 + flutter_lints: ^6.0.0 flutter_test: sdk: flutter - freezed: 3.2.5 + freezed: ^3.2.5 diff --git a/support/scripts/compile_windows_exe-inno.iss b/support/scripts/compile_windows_exe-inno.iss index 5c1647cf..f52a6355 100644 --- a/support/scripts/compile_windows_exe-inno.iss +++ b/support/scripts/compile_windows_exe-inno.iss @@ -1,7 +1,15 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; Copy the contents of the zip to D:\inno, then run this Inno script -; Copy app/assets/packaging/logo-256.ico to D:\inno\logo-256.ico +; Copy app/assets/packaging/logo.ico to D:\inno\logo.ico + +; Payload/output directories, overridable from CI via /DPayloadDir=... /DResultDir=... +#ifndef PayloadDir + #define PayloadDir "D:\inno" +#endif +#ifndef ResultDir + #define ResultDir "D:\inno-result" +#endif #define MyAppName "LocalSend" #define MyAppVersion "1.17.0" @@ -26,14 +34,17 @@ DisableProgramGroupPage=yes ; Uncomment the following line to run in non administrative install mode (install for current user only.) ;PrivilegesRequired=lowest PrivilegesRequiredOverridesAllowed=dialog -OutputDir=D:\inno-result +OutputDir={#ResultDir} OutputBaseFilename=localsend -SetupIconFile=D:\inno\logo.ico +SetupIconFile={#PayloadDir}\logo.ico UninstallDisplayIcon={app}\{#MyAppExeName} Compression=lzma SolidCompression=yes WizardStyle=modern +; CI passes /DSkipSignTool and signs the resulting installer afterwards (SignPath) +#ifndef SkipSignTool SignTool=MySignTool +#endif ArchitecturesInstallIn64BitMode=x64compatible ArchitecturesAllowed=x64compatible @@ -70,11 +81,11 @@ Name: "chinesesimplified"; MessagesFile: "..\build\windows\inno\ChineseSimplifie Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "D:\inno\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\inno\{#MyAppExeName}.manifest"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\inno\*.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\inno\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "D:\inno\{#MyAppMsixHelper}"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#PayloadDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#PayloadDir}\{#MyAppExeName}.manifest"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#PayloadDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#PayloadDir}\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#PayloadDir}\{#MyAppMsixHelper}"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons]