-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[Tauri] Unify serial implementation #4683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: tauri
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ jobs: | |
| retention-days: 30 | ||
|
|
||
| android: | ||
| name: Android APK (Capacitor) | ||
| name: Android APK (Tauri) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -79,11 +79,21 @@ jobs: | |
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| - name: Setup Java 11 | ||
| - name: Setup Java 21 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '11' | ||
| java-version: '21' | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android | ||
|
|
||
| - name: Setup Rust cache | ||
| uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: src-tauri | ||
|
|
||
| - name: Cache Gradle | ||
| uses: actions/cache@v4 | ||
|
|
@@ -95,9 +105,24 @@ jobs: | |
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| - name: Ensure JitPack repository (for usb-serial-for-android) | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| FILE="src-tauri/gen/android/build.gradle.kts" | ||
| if [ -f "$FILE" ]; then | ||
| echo "Ensuring JitPack repository is present in $FILE" | ||
| if ! grep -q 'jitpack.io' "$FILE"; then | ||
| printf '\nallprojects {\n repositories {\n maven(url = "https://jitpack.io")\n }\n}\n' >> "$FILE" | ||
| fi | ||
| grep -n "jitpack.io" "$FILE" || true | ||
| else | ||
| echo "Warning: $FILE not found (will be generated by Tauri on first build)." | ||
| fi | ||
|
Comment on lines
+108
to
+121
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same repository injection concern as ci.yml. This has the same potential issue with appending The file existence check is a good addition, but the append approach can still create duplicate blocks if the file already contains an 🤖 Prompt for AI Agents |
||
|
|
||
| - name: Build Android release (unsigned) | ||
| run: | | ||
| yarn android:release | ||
| yarn tauri:build:android | ||
|
|
||
| - name: Setup release keystore (if available) | ||
| if: ${{ secrets.ANDROID_KEYSTORE_BASE64 != '' }} | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,15 +18,12 @@ tauri-build = { version = "2.5", features = [] } | |
| [dependencies] | ||
| tauri = { version = "2.9", features = [] } | ||
| tauri-plugin-shell = "2.3" | ||
| # Allow newer serial plugin releases (2.21+) which may include Android fixes | ||
| serde = { version = "1.0", features = ["derive"] } | ||
| serde_json = "1.0" | ||
|
|
||
| [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] | ||
| tauri-plugin-serialplugin = "2.21" | ||
|
|
||
| [target.'cfg(target_os = "android")'.dependencies] | ||
| serialport = "4.8" | ||
| # Pin exact version to avoid pulling 2.21.x which is incompatible with current Android/Kotlin setup | ||
| # Try an older plugin version that matches tauri-android 2.9 API surface (avoid onDetach override) | ||
| # Further downgrade to avoid onDetach override incompatibility | ||
| tauri-plugin-serialplugin = "=2.15.0" | ||
|
Comment on lines
+23
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainConsolidate redundant comments and verify the pinned version. The three comment lines explaining the version pin are somewhat redundant. Consider consolidating them for clarity. Apply this diff to consolidate the comments: -# Pin exact version to avoid pulling 2.21.x which is incompatible with current Android/Kotlin setup
-# Try an older plugin version that matches tauri-android 2.9 API surface (avoid onDetach override)
-# Further downgrade to avoid onDetach override incompatibility
+# Pinned to 2.15.0: versions 2.21+ have onDetach override incompatibility with tauri-android 2.9 API
tauri-plugin-serialplugin = "=2.15.0"Verify that version 2.15.0 exists and check for any security advisories: Additionally, you may want to verify the plugin version on crates.io: 🏁 Script executed: #!/bin/bash
# Description: Check if tauri-plugin-serialplugin 2.15.0 exists and look for security issues
# Search for any published versions or release info in the repository
rg -n "2\.15\.0|2\.21" -g "*.md" -g "*.toml" -C 2
# Check Cargo.lock for the resolved version
if [ -f "Cargo.lock" ]; then
grep -A 5 "name = \"tauri-plugin-serialplugin\"" Cargo.lock | head -10
else
echo "No Cargo.lock found"
fiLength of output: 625 🌐 Web query: 💡 Result: Short answer:
Sources:
Fix the pinned version: 2.15.0 does not exist on crates.io. The web search confirms that available versions are 2.16.0, 2.10.0, 2.4.14, 2.4.12, and v2.1.0—version 2.15.0 is not among them. This will cause build failures. Issues:
Action required: Verify which available version resolves the onDetach override incompatibility, update the pin accordingly, and consolidate the comments into a single line explaining the constraint. |
||
|
|
||
| [features] | ||
| default = ["custom-protocol"] | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review the repository injection approach for potential Gradle syntax conflicts.
The current implementation appends an
allprojectsblock tobuild.gradle.ktsif JitPack is not found. This could create duplicateallprojectsblocks or improper nesting if the file already contains such a block, potentially leading to Gradle build failures.Consider these alternatives:
allprojectsblock and append within it:The Gradle init script approach is cleaner as it avoids modifying generated files.
🤖 Prompt for AI Agents