Skip to content
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

[V3 Linux] aarch64 compilation #3854

Open
wants to merge 5 commits into
base: v3-alpha
Choose a base branch
from

Conversation

kodflow
Copy link

@kodflow kodflow commented Oct 23, 2024

Description

This pull request addresses an issue in the v3/internal/commands/appimage.go file, where the logic to generate AppImages was not functioning correctly on certain platforms. The modification ensures that the appimage.go command correctly handles the generation of AppImages for Linux environments by updating the build process.

Fixes #3840

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

The fix was tested by building the project on different Linux distributions and verifying that the AppImage generation now works correctly. Additional logging was added to confirm that all steps in the process are successfully executed.

  • Linux

Summary by CodeRabbit

  • New Features

    • Enhanced application image generation with architecture-specific handling for arm64 and x86_64.
    • Improved download process for necessary files with architecture-specific URLs for concurrent downloads.
    • Added a new command for updating build assets.
    • Introduced templates for SvelteKit and SvelteKit-TS for non-SSR development.
    • Added an example for testing the HTML Drag and Drop API.
  • Bug Fixes

    • Resolved AlwaysOnTop functionality on macOS.
    • Addressed a duplicate role in the edit menu for Darwin systems.
    • Fixed aarch64 compilation issues on Linux.
    • Fixed custom event processing in drag-and-drop examples.
    • Corrected syso icon file generation bugs on Windows.
  • Refactor

    • Simplified GTK version determination logic for better clarity.
    • Updated the Taskfile and improved CI actions.

Copy link
Contributor

coderabbitai bot commented Oct 23, 2024

Walkthrough

The changes in this pull request enhance the GenerateAppImage functionality within the v3/internal/commands/appimage.go file. Key modifications include the introduction of architecture-specific handling for arm64 and x86_64, allowing for dynamic URL management for file downloads based on architecture. The application directory naming convention has been updated to reflect architecture, and error handling remains consistent. The logic for determining GTK versions has been simplified. Overall, these changes improve the flexibility and robustness of the application image generation process.

Changes

File Path Change Summary
v3/internal/commands/appimage.go - Introduced architecture-specific handling for arm64 and x86_64.
- Updated application directory naming to include architecture.
- Refactored download process to use architecture-based URLs for concurrent downloads.
- Simplified GTK version determination logic using a switch statement.
- Updated command for running linuxdeploy to reference architecture-specific AppImage.
- Maintained consistent error handling throughout the process.
mkdocs-website/docs/en/changelog.md - Updated changelog with new features, changes, and fixes, including architecture-specific templates and commands.
- Documented various platform fixes and improvements across the project.

Assessment against linked issues

Objective Addressed Explanation
Create Linux app for arm64 or x86_64 (#3840)

Possibly related PRs

🐇 In the land of code where rabbits play,
New paths for images brighten the way.
With arms of arm64 and x86_64,
We build our dreams, both big and small.
So hop along, let the changes unfold,
A tale of images, brave and bold! 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a627f88 and 7c319bd.

📒 Files selected for processing (1)
  • mkdocs-website/docs/en/changelog.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • mkdocs-website/docs/en/changelog.md

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 2

🧹 Outside diff range and nitpick comments (2)
v3/internal/commands/appimage.go (2)

Line range hint 138-158: Correct the target directory path when copying GTK files.

The current method of constructing targetDir may lead to incorrect paths, causing files to be copied to unintended locations. Stripping the leading slash and then using filepath.Abs can result in paths outside the AppDir.

Modify the path construction to ensure files are copied relative to appDir:

     s.CD(appDir)
     for _, file := range files {
         targetDir := filepath.Dir(file)
         if targetDir[0] == '/' {
             targetDir = targetDir[1:]
         }
-        targetDir, err = filepath.Abs(targetDir)
+        targetDir = filepath.Join(appDir, targetDir)
         if err != nil {
             return err
         }
         s.MKDIR(targetDir)
         s.COPY(file, targetDir)
     }

Line range hint 187-198: Update log message to reflect the final AppImage location.

After moving the AppImage to the output directory, the log message references targetFile, which still points to the original location. Adjust the log to show the correct output path.

Apply this change to fix the log message:

     s.MOVE(targetFile, options.OutputDir)

-    log(p, "AppImage created: "+targetFile)
+    finalAppImagePath := filepath.Join(options.OutputDir, filepath.Base(targetFile))
+    log(p, "AppImage created: "+finalAppImagePath)
     return nil
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4325b06 and 0ba3edb.

📒 Files selected for processing (1)
  • v3/internal/commands/appimage.go (5 hunks)
🧰 Additional context used
🔇 Additional comments (2)
v3/internal/commands/appimage.go (2)

9-9: Good inclusion of the "runtime" package for architecture detection.

The addition of the runtime package is necessary for determining the current architecture, which is essential for the changes implemented.


174-184: Simplified GTK version detection is appropriate.

The use of a switch statement enhances readability and efficiently determines the GTK version required for deployment.

v3/internal/commands/appimage.go Show resolved Hide resolved
v3/internal/commands/appimage.go Show resolved Hide resolved
@leaanthony
Copy link
Member

Thanks 🙏 Please could you add an entry to the changelog located at mkdocs-website/docs/changelog.md? Thanks!

@kodflow
Copy link
Author

kodflow commented Oct 25, 2024

Thanks 🙏 Please could you add an entry to the changelog located at mkdocs-website/docs/changelog.md? Thanks!

done

@leaanthony
Copy link
Member

@atterpac - you good with this change?

Copy link

sonarcloud bot commented Oct 30, 2024

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.

2 participants