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

feat: added support for multi_config #984

Merged
merged 2 commits into from
Jul 19, 2024
Merged

feat: added support for multi_config #984

merged 2 commits into from
Jul 19, 2024

Conversation

sigmaaa
Copy link
Collaborator

@sigmaaa sigmaaa commented Jun 11, 2024

Description

added ability to run sdkconfig from any build folder

Fixes # (IEP-1250)

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)

How has this been tested?

  • Create the multi_conf project example.
  • Try to build with different custom build folders
  • run sdkconfigs from different directories

Test Configuration:

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

Dependent components impacted by this PR:

  • Component 1
  • Component 2

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

    • Improved handling of custom build directories in project settings.
    • Enhanced SDK configuration management with new methods for setting and managing build folders.
  • Bug Fixes

    • Corrected logic for extracting build directories from CMake arguments.
  • Enhancements

    • Refined error handling and UI creation for SDK configuration files.
    • Updated logic in configuration server management for better performance and reliability.

Copy link

coderabbitai bot commented Jun 11, 2024

Walkthrough

The recent changes involve updates to the handling of build directories in the IDFBuildConfiguration file, improvements in the IDFUtil class, and enhancements in the SDKConfigurationEditor for managing SDK configuration files and errors. Additionally, the ConfigServerManager has seen updates in its server retrieval and equality comparison methods.

Changes

File Path Summary
...idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java Modified logic for extracting and setting custom build directories from CMake arguments.
...idf.core/src/com/espressif/idf/core/util/IDFUtil.java Introduced a new method setBuildDir to set the project build directory and made minor formatting changes.
...idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java Added imports and methods for handling build folder settings, SDK configuration files, and error handling.
...idf.sdk.config.core/src/com/espressif/idf/sdk/config/core/server/ConfigServerManager.java Updated server retrieval logic and comparison for file attributes in equals method.

Poem

In the realm where code does bind,
Configurations now refined,
Build paths clearer, no more fear,
SDK configs we hold dear.
Server checks with careful eyes,
Espressif's code now reaches skies.
🐇✨


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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 87a02b4 and c69a185.

Files selected for processing (3)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (2 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (8 hunks)
  • bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java (17 hunks)
Files skipped from review due to trivial changes (1)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java
Additional comments not posted (4)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (2)

182-191: Refactored extraction of custom build directory from CMake arguments.

The refactoring from a direct string search to using an array and iterating through it is a more robust and clear method for handling the extraction of the -B argument. This change should help in avoiding potential bugs related to string manipulation and makes the code easier to understand and maintain.


194-194: Utilization of the new IDFUtil.setBuildDir method to set the build directory.

This change centralizes the setting of the build directory into a utility method, which is a good practice as it abstracts the logic away from the client code, making it reusable and easier to maintain. Ensure that the setBuildDir method handles all edge cases appropriately.

bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java (2)

12-12: Added imports to support new functionality.

These imports are necessary for the new methods and functionalities introduced in this file.

Also applies to: 14-14, 18-19, 22-22, 72-72, 74-74


152-152: Enhanced build folder management during SDK configuration editing.

The changes introduce a more robust handling of the build folder during the configuration editing process, including setting and rolling back the build folder based on the location of the sdkconfig. This is a good practice to ensure that the environment reflects the current state of the configuration being edited.

Also applies to: 153-153, 160-165, 186-189, 215-216

Comment on lines +997 to +1007
String buildFolder = StringUtil.EMPTY;
try
{
buildFolder = IDFUtil.getBuildDir(project);
}
catch (CoreException e)
{
Logger.log(e);
}
return buildFolder;
}
Copy link

Choose a reason for hiding this comment

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

Refactored methods for build folder management and SDK configuration location checks.

The refactoring of these methods improves the clarity and maintainability of the code. It's good to see that optional and exception handling are used effectively to manage the build directory settings and checks.

Also applies to: 1009-1019, 1021-1026, 1028-1036

@sigmaaa sigmaaa changed the title WIP: feat: added support for multi_config feat: added support for multi_config Jun 19, 2024
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

@AndriiFilippov
Copy link
Collaborator

@sigmaaa hi !

Tested under:
OS - Windows 10
ESP-IDF: v5.2

able to build multi config to same project. ✔️ able to open every sdkconfig file ✔️
but if open sdk file from every "build" folder together - then sometime it lead to this error:

image

@kolipakakondal
Copy link
Collaborator

@sigmaaa hi !

Tested under: OS - Windows 10 ESP-IDF: v5.2

able to build multi config to same project. ✔️ able to open every sdkconfig file ✔️ but if open sdk file from every "build" folder together - then sometime it lead to this error:

image

@sigmaaa can you please check this?

@sigmaaa
Copy link
Collaborator Author

sigmaaa commented Jul 15, 2024

@sigmaaa hi !

Tested under: OS - Windows 10 ESP-IDF: v5.2

able to build multi config to same project. ✔️ able to open every sdkconfig file ✔️ but if open sdk file from every "build" folder together - then sometime it lead to this error:

image

Hi @AndriiFilippov, @kolipakakondal,

fixed in the last commit, PTAL

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 c69a185 and ec1a881.

Files selected for processing (1)
  • bundles/com.espressif.idf.sdk.config.core/src/com/espressif/idf/sdk/config/core/server/ConfigServerManager.java (2 hunks)
Additional comments not posted (3)
bundles/com.espressif.idf.sdk.config.core/src/com/espressif/idf/sdk/config/core/server/ConfigServerManager.java (3)

52-52: LGTM! The addition of throws IOException is appropriate.

The throws IOException clause ensures that any IO exceptions encountered during the creation or starting of the JsonConfigServer are properly propagated.


75-76: LGTM! The updated comparison logic for file attributes is more accurate.

Using getLocation() for comparison improves the accuracy of the equals method.


82-82: LGTM! The updated hashCode method ensures consistency with equals.

Using Objects.hash with project.getName() and file.getLocation() ensures that the hash code is consistent with the equals method.

Copy link
Collaborator Author

@sigmaaa sigmaaa left a comment

Choose a reason for hiding this comment

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

Self reviewed

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

@AndriiFilippov
Copy link
Collaborator

AndriiFilippov commented Jul 18, 2024

@sigmaaa hi !

Tested under:
OS - Windows 10, Linux, MacOS

LGTM 👍

There is some mistakes in docs, please update it.

Example does not work with provided command idf.py -B build_prod1 -D SDKCONFIG_DEFAULTS="sdkconfig.prod_common;sdkconfig.prod1" build
Should be: idf.py -B build_prod1 -D SDKCONFIG_DEFAULTS= sdkconfig.prod_common;sdkconfig.prod1 build

sdkconfig.prod1sdkconfig.prod1

Same here and this typo as well:
|
image

https://github.com/espressif/esp-idf/tree/master/examples/build_system/cmake/multi_config#production-build-output

Moreover, I was not able to set different sdkconfigs for particular "build" folder,
it always reset "sdkconfig.prod" files to default. 🚫
I know it is not related to your PR, but I think we should still discuss it.

@AndriiFilippov
Copy link
Collaborator

@sigmaaa hi !

Tested under:
OS - Windows 10 / MacOS

LGTM 👍

@kolipakakondal kolipakakondal merged commit e97546f into master Jul 19, 2024
5 of 6 checks passed
@kolipakakondal kolipakakondal added this to the v3.1.0 milestone Jul 19, 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.

3 participants