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

IEP-1043: Allow the user to configure IDF_TOOLS_PATH #988

Merged
merged 9 commits into from
Aug 2, 2024

Conversation

alirana01
Copy link
Collaborator

@alirana01 alirana01 commented Jun 13, 2024

Description

A new setting in Espressif preference page is added that can allow the user to configure the idf tools path for installation.

Fixes # (IEP-1043)

Type of change

Please delete options that are not relevant.

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

How has this been tested?

Configure the property in the Preferences page to something else and install tools they should be installed and builds and basic operations should be working fine.

image

Test Configuration:

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

Checklist

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

Summary by CodeRabbit

  • Refactor

    • Replaced usage of System.getenv() with IDFUtil.getSystemEnv() across various components for consistent environment variable handling.
  • User Interface

    • Updated Espressif Preferences Page with a new IDF tools path setting, allowing users to browse and select a directory for IDF tools.
  • New Features

    • Added new string constants for IDF tools installation directory selection in preferences.
  • Bug Fixes

    • Ensured environment variables are resolved based on the platform, improving compatibility and reliability.

@alirana01 alirana01 self-assigned this Jun 13, 2024
Copy link

coderabbitai bot commented Jun 13, 2024

Warning

Rate limit exceeded

@alirana01 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 56 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 2dbc8e2 and d6106de.

Walkthrough

The primary change across the files involves replacing direct system environment variable access (System.getenv()) with a new utility method (IDFUtil.getSystemEnv()). This refactor centralizes environment variable management, enhancing maintainability and consistency throughout the codebase. Additionally, some files now facilitate IDF tools path configuration through the UI, improving the user experience.

Changes

File Change Summary
ESPToolChainManager.java, ToolsUtility.java, IDFMonitor.java, ToolsJob.java Replaced System.getenv() with IDFUtil.getSystemEnv() to retrieve environment variables.
IDFUtil.java Added new methods: resolveEnvVariable(String path) and getSystemEnv().
IDFEnvironmentVariables.java, AppLvlTracingDialog.java, AbstractToolsHandler.java Updated environment variable initialization to use IDFUtil.getSystemEnv().
EspToolCommands.java Refactored process creation to use ProcessBuilder with environment settings from IDFUtil.
IDFBuildConfiguration.java Added handling for IDF tools path environment variable in the build process.
SbomCommandDialog.java, ProductInformationHandler.java, ExportIDFTools.java, InstallToolsHandler.java Replaced System.getenv() with IDFUtil.getSystemEnv() in various command execution methods.
EspresssifPreferencesPage.java Added UI elements and logic for IDF tools path configuration.
Messages.java Added new string constants for ESP-IDF tools installation directory selection messages.
IDFSizeDataManager.java Updated method call to use IDFUtil.getSystemEnv().

Sequence Diagrams

Updated Environment Variable Management

sequenceDiagram
    participant User
    participant UI
    participant ESPToolChainManager
    participant IDFUtil
    
    User->>UI: Trigger action requiring env variables
    UI->>ESPToolChainManager: Request to run command
    ESPToolChainManager->>IDFUtil: Call getSystemEnv()
    IDFUtil-->>ESPToolChainManager: Return environment variables
    ESPToolChainManager->>UI: Execute command with env variables
    UI-->>User: Display results
Loading

Adding IDF Tools Path Configuration

sequenceDiagram
    participant User
    participant UI
    participant EspresssifPreferencesPage
    participant IDFUtil

    User->>UI: Open preferences
    UI->>EspresssifPreferencesPage: Load preferences page
    EspresssifPreferencesPage->>IDFUtil: Retrieve current IDF tools path
    IDFUtil-->>EspresssifPreferencesPage: Return IDF tools path
    User->>EspresssifPreferencesPage: Set new IDF tools path
    EspresssifPreferencesPage->>IDFUtil: Save new IDF tools path
    User->>UI: Confirm changes
    UI-->>User: Display confirmation
Loading

Poem

