build: refactor Flatpak packaging to use online builds and force X11 …#339
build: refactor Flatpak packaging to use online builds and force X11 …#339rainxchzed wants to merge 2 commits intomainfrom
Conversation
…backend - Enable network access during the Flatpak build process to allow Gradle to download dependencies directly. - Remove pre-downloaded Gradle distribution and the offline `flatpak-sources.json` dependency list. - Switch the build command from `packageReleaseUberJarForCurrentOS` to `packageUberJarForCurrentOS` to avoid ProGuard duplicate jar conflicts. - Force `GDK_BACKEND=x11` in the launch script to improve reliability for Skiko/Compose on Wayland environments. - Enhance `disable-android-for-flatpak.sh` to more aggressively strip Android-specific configuration blocks (`androidMain`, `debugImplementation`) across all project modules. - Refactor the `RoomConventionPlugin` within the Flatpak build logic to remove Android-specific KSP dependencies. - Update the Flatpak manifest to point to the latest commit for version 1.6.2.
WalkthroughThis PR enhances Flatpak packaging for GitHub-Store by expanding Android removal logic in build scripts, forcing X11 backend for GTK compatibility, allowing network access during builds, and updating Gradle task references and dependency pinning in the Flatpak manifest. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packaging/flatpak/disable-android-for-flatpak.sh (1)
256-285: Avoid forkingRoomConventionPlugin.ktinside this patch script.These lines create a second full copy of
build-logic/convention/src/main/kotlin/RoomConventionPlugin.kt. Any later Room convention change will land in normal builds but be silently skipped by Flatpak builds. Prefer a targeted edit that removes only the Android-specific KSP wiring, like the smaller patches above.Based on learnings: Use convention plugins from
build-logic/convention/for module setup:convention.kmp.library,convention.cmp.library,convention.cmp.feature,convention.cmp.application,convention.room,convention.buildkonfig🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packaging/flatpak/disable-android-for-flatpak.sh` around lines 256 - 285, This patch currently forks RoomConventionPlugin by writing a full duplicate file (creating RoomConventionPlugin.kt) which will diverge from build-logic/convention; instead, change the script to perform a targeted edit on the existing RoomConventionPlugin in build-logic/convention: remove only the Android/KSP-specific wiring — i.e., delete or conditionalize the apply("com.google.devtools.ksp") call and the "kspJvm"(libs.findLibrary("androidx-room-compiler").get()) dependency while keeping the RoomExtension.schemaDirectory and commonMainApi lines intact — so that you do not create a second copy and Flatpak builds reuse the canonical RoomConventionPlugin implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packaging/flatpak/githubstore.sh`:
- Around line 11-13: The script currently force-sets GDK_BACKEND to x11; change
it to only default to x11 when GDK_BACKEND is not already defined so
Wayland-only users can override it. Locate the export of GDK_BACKEND (symbol:
GDK_BACKEND) and modify the assignment to use the existing environment value if
present (i.e., leave GDK_BACKEND alone when set, otherwise set it to x11) so the
manifest's Wayland socket access can be used when desired.
In `@packaging/flatpak/zed.rainxch.githubstore.yml`:
- Around line 52-60: Remove the sed replacement that rewrites distributionUrl to
gradle-bin.zip in the build-commands (the line that runs sed on
gradle/wrapper/gradle-wrapper.properties); since --share=network is enabled the
wrapper should download the distribution from the original URL, so delete or
comment out that sed invocation and keep the remaining build-commands (including
disable-android-for-flatpak.sh and ./gradlew
:composeApp:packageUberJarForCurrentOS) intact.
---
Nitpick comments:
In `@packaging/flatpak/disable-android-for-flatpak.sh`:
- Around line 256-285: This patch currently forks RoomConventionPlugin by
writing a full duplicate file (creating RoomConventionPlugin.kt) which will
diverge from build-logic/convention; instead, change the script to perform a
targeted edit on the existing RoomConventionPlugin in build-logic/convention:
remove only the Android/KSP-specific wiring — i.e., delete or conditionalize the
apply("com.google.devtools.ksp") call and the
"kspJvm"(libs.findLibrary("androidx-room-compiler").get()) dependency while
keeping the RoomExtension.schemaDirectory and commonMainApi lines intact — so
that you do not create a second copy and Flatpak builds reuse the canonical
RoomConventionPlugin implementation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 91ef71f0-d5fd-4ccd-b1bf-aec2f23aa629
📒 Files selected for processing (4)
packaging/flatpak/disable-android-for-flatpak.shpackaging/flatpak/flatpak-sources.jsonpackaging/flatpak/githubstore.shpackaging/flatpak/zed.rainxch.githubstore.yml
| # Force X11 (via XWayland on Wayland) — Skiko/Compose doesn't yet | ||
| # reliably support native Wayland drawing surfaces with JBR. | ||
| export GDK_BACKEND=x11 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check if the file exists and read the relevant section
fd -t f "githubstore.sh" packaging/flatpak/ 2>/dev/null && \
echo "=== File content (lines 1-20) ===" && \
head -20 packaging/flatpak/githubstore.shRepository: OpenHub-Store/GitHub-Store
Length of output: 851
🏁 Script executed:
# Also check for the manifest file mentioned
find packaging/flatpak -type f -name "*.json" -o -name "*manifest*" -o -name "*.yml" | head -10Repository: OpenHub-Store/GitHub-Store
Length of output: 154
🏁 Script executed:
# Look for all relevant shell scripts in the flatpak directory
ls -la packaging/flatpak/Repository: OpenHub-Store/GitHub-Store
Length of output: 656
🏁 Script executed:
cat packaging/flatpak/zed.rainxch.githubstore.ymlRepository: OpenHub-Store/GitHub-Store
Length of output: 3463
Allow GDK_BACKEND to be overridden for Wayland-only sessions.
Line 13 hard-codes GDK_BACKEND=x11, preventing users on Wayland-only systems without XWayland from overriding it when the app fails to start. The manifest already grants Wayland socket access. While defaulting to X11 is reasonable due to current Skiko/Compose limitations, allow environment override so Wayland-only users can attempt workarounds.
Suggested change
-export GDK_BACKEND=x11
+export GDK_BACKEND="${GDK_BACKEND:-x11}"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Force X11 (via XWayland on Wayland) — Skiko/Compose doesn't yet | |
| # reliably support native Wayland drawing surfaces with JBR. | |
| export GDK_BACKEND=x11 | |
| # Force X11 (via XWayland on Wayland) — Skiko/Compose doesn't yet | |
| # reliably support native Wayland drawing surfaces with JBR. | |
| export GDK_BACKEND="${GDK_BACKEND:-x11}" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packaging/flatpak/githubstore.sh` around lines 11 - 13, The script currently
force-sets GDK_BACKEND to x11; change it to only default to x11 when GDK_BACKEND
is not already defined so Wayland-only users can override it. Locate the export
of GDK_BACKEND (symbol: GDK_BACKEND) and modify the assignment to use the
existing environment value if present (i.e., leave GDK_BACKEND alone when set,
otherwise set it to x11) so the manifest's Wayland socket access can be used
when desired.
| build-args: | ||
| - --share=network | ||
| build-commands: | ||
| # Use local Gradle distribution (no network in sandbox) | ||
| - sed -i 's|distributionUrl=.*|distributionUrl=gradle-bin.zip|' gradle/wrapper/gradle-wrapper.properties | ||
| # Disable Android targets (no Android SDK in Flatpak sandbox) | ||
| - bash packaging/flatpak/disable-android-for-flatpak.sh | ||
| # Build uber JAR | ||
| - ./gradlew :composeApp:packageReleaseUberJarForCurrentOS | ||
| # Build uber JAR (using non-release to avoid ProGuard duplicate jar conflicts) | ||
| - ./gradlew :composeApp:packageUberJarForCurrentOS |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Confirm the manifest still rewrites the wrapper to a local ZIP.
sed -n '52,60p' packaging/flatpak/zed.rainxch.githubstore.yml
echo
# Show the wrapper URL that exists in the repository before the Flatpak patch runs.
grep -n 'distributionUrl' gradle/wrapper/gradle-wrapper.properties
echo
# If this prints nothing, the manifest is forcing a local ZIP that is no longer staged.
find . -name 'gradle-bin.zip' -printRepository: OpenHub-Store/GitHub-Store
Length of output: 663
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check if the disable-android-for-flatpak.sh script exists
ls -la packaging/flatpak/disable-android-for-flatpak.sh
echo "---"
# Check the full sources section of the githubstore module in the manifest
# to see if gradle-bin.zip is referenced anywhere
sed -n '40,75p' packaging/flatpak/zed.rainxch.githubstore.ymlRepository: OpenHub-Store/GitHub-Store
Length of output: 1842
Remove the sed command that forces a non-existent local Gradle distribution.
Line 56 rewrites distributionUrl to gradle-bin.zip, but this file is not staged in the manifest. With --share=network enabled, Gradle should fetch the distribution from the internet using the original URL in gradle/wrapper/gradle-wrapper.properties. The current sed command causes the build to fail immediately.
Suggested fix
- # Use local Gradle distribution (no network in sandbox)
- - sed -i 's|distributionUrl=.*|distributionUrl=gradle-bin.zip|' gradle/wrapper/gradle-wrapper.properties
+ # Keep the repository's wrapper URL so Gradle can fetch its own distribution📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| build-args: | |
| - --share=network | |
| build-commands: | |
| # Use local Gradle distribution (no network in sandbox) | |
| - sed -i 's|distributionUrl=.*|distributionUrl=gradle-bin.zip|' gradle/wrapper/gradle-wrapper.properties | |
| # Disable Android targets (no Android SDK in Flatpak sandbox) | |
| - bash packaging/flatpak/disable-android-for-flatpak.sh | |
| # Build uber JAR | |
| - ./gradlew :composeApp:packageReleaseUberJarForCurrentOS | |
| # Build uber JAR (using non-release to avoid ProGuard duplicate jar conflicts) | |
| - ./gradlew :composeApp:packageUberJarForCurrentOS | |
| build-args: | |
| - --share=network | |
| build-commands: | |
| # Keep the repository's wrapper URL so Gradle can fetch its own distribution | |
| # Disable Android targets (no Android SDK in Flatpak sandbox) | |
| - bash packaging/flatpak/disable-android-for-flatpak.sh | |
| # Build uber JAR (using non-release to avoid ProGuard duplicate jar conflicts) | |
| - ./gradlew :composeApp:packageUberJarForCurrentOS |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packaging/flatpak/zed.rainxch.githubstore.yml` around lines 52 - 60, Remove
the sed replacement that rewrites distributionUrl to gradle-bin.zip in the
build-commands (the line that runs sed on
gradle/wrapper/gradle-wrapper.properties); since --share=network is enabled the
wrapper should download the distribution from the original URL, so delete or
comment out that sed invocation and keep the remaining build-commands (including
disable-android-for-flatpak.sh and ./gradlew
:composeApp:packageUberJarForCurrentOS) intact.
…backend
flatpak-sources.jsondependency list.packageReleaseUberJarForCurrentOStopackageUberJarForCurrentOSto avoid ProGuard duplicate jar conflicts.GDK_BACKEND=x11in the launch script to improve reliability for Skiko/Compose on Wayland environments.disable-android-for-flatpak.shto more aggressively strip Android-specific configuration blocks (androidMain,debugImplementation) across all project modules.RoomConventionPluginwithin the Flatpak build logic to remove Android-specific KSP dependencies.Summary by CodeRabbit
New Features
Chores