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

Added possibility to specify platform for dev command #3248

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

PylotLight
Copy link
Contributor

@PylotLight PylotLight commented Feb 9, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features

    • Added the ability to specify a platform for development commands.
    • Enhanced multi-platform build support, including specific improvements for Linux and Mac platforms.
    • Introduced a more robust target parsing and handling mechanism for build processes.
  • Refactor

    • Streamlined the build process with simplified logic and improved error handling.
    • Overhauled initialization and parsing logic for build configurations.
    • Refactored internal command structures for clarity and efficiency.
  • Documentation

    • Updated changelog to include recent enhancements and contributor credits.

Copy link
Contributor

coderabbitai bot commented Feb 9, 2024

Walkthrough

The recent updates to the Wails framework focus on refining the build process, particularly around handling multiple targets, platform-specific logic, and error management. Enhancements include simplifying target iteration, improving platform and architecture assignments, and streamlining the initialization and parsing of build flags. Additionally, support for specifying platforms in development mode has been introduced, alongside better detection and handling for Windows Subsystem for Linux (WSL) environments.

Changes

Files Change Summaries
v2/cmd/wails/build.go Enhanced target handling, platform/architecture assignments, error management, and installer generation.
v2/cmd/wails/flags/build.go, .../common.go, .../dev.go Improved struct initialization, target parsing, and added platform targeting for dev command.
v2/cmd/wails/internal/dev/dev.go Updated command execution logic and added WSL detection.
v2/pkg/commands/build/build.go Added method for Windows platform check; removed unused field.
website/src/pages/changelog.mdx Documented platform targeting option for dev command.

"In the world of code, where changes abound,
A rabbit hopped in, improvements were found.
🐾 With every leap, and every bound,
Better builds and flags, in Wails they're crowned.
🚀"

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1c8e2ee and 0038068.
Files selected for processing (7)
  • v2/cmd/wails/build.go (6 hunks)
  • v2/cmd/wails/flags/build.go (4 hunks)
  • v2/cmd/wails/flags/common.go (1 hunks)
  • v2/cmd/wails/flags/dev.go (4 hunks)
  • v2/cmd/wails/internal/dev/dev.go (3 hunks)
  • v2/pkg/commands/build/build.go (2 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
Additional comments: 21
v2/cmd/wails/flags/common.go (5)
  • 16-19: The Target struct is well-defined for holding platform and architecture information.
  • 21-39: The defaultTarget function correctly determines the default platform and architecture, including special handling for Apple Silicon.
  • 43-53: The MacTargetsCount method in TargetsCollection correctly counts targets for macOS platforms.
  • 55-61: The String method for Target struct correctly formats the target as a string.
  • 63-79: The parseTargets function correctly parses platform strings into Target instances, including default architecture handling.
v2/cmd/wails/flags/build.go (2)
  • 52-55: The Default method in Build struct correctly initializes default values, including the platform from defaultTarget.
  • 74-75: The GetTargets method correctly utilizes parseTargets for parsing the platform field.
v2/cmd/wails/flags/dev.go (2)
  • 19-19: The addition of the Platform field in the Dev struct is correctly annotated with a description.
  • 41-45: The Default method in Dev struct correctly initializes the Platform field using defaultTarget.
v2/cmd/wails/build.go (7)
  • 111-111: The condition for adding the "Output File" to the build options table is correctly updated to check the number of targets.
  • 149-152: The loop correctly checks for valid platform and architecture combinations and skips unsupported ones.
  • 161-163: Correctly assigns platform and architecture to buildOptions from the target.
  • 167-167: Correctly warns about the unsupported compress flag for universal binaries on macOS.
  • 183-183: Correctly sets the bundle name for macOS targets when there are two Mac targets.
  • 173-191: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [188-197]

Correctly handles the output filename for multiple targets, including platform-specific adjustments.

  • 232-245: The logic for generating NSIS installers for Windows targets is correctly implemented, including error handling for missing targets.
v2/pkg/commands/build/build.go (1)
  • 74-76: The IsWindowsTargetPlatform method correctly checks if the platform is Windows.
v2/cmd/wails/internal/dev/dev.go (3)
  • 64-64: The runCommand function correctly executes a command with the provided arguments.
  • 271-279: The isWsl function correctly detects if the current environment is WSL by reading /proc/version.
  • 319-323: Correctly sets the WSLENV environment variable for Windows targets under WSL to pass through specified variables.
website/src/pages/changelog.mdx (1)
  • 17-18: LGTM!

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0038068 and 3172614.
Files selected for processing (4)
  • v2/cmd/wails/flags/build.go (4 hunks)
  • v2/cmd/wails/internal/dev/dev.go (3 hunks)
  • v2/pkg/commands/build/build.go (2 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
Additional comments: 6
v2/cmd/wails/flags/build.go (2)
  • 51-54: The change to use a target struct for setting default values in the Build struct's Default method is a good practice for maintainability. Ensure the defaultTarget function is correctly implemented and covered by tests.
  • 73-74: The update to return a TargetsCollection from GetTargets enhances the handling of target platforms. Verify that all usages of GetTargets have been updated to accommodate the new return type.
v2/pkg/commands/build/build.go (1)
  • 74-76: The addition of IsWindowsTargetPlatform improves code readability and maintainability by centralizing the platform check logic. Ensure this method is consistently used wherever a Windows platform check is required.
v2/cmd/wails/internal/dev/dev.go (2)
  • 274-282: The addition of the isWsl function is beneficial for detecting WSL environments. Ensure this function is correctly used wherever a WSL check is required.
  • 322-326: Adjusting environment variables for Windows targets under WSL using WSLENV is a good practice. Verify that all necessary environment variables are correctly passed through and handled.
website/src/pages/changelog.mdx (1)
  • 21-21: The summary mentions the addition of an option to specify the platform for the dev command, but it's not clear if this is a command-line flag or a configuration option. Clarifying this in the changelog could help users understand how to use this new feature.

@leaanthony
Copy link
Member

@PylotLight - you still keen to get this in?

@leaanthony leaanthony added the awaiting feedback More information is required from the requestor label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback More information is required from the requestor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants