Skip to content

feat: add Flatpak packaging support#336

Merged
rainxchzed merged 4 commits intomainfrom
flatpak-integration
Mar 19, 2026
Merged

feat: add Flatpak packaging support#336
rainxchzed merged 4 commits intomainfrom
flatpak-integration

Conversation

@rainxchzed
Copy link
Member

@rainxchzed rainxchzed commented Mar 18, 2026

  • Introduce Flatpak build configuration including manifest (.yml), AppStream metainfo, and desktop entry.
  • Add a specialized shell script disable-android-for-flatpak.sh to strip Android-specific plugins and configurations in-place, enabling builds in SDK-restricted environments.
  • Implement a launcher script to execute the application using a bundled JetBrains Runtime (JBR) for optimal Compose Desktop performance.
  • Patch Gradle convention plugins to provide no-op implementations for Android targets during the Flatpak build process.
  • Configure Flatpak sandbox permissions for network access, X11/Wayland display, and XDG download directory integration.

Summary by CodeRabbit

  • New Features

    • Added full Flatpak packaging for GitHub Store: build manifest, AppStream metadata, desktop entry, bundled runtime launcher, and icon for desktop integration and easy Linux install.
  • Chores

    • Added helper scripts to prepare the project for Flatpak builds (including temporarily removing Android build targets) and a build task to generate Flatpak source metadata.

- Introduce Flatpak build configuration including manifest (`.yml`), AppStream metainfo, and desktop entry.
- Add a specialized shell script `disable-android-for-flatpak.sh` to strip Android-specific plugins and configurations in-place, enabling builds in SDK-restricted environments.
- Implement a launcher script to execute the application using a bundled JetBrains Runtime (JBR) for optimal Compose Desktop performance.
- Patch Gradle convention plugins to provide no-op implementations for Android targets during the Flatpak build process.
- Configure Flatpak sandbox permissions for network access, X11/Wayland display, and XDG download directory integration.
- Add `flatpak-sources.json` containing a comprehensive list of offline Maven/Gradle dependencies for Flatpak builds.
- Configure `flatpak-gradle-generator` plugin in `build.gradle.kts` to automate source manifest generation.
- Update Flatpak manifest (`zed.rainxch.githubstore.yml`) and metainfo with correct SHA-256 hashes for JBR and Gradle distributions.
- Update project URLs and VCS references from `AshkanAhmady/GitHub-Store` to `OpenHub-Store/GitHub-Store`.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d234d22f-9269-4dee-a9a5-85de724598b2

📥 Commits

Reviewing files that changed from the base of the PR and between 2e1df9d and f8d3519.

📒 Files selected for processing (1)
  • packaging/flatpak/disable-android-for-flatpak.sh

Walkthrough

Adds Flatpak packaging for GitHub Store: plugin and task to produce flatpak sources, scripts and manifest to build a Flatpak (including bundling JBR and disabling Android targets), a runtime launcher, desktop entry, and AppStream metadata.

Changes

Cohort / File(s) Summary
Gradle Build Configuration
build.gradle.kts
Apply io.github.jwharm.flatpak-gradle-generator (v1.7.0) and register flatpakGradleGenerator task to emit flatpak-sources.json.
Flatpak preparation script
packaging/flatpak/disable-android-for-flatpak.sh
New Bash script that patches Gradle/Kotlin convention sources to remove Android plugin usage/configuration, injects no-op Android plugin stubs, strips android {} blocks, and prepares the project for offline Flatpak/JVM builds.
Flatpak launcher
packaging/flatpak/githubstore.sh
Launcher script setting JAVA_HOME, XDG dirs and Java system properties, then executes bundled /app/lib/githubstore.jar.
Desktop entry & AppStream metadata
packaging/flatpak/zed.rainxch.githubstore.desktop, packaging/flatpak/zed.rainxch.githubstore.metainfo.xml
Adds desktop entry and appstream metainfo for zed.rainxch.githubstore (metadata, screenshots, release notes, licensing, URLs, categories, MIME handling).
Flatpak manifest
packaging/flatpak/zed.rainxch.githubstore.yml
New Flatpak manifest targeting org.freedesktop.Platform 24.08 with OpenJDK 21 extension; modules to extract JBR, run offline Gradle build (uses disable script), install JAR, launcher, desktop file, metainfo, and icon; sets finish-args for GUI, network, GPU and downloads access.
Generated sources artifact (target)
flatpak-sources.json (output of task)
Declared output of the new flatpakGradleGenerator task; referenced by manifest to supply pre-downloaded dependency metadata.

Sequence Diagram(s)

