Skip to content

Conversation

@sigmaaa
Copy link
Collaborator

@sigmaaa sigmaaa commented Jun 24, 2024

Description

  • Added messages for fields in the Build Settings tab to give some context to the user.
  • The relative custom-build folder path now relates to the project folder instead of the workspace

Fixes # (IEP-1272)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • build, and clean with a custom build folder with absolute and relative paths

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Custom build folder
  • Launch configuration (Build Settings tab)

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Added default messages for CMake arguments, build commands, and clean commands.
    • Introduced handling of local CMake arguments with project-specific paths.
  • Improvements

    • Enhanced the configuration processing to include absolute project paths in CMake arguments.

@coderabbitai
Copy link

coderabbitai bot commented Jun 24, 2024

Walkthrough

The recent updates to CMakeBuildTab2.java in the com.espressif.idf.ui.dialogs package enhance the handling of CMake arguments and commands by introducing new constants for default values and refining how these parameters are processed and stored within configurations. This includes managing local CMake arguments, setting default messages for CMake, build, and clean commands, and adding functionality to handle absolute project paths within CMake arguments.

Changes

File Change Summary
.../dialogs/CMakeBuildTab2.java Added constants for default messages, modified CMake argument handling, added method getCmakeArgumentsWithAbsProjectPath
.../dialogs/CMakeBuildTab2.java Updated initializeFrom, performApply, saveProperties and restoreProperties to use new constants and handle paths.

Poem

In the realm of code, a change so keen,
CMake commands now run pristine.
With arguments clear and paths set right,
Builds and cleans take flight.
Constants align, a rabbit's delight,
Happy coding in the morning light! 🌅✨


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 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 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 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 as 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.

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.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

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

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a9fcf47 and 47dbf24.

Files selected for processing (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/CMakeBuildTab2.java (9 hunks)
Additional comments not posted (7)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/CMakeBuildTab2.java (7)

13-13: New Import Added: java.nio.file.Path

The addition of the java.nio.file.Path import suggests that file path operations have been introduced in this class, likely to handle file paths more robustly, especially with the new features related to handling build and clean commands.


48-53: Introduction of Constants for CMake Arguments and Messages

The addition of constants LOCAL_CMAKE_ARGUMENTS, DEFAULT_CMAKE_MSG, DEFAULT_BUILD_MSG, and DEFAULT_CLEAN_MSG is a good practice for maintainability and readability. Using constants helps avoid magic strings throughout the code and makes future changes easier and less error-prone.


113-113: Set Default Messages for Text Fields

Setting default messages for cmakeArgsText, buildCommandText, and cleanCommandText enhances user experience by providing hints about what values are expected. This is a positive change that aligns with the PR's objective to improve user experience in the Build Settings tab.

Also applies to: 121-121, 129-129


Line range hint 170-224: Handling of CMake Arguments with Absolute Project Path

The method getCmakeArgumentsWithAbsProjectPath is used here to ensure that the CMake arguments are correctly formatted with absolute paths when necessary. This is crucial for ensuring that the build configuration is portable and not dependent on implicit path relations, which can vary between different environments and setups.


Line range hint 204-228: Robust Handling of Configuration Attributes in performApply

The updates in the performApply method to handle attributes related to CMake arguments, build commands, and clean commands more dynamically are commendable. These changes make the configuration more adaptable and maintainable. However, ensure that the conditions and logic here cover all edge cases, particularly with empty strings and null values.


260-260: Save and Restore Properties Enhancements

The modifications in saveProperties and restoreProperties to include LOCAL_CMAKE_ARGUMENTS enhance the persistence of user settings across sessions. This is a critical improvement for user experience, ensuring that users' configurations are reliably maintained.

Also applies to: 286-286


355-374: Method to Process Absolute Project Paths in CMake Arguments

The implementation of getCmakeArgumentsWithAbsProjectPath is a key part of handling the relative custom build folder paths. This method ensures that paths are handled correctly, which is crucial for the build process to function correctly in different environments. However, the method could be refined to handle potential edge cases and improve clarity.

-	String[] cmakeArgsArr = cmakeArgsText.getText().trim().replaceAll(" +", " ").split(" ");
+	String[] cmakeArgsArr = cmakeArgumets.split("\\s+");  // Simplify splitting logic
-	if (cmakeArgsArr[i].equals("-B") && i + 1 < cmakeArgsArr.length)
+	if ("-B".equals(cmakeArgsArr[i]) && i + 1 < cmakeArgsArr.length)  // Use constant-time string comparison

Ensure that the method handles cases where the build folder might not follow immediately after -B due to spaces or other command line arguments.

Copy link
Collaborator

@kolipakakondal kolipakakondal left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 47dbf24 and 3ad6215.

Files selected for processing (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/CMakeBuildTab2.java (9 hunks)
Additional comments not posted (7)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/CMakeBuildTab2.java (7)

48-53: LGTM! Constants improve readability and maintainability.

The added constants help avoid hard-coded strings and improve code readability.


113-113: LGTM! Default messages provide context to the user.

Setting default messages for the text fields helps users understand what values are expected.

Also applies to: 121-121, 129-129


170-171: LGTM! Ensures preference for local CMake arguments.

The change aligns with the new functionality by preferring local CMake arguments over global ones.


Line range hint 204-224:
LGTM! Correctly sets CMake arguments with absolute paths.

The change ensures that the CMake arguments are correctly set with absolute project paths when a project is available.

Also applies to: 228-228


260-260: LGTM! Saves local CMake arguments.

The change aligns with the new functionality by saving local CMake arguments.


286-286: LGTM! Restores local CMake arguments.

The change aligns with the new functionality by restoring local CMake arguments.


355-376: Fix the typo in the method name.

The method name getCmakeArgumentsWithAbsProjectPath contains a typo. It should be getCmakeArgumentsWithAbsProjectPath.

- private String getCmakeArgumentsWithAbsProjectPath(IProject project, String cmakeArgumets)
+ private String getCmakeArgumentsWithAbsProjectPath(IProject project, String cmakeArguments)

Likely invalid or redundant comment.

@AndriiFilippov
Copy link
Collaborator

@sigmaaa hi !

Tested under:
OS - Windows 10
ESP-IDF: v.5.2

Steps to reproduce:
create project -> build project ESP32 target-> create new Launch Config -> add -B test -> change target to any -> pop-up asking to delete build folder (original one) 🔴

@sigmaaa
Copy link
Collaborator Author

sigmaaa commented Jul 5, 2024

@sigmaaa hi !

Tested under: OS - Windows 10 ESP-IDF: v.5.2

Steps to reproduce: create project -> build project ESP32 target-> create new Launch Config -> add -B test -> change target to any -> pop-up asking to delete build folder (original one) 🔴

Hi @AndriiFilippov
this is expected behavior because the project is not yet built with a new build folder. In that case, the user clicks No not to delete the build folder.
Also, changes in the PR are not related to this use case, so on the current master the behavior should be the same

@AndriiFilippov
Copy link
Collaborator

@sigmaaa
ok

LGTM

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.

4 participants