In the code, a change so grand,
Environment managed by a single hand.
With IDFUtil, the path's now clear,
For tools and builds, there's naught to fear.
Preferences set with ease and grace,
A smoother experience in every case.
🎉🐇


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 Configuration 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 ebbf7de and 7035981.

Files selected for processing (5)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (2 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (6 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (1 hunks)
Files not summarized due to errors (3)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java: Error: Server error. Please try again later.
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java: Error: Server error. Please try again later.
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java: Error: Server error. Please try again later.
Files skipped from review due to trivial changes (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties
Additional comments not posted (6)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java (1)

24-24: Added label for the ESP-IDF tools installation directory.

This label will help users identify the new preference for setting the ESP-IDF tools path.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (1)

35-38: Added constants for IDF_TOOLS_PATH.

These constants are well-defined and properly differentiate between Windows and other operating systems, which is crucial for path handling.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (3)

42-42: Added a new text field for IDF tools path.

This addition is necessary to allow users to specify a custom path for IDF tools directly from the preferences page.


105-127: Setup of label and text field for IDF tools path.

The label and text field are correctly configured and added to the GUI layout. The text field is properly initialized with the current or default settings value, ensuring a seamless user experience.


233-233: Proper handling of setting and defaulting the IDF tools path.

The code correctly handles the persistence of the IDF tools path across sessions by setting the value in the preference store and initializing it with the default if necessary.

Also applies to: 257-257, 274-274

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (1)

484-487: Correctly set the IDF_TOOLS_PATH in the environment.

The environment variable IDF_TOOLS_PATH is correctly retrieved from the preferences and set for the process environment. This is crucial for ensuring that the tools use the correct directory.

@AndriiFilippov
Copy link
Collaborator

AndriiFilippov commented Jun 24, 2024

@alirana01 hi !
Tested under:
OS - Windows 10
ESP-IDF: v5.2

My previous tools were installed in the /TESTTOOL/Espressif folder. I have set this folder as a user variable.
image

Using this PR I have configured new IDF with next(default) tools folder:
image

Once tools are installed, I do see it still execute python from /TESTTOOL/Espressif folder. So, tools are installed to user env PATH.
image

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.

public static final String IDF_TOOLS_PATH = "IDF_TOOLS_PATH"; //$NON-NLS-1$
public static final String IDF_TOOLS_PATH_DEFAULT = Platform.getOS().equals(Platform.OS_WIN32)
? "%USER_PROFILE\\.espressif" //$NON-NLS-1$
: "HOME/.espressif"; //$NON-NLS-1$
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it be $HOME/.espressif? Is it working on macOS and linux?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for pointing out fixed

Comment on lines +107 to +112
idfToolsPathText = new Text(toolsInstallationGroup, SWT.SINGLE | SWT.NONE);
GridData idfToolsPathTextGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
idfToolsPathTextGridData.widthHint = 200;
idfToolsPathText.setLayoutData(idfToolsPathTextGridData);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also provide a Browse button to choose a directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

@kolipakakondal
Copy link
Collaborator

Hi @AndriiFilippov Please verify this

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 7035981 and 5f38d21.

Files selected for processing (4)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (2 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (7 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties (1 hunks)
Additional comments not posted (20)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties (4)

16-16: LGTM!

The label for the ESP-IDF tools installation directory is clear and correctly formatted.


17-17: LGTM!

The title for the directory selection dialog is clear and correctly formatted.


18-18: LGTM!

The message for the directory selection dialog is clear and correctly formatted.


19-19: LGTM!

The label for the browse button is clear and correctly formatted.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java (4)

24-24: LGTM!

The string constant for the ESP-IDF tools installation directory label is clear and correctly formatted.


25-25: LGTM!

The string constant for the directory selection message is clear and correctly formatted.


26-26: LGTM!

The string constant for the directory selection title is clear and correctly formatted.


27-27: LGTM!

The string constant for the browse button label is clear and correctly formatted.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (2)

35-35: LGTM!

The constant for the IDF tools path preference key is clear and correctly formatted.


36-38: Verify the default IDF tools path for macOS and Linux.

Ensure that the default path works correctly on macOS and Linux as questioned in the previous review comment.

Verification successful

Verify the default IDF tools path for macOS and Linux.

Ensure that the default path "$HOME/.espressif" works correctly on macOS and Linux by checking if there are any specific platform checks or overrides in the codebase for these operating systems.


The default IDF tools path works correctly on macOS and Linux.

The default path "$HOME/.espressif" is used universally for non-Windows platforms, including macOS and Linux, without any specific overrides or additional checks in the codebase.

  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the default IDF tools path for macOS and Linux.

# Test: Check if the default path is correctly set based on the operating system.
# Expect: The default path should be "$HOME/.espressif" on macOS and Linux.

grep -r 'IDF_TOOLS_PATH_DEFAULT' .

Length of output: 592



Script:

#!/bin/bash
# Description: Verify if there are any platform-specific overrides for the default IDF tools path on macOS and Linux.

# Search for any platform-specific checks or overrides in the codebase related to IDF_TOOLS_PATH_DEFAULT.
rg 'IDF_TOOLS_PATH_DEFAULT' --context 5

Length of output: 4330

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (10)

3-14: LGTM!

The import statements for necessary classes are correctly formatted and provide the necessary context.


45-45: LGTM!

The Text field for the IDF tools path is correctly formatted and provides a clear field.


91-91: LGTM!

The layout for the tools installation group is correctly formatted and provides a clear layout.


100-103: LGTM!

The layout data for the git assets and python wheel text fields are correctly formatted and provide clear layout data.


108-113: LGTM!

The label and text field for the IDF tools path are correctly formatted and provide clear UI elements.


114-128: LGTM!

The browse button for the IDF tools path and its selection listener are correctly formatted and provide clear functionality.


132-144: LGTM!

The default values for the preference store are correctly formatted and provide clear default values.


249-250: LGTM!

The IDF tools path is correctly saved to the preference store.


274-274: LGTM!

The default value for the IDF tools path text field is correctly set.


291-291: LGTM!

The default value for the IDF tools path is correctly set in the preference store.

@alirana01
Copy link
Collaborator Author

@AndriiFilippov please try once the builds are fine, the issue was that the process runner was not resolving the home directory vars automatically. Also the config now should show the resolved value for the user home directory

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5f38d21 and fb42810.

Files selected for processing (5)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (2 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (7 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (3 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/ExportIDFTools.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java
Additional comments not posted (3)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (2)

107-143: LGTM! Ensure correct initialization and saving of the new field.

The changes are well-integrated and enhance the preferences UI. Verify that the new field is correctly initialized and saved in the preferences.


248-249: LGTM!

The changes correctly save the new preference for the IDF tools path.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (1)

751-785: LGTM!

The changes are well-implemented and correctly handle environment variable resolution for both Windows and Unix platforms.

Comment on lines 137 to 141
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);

environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
Copy link

Choose a reason for hiding this comment

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

Handle potential null values and optimize environment variable setting.

Ensure that idfToolsPath is not null before setting it in the environment. Additionally, the environment variable setting can be simplified.

-		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
-				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
-		
-		environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
+				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
+		if (idfToolsPath != null) {
+			environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
if (idfToolsPath != null) {
environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
}

Comment on lines 494 to 498
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);

environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
Copy link

Choose a reason for hiding this comment

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

Handle potential null values and optimize environment variable setting.

Ensure that idfToolsPath is not null before setting it in the environment. Additionally, the environment variable setting can be simplified.

-		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
-				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
-		
-		environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
+				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
+		if (idfToolsPath != null) {
+			environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
if (idfToolsPath != null) {
environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
}

Comment on lines 360 to 364
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);

environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
Copy link

Choose a reason for hiding this comment

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

Handle potential null values and optimize environment variable setting.

Ensure that idfToolsPath is not null before setting it in the environment. Additionally, the environment variable setting can be simplified.

-		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
-				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
-		
-		environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
+				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
+		if (idfToolsPath != null) {
+			environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
if (idfToolsPath != null) {
environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
}

Comment on lines 212 to 216
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);

environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
Copy link

Choose a reason for hiding this comment

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

Handle potential null values and optimize environment variable setting.

Ensure that idfToolsPath is not null before setting it in the environment. Additionally, the environment variable setting can be simplified.

-		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
-				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
-		
-		environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
+				IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
+		if (idfToolsPath != null) {
+			environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
+		}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
environment.put("IDF_TOOLS_PATH", //$NON-NLS-1$
idfToolsPath);
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
if (idfToolsPath != null) {
environment.put("IDF_TOOLS_PATH", idfToolsPath); //$NON-NLS-1$
}

@AndriiFilippov
Copy link
Collaborator

@alirana01 hi !

now I could see .espressif folder created and tools installed there.
But once I build project I could see it is still using user env path tools.

see logs.
buildLOG.txt

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 fb42810 and 2cf4edc.

Files selected for processing (12)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java (2 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (3 hunks)
  • bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SbomCommandDialog.java (3 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/help/ProductInformationHandler.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (4 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tracing/AppLvlTracingDialog.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/ExportIDFTools.java (5 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/InstallToolsHandler.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/InstallToolsHandler.java
Files skipped from review as they are similar to previous changes (3)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/ExportIDFTools.java
Additional comments not posted (10)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/help/ProductInformationHandler.java (1)

134-134: Standardize environment variable access.

The change replaces System.getenv() with IDFUtil.getSystemEnv(), which helps in standardizing environment variable access across the project.

bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java (1)

162-162: Standardize environment variable access.

The change replaces System.getenv() with IDFUtil.getSystemEnv(), which helps in standardizing environment variable access across the project.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java (1)

169-169: Standardize environment variable access.

The change replaces System.getenv() with IDFUtil.getSystemEnv(), which helps in standardizing environment variable access across the project.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (1)

146-146: Standardize environment variable access.

The change replaces System.getenv() with IDFUtil.getSystemEnv(), which helps in standardizing environment variable access across the project.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java (1)

322-322: LGTM!

The change to use IDFUtil.getSystemEnv() enhances consistency and maintainability.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tracing/AppLvlTracingDialog.java (1)

301-301: LGTM!

The change to use IDFUtil.getSystemEnv() enhances consistency and maintainability.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SbomCommandDialog.java (3)

286-286: LGTM!

The change to use IDFUtil.getSystemEnv() enhances consistency and maintainability.


438-438: LGTM!

The change to use IDFUtil.getSystemEnv() enhances consistency and maintainability.


453-453: LGTM!

The change to use IDFUtil.getSystemEnv() enhances consistency and maintainability.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java (1)

318-318: LGTM!

The change to use IDFUtil.getSystemEnv() enhances consistency and maintainability.

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 2cf4edc and 7202246.

Files selected for processing (16)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (2 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java (2 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (3 hunks)
  • bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SbomCommandDialog.java (3 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/help/ProductInformationHandler.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (7 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (4 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tracing/AppLvlTracingDialog.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/ExportIDFTools.java (5 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/InstallToolsHandler.java (1 hunks)
Files skipped from review due to trivial changes (2)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/InstallToolsHandler.java
Files skipped from review as they are similar to previous changes (11)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/dialogs/SbomCommandDialog.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/help/ProductInformationHandler.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tracing/AppLvlTracingDialog.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/ExportIDFTools.java
Additional comments not posted (6)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (4)

10-10: Approved: Necessary import added.

The addition of the Platform import is required for the new logic.


16-16: Approved: Necessary import added.

The addition of the IDFUtil import is required for the new logic.


37-37: Approved: New constant added.

The addition of the IDF_TOOLS_PATH constant is necessary for the new feature.


38-40: Approved: New constant with platform-specific logic added.

The addition of the IDF_TOOLS_PATH_DEFAULT constant with platform-specific logic ensures the correct default path is set for different operating systems.

bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java (1)

162-162: Approved: Standardized environment variable retrieval.

The change to use IDFUtil.getSystemEnv() instead of System.getenv() improves maintainability and consistency.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/ESPToolChainManager.java (1)

318-318: Approved: Standardized environment variable retrieval.

The change to use IDFUtil.getSystemEnv() instead of System.getenv() improves maintainability and consistency.

@AndriiFilippov
Copy link
Collaborator

AndriiFilippov commented Jul 8, 2024

@alirana01 hi !

it still takes some python dependencies from user env path during build process:

Building in: C:\Users\AndriiFilippov\workspaceTEST1ALI111\jhjy\build
Configuring in: C:\Users\AndriiFilippov\workspaceTEST1ALI111\jhjy\build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=C:\Users\AndriiFilippov\e\esp-id f\esp-idf-v5.2.2\tools\cmake\toolchain-esp32.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCCACHE_ENABLE=1 -DIDF_TARGET=esp32 C:\Users\AndriiFilippov\workspaceTEST1ALI111\jhjy
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.28.0.windows.1") 
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/AndriiFilippov/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/AndriiFilippov/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/AndriiFilippov/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Checking Python dependencies...
Constraint file: C:\Users\AndriiFilippov\tool1\espidf.constraints.v5.2.txt
Requirement files:
 - C:\Users\AndriiFilippov\e\esp-id f\esp-idf-v5.2.2\tools\requirements\requirements.core.txt
Python being checked: C:\Users\AndriiFilippov\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe
Python requirements are satisfied.
-- Project sdkconfig file C:/Users/AndriiFilippov/workspaceTEST1ALI111/jhjy/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t

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 7202246 and fcc860f.

Files selected for processing (2)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (3 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java
Additional comments not posted (2)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (2)

540-542: LGTM! Verify the correctness of startBuildProcess() method.

The addition of the idfToolsPathEnvVar to the list of environment variables for startBuildProcess() is appropriate for including the new IDF tools path in the build process.

To ensure correctness, verify that startBuildProcess() correctly handles the environment variables.


416-418: LGTM! Verify the correctness of IDFUtil.getIDFToolsPathFromPreferences().

The addition of the IDF_TOOLS_PATH environment variable to the envVars list is appropriate for including the new IDF tools path in the build process.

To ensure correctness, verify that IDFUtil.getIDFToolsPathFromPreferences() returns the expected path.

Verification successful

Verification Successful: Definitions of IDF_TOOLS_PATH and IDF_TOOLS_PATH_DEFAULT are correct.

The constants IDF_TOOLS_PATH and IDF_TOOLS_PATH_DEFAULT are correctly defined in IDFCorePreferenceConstants.java, ensuring that the method IDFUtil.getIDFToolsPathFromPreferences() returns the expected path.

  • IDF_TOOLS_PATH is defined as "IDF_TOOLS_PATH".
  • IDF_TOOLS_PATH_DEFAULT resolves to the appropriate path based on the operating system.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of `IDFUtil.getIDFToolsPathFromPreferences()` method.

# Test: Search for the method definition. Expect: Correct path retrieval logic.
ast-grep --lang java --pattern $'public static String getIDFToolsPathFromPreferences() { $$$ }'

Length of output: 869


Script:

#!/bin/bash
# Description: Verify the correctness of `IDFCorePreferenceConstants.IDF_TOOLS_PATH` and `IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT`.

# Test: Search for the definitions of IDF_TOOLS_PATH and IDF_TOOLS_PATH_DEFAULT in IDFCorePreferenceConstants.
ast-grep --lang java --pattern $'public static final String IDF_TOOLS_PATH = $_;' ./bundles/com.espressif.idf.core/src/com/espressif/idf/core/preferences/IDFCorePreferenceConstants.java
ast-grep --lang java --pattern $'public static final String IDF_TOOLS_PATH_DEFAULT = $_;' ./bundles/com.espressif.idf.core/src/com/espressif/idf/core/preferences/IDFCorePreferenceConstants.java

Length of output: 683


Script:

#!/bin/bash
# Locate the file defining `IDFCorePreferenceConstants`
fd 'IDFCorePreferenceConstants.java'

# Verify the definitions of `IDF_TOOLS_PATH` and `IDF_TOOLS_PATH_DEFAULT`
ast-grep --lang java --pattern $'public static final String IDF_TOOLS_PATH = $_;' $(fd 'IDFCorePreferenceConstants.java')
ast-grep --lang java --pattern $'public static final String IDF_TOOLS_PATH_DEFAULT = $_;' $(fd 'IDFCorePreferenceConstants.java')

Length of output: 556


Script:

#!/bin/bash
# Display the content of `IDFCorePreferenceConstants.java` to manually verify the definitions of `IDF_TOOLS_PATH` and `IDF_TOOLS_PATH_DEFAULT`.
cat bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java

Length of output: 3191

@alirana01
Copy link
Collaborator Author

@alirana01 hi !

it still takes some python dependencies from user env path during build process:

@AndriiFilippov can you please try again with latest build

@AndriiFilippov
Copy link
Collaborator

AndriiFilippov commented Jul 9, 2024

@alirana01 hi !

Using .espressif tool folder and v5.1 ESP-IDF.

Still referring to user tool path -> during "ESP-IDF: Project Full Clean" execution:

ERROR: C:\Users\AndriiFilippov\tool1\espidf.constraints.v5.1.txt doesn't exist. Perhaps you've forgotten to run the install scripts. Please check the installation guide for more information.

ESP-IDF v5.1.4-474-gbae9a3a29f

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 fcc860f and 43b6a1c.

Files selected for processing (2)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFEnvironmentVariables.java (3 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspToolCommands.java (1 hunks)
Additional comments not posted (4)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspToolCommands.java (3)

28-30: Correct usage of IDFUtil.getSystemEnv().

The method now correctly uses IDFUtil.getSystemEnv() to set environment variables for ProcessBuilder.


37-39: Correct usage of IDFUtil.getSystemEnv().

The method now correctly uses IDFUtil.getSystemEnv() to set environment variables for ProcessBuilder.


46-48: Correct usage of IDFUtil.getSystemEnv().

The method now correctly uses IDFUtil.getSystemEnv() to set environment variables for ProcessBuilder.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFEnvironmentVariables.java (1)

Line range hint 131-141: Correct usage of IDFUtil.getSystemEnv().

The method now correctly uses IDFUtil.getSystemEnv() to set environment variables.

@AndriiFilippov
Copy link
Collaborator

@alirana01 hi !

Windows 10

affected (still refer to usr tool path) :

  • "Espressif" -> Product Information
  • ESP-IDF: Python Clean
  • ESP-IDF: Project Clean
  • ESP-IDF: Project Full Clean
  • ESP-IDF: Application Size Analyzer
  • ESP-IDF: Install New Component
  • Can't open sdkconfig files

@kolipakakondal
Copy link
Collaborator

Hi @alirana01 Could you address the affected functionality as well?

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 43b6a1c and 2dbc8e2.

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

21-21: Import statement looks good.

The import statement for IDFUtil is correctly added and necessary for the changes in the file.


131-131: Using IDFUtil.getSystemEnv() enhances maintainability.

The change to use IDFUtil.getSystemEnv() centralizes environment variable management, which improves maintainability and consistency.


137-140: Conditional check for IDFCorePreferenceConstants.IDF_TOOLS_PATH is appropriate.

The conditional check to skip IDFCorePreferenceConstants.IDF_TOOLS_PATH ensures that this specific environment variable is not included in the final map, preventing potential conflicts.

@alirana01
Copy link
Collaborator Author

@AndriiFilippov can you verify these things again please make sure to test on other platforms as well by setting the IDF_TOOLS_PATH in system env to some other value

@AndriiFilippov
Copy link
Collaborator

@alirana01 hi !

Tested under:
OS - Windows 10/11, Linux, MacOS
ESP-IDF: v5.1 / v5.2

"Espressif" -> Product Information ✅
ESP-IDF: Python Clean ✅
ESP-IDF: Project Clean ✅
ESP-IDF: Project Full Clean ✅
ESP-IDF: Application Size Analyzer ✅
ESP-IDF: Install New Component ✅
Can open sdkconfig files ✅

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.

3 participants