sequenceDiagram
    participant Builder as Flatpak Builder
    participant Repo as Source Repository
    participant Script as disable-android-for-flatpak.sh
    participant Gradle as Gradle (offline)
    participant JBR as JBR extraction
    participant Installer as Flatpak Install Step

    Builder->>Repo: fetch sources (repo tag, gradle zip, flatpak-sources.json)
    Builder->>Script: run disable-android-for-flatpak.sh
    Script->>Repo: patch Kotlin/Gradle convention sources and remove android blocks
    Builder->>Gradle: run offline build to produce uber JAR
    Gradle->>JBR: extract/place JBR into /app/jre (jbr module)
    Gradle->>Installer: output `/app/lib/githubstore.jar`, launcher, assets
    Installer->>Builder: install desktop file, metainfo, icon, launcher into /app
    Builder->>Builder: finalize Flatpak bundle
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code to trim Android threads,

JBR tucked in /app where every runtime treads,
Scripts and manifests stitched the bundle tight,
Desktop icons gleam under Flatpak light,
A tiny rabbit cheers the packaging tonight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add Flatpak packaging support' accurately summarizes the primary change: introducing comprehensive Flatpak packaging including manifest, metainfo, desktop entry, launcher script, and Gradle configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch flatpak-integration
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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/disable-android-for-flatpak.sh`:
- Around line 100-106: The sed replacement for configureAndroidTarget() is
matching the function declaration and breaking Kotlin; modify the loop to skip
files that contain the declaration (e.g., grep -q "fun
Project.configureAndroidTarget" "$f" && continue) before running sed so only
call sites are rewritten, and apply the same guard for configureKotlinAndroid by
checking for its declaration (e.g., grep -q "fun Project.configureKotlinAndroid"
"$f" && continue) to avoid touching function definitions; keep the sed
replacement only for true call-site files (or alternatively restrict the loop to
known call-site filenames) so configureAndroidTarget() and
configureKotlinAndroid(this) are commented out only where they are invoked.

In `@packaging/flatpak/zed.rainxch.githubstore.metainfo.xml`:
- Line 33: The AppStream screenshot URL in the <image> element still points to
the old owner "AshkanAhmady"; update the URL value to use the current repository
owner "OpenHub-Store" (i.e., replace "AshkanAhmady" with "OpenHub-Store" in the
image URL) so the screenshot path matches the rest of the metadata and renders
correctly.

In `@packaging/flatpak/zed.rainxch.githubstore.yml`:
- Around line 34-40: The two sha256 entries currently use the same checksum for
different JBR archives (the url values jbr_jcef-21.0.7-linux-x64-... and
jbr_jcef-21.0.7-linux-aarch64-...); replace each duplicated sha256 value with
the correct SHA-256 for its corresponding URL by downloading or fetching the
artifact and computing its checksum (or retrieving the vendor-provided checksum)
and update the sha256 fields so the linux-x64 and linux-aarch64 entries each
have their distinct, correct hash.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b3f7c91e-b4c9-473c-a648-7c7e57c84ee4

📥 Commits

Reviewing files that changed from the base of the PR and between 42f8b5a and 1f17ca0.

📒 Files selected for processing (7)
  • build.gradle.kts
  • packaging/flatpak/disable-android-for-flatpak.sh
  • packaging/flatpak/flatpak-sources.json
  • packaging/flatpak/githubstore.sh
  • packaging/flatpak/zed.rainxch.githubstore.desktop
  • packaging/flatpak/zed.rainxch.githubstore.metainfo.xml
  • packaging/flatpak/zed.rainxch.githubstore.yml

- Switch JetBrains Runtime (JBR) from the JCEF variant to the plain version (v21.0.10) since the app does not use embedded Chromium.
- Update JBR download URLs and SHA-256 hashes for both x86_64 and aarch64 architectures.
- Update screenshot URLs in the Flatpak metainfo to point to the new repository location and include high-quality JPG assets.
- Add new screenshots showcasing repository details, RPM installation, and AppImage support on Linux.
- Update the homepage URL in the metainfo to reflect the current repository owner.
…k script

- Update `disable-android-for-flatpak.sh` to skip files that define `configureAndroidTarget` and `configureKotlinAndroid` functions.
- Ensure only call sites of these functions are commented out during the Flatpak build preparation.
- Use `grep` to identify and exclude function declarations from `sed` modifications to maintain script integrity.
@rainxchzed rainxchzed merged commit cc768fa into main Mar 19, 2026
1 check was pending
@rainxchzed rainxchzed deleted the flatpak-integration branch March 19, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant