Skip to content

IEP-1600 EspConfigParser refactoring#1271

Merged
alirana01 merged 5 commits into
masterfrom
IEP-1600
Jul 24, 2025
Merged

IEP-1600 EspConfigParser refactoring#1271
alirana01 merged 5 commits into
masterfrom
IEP-1600

Conversation

@sigmaaa

@sigmaaa sigmaaa commented Jul 14, 2025

Copy link
Copy Markdown
Collaborator

Description

The goal of this PR is to optimize EspConfigParser by using faster gson instead of json-simple, load the config file only once in the constructor, and avoid unnecessary exceptions like java.io.FileNotFoundException: \esp-config.json (The system cannot find the file specified)

Fixes # (IEP-1600)

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?

  • Verify Launch Target by comparing the selected target and the boards/config that appear
  • Verify Launch/Flash/Debug
  • Verify there is no exception when esp-config.json is missing

Test Configuration:

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

Dependent components impacted by this PR:

  • Launch Target
  • New Project Wizard
  • Launch/Debug

Checklist

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

Summary by CodeRabbit

  • Refactor

    • Improved performance and reliability of ESP configuration handling by optimizing how configuration files are read and parsed.
    • Enhanced type safety and error handling for ESP board and target configurations.
    • Updated UI components to use the new board data model for displaying and selecting ESP boards.
  • Tests

    • Added comprehensive tests to verify correct parsing and retrieval of ESP targets, flash voltages, and board configurations.
  • Chores

    • Introduced a new sample configuration file for testing and reference.
    • Updated package exports to support the new configuration parser structure.

@coderabbitai

coderabbitai Bot commented Jul 14, 2025

Copy link
Copy Markdown

Walkthrough

The EspConfigParser was rewritten to use Gson for JSON parsing with strong typing and caching of the parsed configuration. It now returns typed records such as Board and uses lists instead of raw JSON structures. Related classes were updated to use the new API. A detailed esp-config.json test resource and a JUnit test suite were added to validate the new parser.

Changes

File(s) Change Summary
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java Deleted old EspConfigParser class using json-simple and raw JSON; replaced by new implementation in different package.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/EspConfigParser.java Added new EspConfigParser using Gson with typed records, caching, and enhanced methods returning typed collections.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/*.java Added new Java records: Board, EspConfig, Option, Target to strongly type the config data.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/DefaultBoardProvider.java Updated to use new EspConfigParser.getBoardsForTarget() returning List instead of Map<String, JSONArray>.
bundles/com.espressif.idf.core/src/com/espressif/idf/core/variable/JtagVariableResolver.java Changed board config retrieval to use List from new EspConfigParser API instead of Map<String, JSONArray>.
bundles/com.espressif.idf.launch.serial.ui/.../NewSerialFlashTargetWizardPage.java Updated to use new EspConfigParser.getBoardsForTarget() returning List, changed board name extraction accordingly.
bundles/com.espressif.idf.core/META-INF/MANIFEST.MF Exported new packages com.espressif.idf.core.configparser and com.espressif.idf.core.configparser.vo.
bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/util/ESPFlashUtil.java Updated import of EspConfigParser to new package com.espressif.idf.core.configparser.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/templates/NewProjectCreationWizardPage.java Updated import of EspConfigParser to new package com.espressif.idf.core.configparser.
tests/com.espressif.idf.core.test/resources/esp-config.json Added comprehensive JSON config file defining ESP targets, boards, interfaces, and options for testing.
tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java Added JUnit tests validating new EspConfigParser functionality and correctness using the added esp-config.json resource.

Sequence Diagram(s)

sequenceDiagram
    participant Test as EspConfigParserTest
    participant Parser as EspConfigParser
    participant File as esp-config.json

    Test->>Parser: new EspConfigParser(jsonPath)
    Parser->>File: Read and parse JSON (Gson)
    File-->>Parser: EspConfig object
    Parser-->>Test: Instance ready

    Test->>Parser: getTargets()
    Parser-->>Test: Set<String> (from cached config)

    Test->>Parser: getEspFlashVoltages()
    Parser-->>Test: List<String> (from cached config)

    Test->>Parser: getBoardsForTarget(target)
    Parser-->>Test: List<Board> (from cached config)

    Test->>Parser: hasBoardConfigJson()
    Parser-->>Test: boolean
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

needs translation:CN

Suggested reviewers

  • AndriiFilippov
  • kolipakakondal
  • alirana01

Poem

🐇 Hopping through configs, fresh and bright,
Gson paints JSON in pure daylight.
Boards and targets, neatly aligned,
Tests ensure no bugs we find.
From old to new, the parser’s flight,
CodeRabbit cheers, all systems right! 🌿✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch IEP-1600

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java (1)

42-53: Enhance test coverage with edge cases and error handling.

The test correctly verifies basic functionality, but consider adding tests for edge cases such as:

  • Missing or corrupted JSON file
  • Empty targets array
  • Null config handling

Add these additional test methods:

@Test
public void testGetTargetsWithNonExistentFile()
{
    EspConfigParser parser = new EspConfigParser("non-existent-file.json");
    
    Set<String> targets = parser.getTargets();
    
    assertNotNull(targets);
    assertTrue(targets.isEmpty());
}

@Test
public void testGetBoardsConfigsWithNonExistentTarget()
{
    EspConfigParser parser = new EspConfigParser(tempJsonFile.getAbsolutePath());
    
    Map<String, List<String>> configs = parser.getBoardsConfigs("non-existent-target");
    
    assertNotNull(configs);
    assertTrue(configs.isEmpty());
}
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java (2)

41-59: Enhance error handling with more specific logging.

The error handling is good but could be more informative. Consider logging the specific error type and providing more context.

Apply this diff to improve error logging:

 private EspConfig loadConfig()
 {
     File file = new File(espConfigPath);
     if (!file.exists())
     {
-        Logger.log("esp-config.json not found at: " + espConfigPath); //$NON-NLS-1$
+        Logger.log("esp-config.json not found at: " + espConfigPath + ". Using empty configuration."); //$NON-NLS-1$
         return null;
     }

     try (FileReader reader = new FileReader(file))
     {
         return gson.fromJson(reader, EspConfig.class);
     }
     catch (IOException e)
     {
-        Logger.log(e);
+        Logger.log("Failed to parse esp-config.json at: " + espConfigPath + ". " + e.getMessage(), e); //$NON-NLS-1$
         return null;
     }
 }

115-139: Consider adding validation annotations for better data integrity.

The nested classes correctly model the JSON structure, but consider adding validation annotations to ensure data integrity during deserialization.

Apply this diff to add validation:

+import com.google.gson.annotations.SerializedName;
+
 private static class EspConfig
 {
+    @SerializedName("targets")
     List<Target> targets;
+    @SerializedName("options")
     List<Option> options;
+    @SerializedName("boards")
     List<Board> boards;
 }

 private static class Target
 {
+    @SerializedName("id")
     String id;
 }

 private static class Option
 {
+    @SerializedName("name")
     String name;
+    @SerializedName("values")
     List<String> values;
 }

 private static class Board
 {
+    @SerializedName("name")
     String name;
+    @SerializedName("target")
     String target;
+    @SerializedName("config_files")
     List<String> config_files;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab1129 and 87f4f5d.

📒 Files selected for processing (4)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java (2 hunks)
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java (1 hunks)
  • tests/com.espressif.idf.core.test/resources/esp-config.json (1 hunks)
  • tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java (1)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java (1)
  • EspConfigParser (21-139)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java (1)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/logging/Logger.java (1)
  • Logger (21-137)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build_macos
🔇 Additional comments (4)
bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java (1)

267-267: LGTM! Clean adaptation to the new strongly-typed API.

The type change from Map<String, JSONArray> to Map<String, List<String>> correctly adapts to the refactored EspConfigParser API, maintaining the same functionality while leveraging strong typing.

tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java (1)

26-40: LGTM! Clean test setup with proper resource management.

The test setup correctly copies the resource file to a temporary location and ensures cleanup with deleteOnExit(). The try-with-resources statement properly handles file operations.

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

24-39: LGTM! Excellent refactoring with proper caching and constructor overloading.

The addition of configuration caching and constructor overloading improves both performance and testability. The immutable fields ensure thread safety after construction.


61-75: LGTM! Robust implementation with proper null safety.

The method correctly handles null config and null targets with appropriate fallbacks. The use of LinkedHashSet maintains insertion order while preventing duplicates.

Comment on lines +3 to +12
"targets" : [
{ "id": "esp32", "name": "ESP32", "idcode": "0x120034e5", "ocdid": "0x0733bff2"},
{ "id": "esp32s2", "name": "ESP32-S2", "idcode": "0x120034e5", "ocdid": "0x03339fd2" },
{ "id": "esp32s3", "name": "ESP32-S3", "idcode": "0x120034e5", "ocdid": "0x0b339fd2" },
{ "id": "esp32c2", "name": "ESP32-C2", "idcode": "0x0000cc25" },
{ "id": "esp32c3", "name": "ESP32-C3", "idcode": "0x00005c25" },
{ "id": "esp32c5", "name": "ESP32-C5", "idcode": "0x00017c25" },
{ "id": "esp32c6", "name": "ESP32-C6", "idcode": "0x0000dc25" },
{ "id": "esp32h2", "name": "ESP32-H2", "idcode": "0x00010c25" },
{ "id": "esp32p4", "name": "ESP32-P4", "idcode": "0x00012c25" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify ESP32-C61 target definition is included.

The ESP32-C61 target is referenced in board configurations but is not defined in the targets array. This inconsistency may cause issues when validating target-board relationships.

Run the following script to verify target consistency:


🏁 Script executed:

#!/bin/bash
# Description: Check for target consistency between targets array and board configurations

# Extract targets from JSON and check if all board targets are defined
cat tests/com.espressif.idf.core.test/resources/esp-config.json | jq -r '.targets[].id' | sort > /tmp/defined_targets.txt
cat tests/com.espressif.idf.core.test/resources/esp-config.json | jq -r '.boards[].target' | sort | uniq > /tmp/board_targets.txt

echo "Targets referenced in boards but not defined:"
comm -23 /tmp/board_targets.txt /tmp/defined_targets.txt

echo "Defined targets:"
cat /tmp/defined_targets.txt

echo "Board targets:"
cat /tmp/board_targets.txt

Length of output: 749


Add missing ESP32-C61 target definition

The JSON lists a board with "target": "esp32c61" but the targets array (lines 3–12 in tests/com.espressif.idf.core.test/resources/esp-config.json) has no entry for esp32c61. This mismatch will break target-board validation.

Please update the targets array to include an entry for ESP32-C61. For example:

     { "id": "esp32c6", "name": "ESP32-C6", "idcode": "0x0000dc25" },
+    { "id": "esp32c61", "name": "ESP32-C61", "idcode": "<correct_idcode>", "ocdid": "<correct_ocdid>" },
     { "id": "esp32h2", "name": "ESP32-H2", "idcode": "0x00010c25" },

– Replace <correct_idcode> and <correct_ocdid> with the values from the ESP-IDF documentation.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In tests/com.espressif.idf.core.test/resources/esp-config.json around lines 3 to
12, the targets array is missing an entry for the esp32c61 target, which is
referenced elsewhere and causes validation failures. Add a new object for
esp32c61 with the correct id, name, idcode, and ocdid values as per ESP-IDF
documentation to the targets array to fix the mismatch.

Comment on lines +251 to +273
"name": "ESP32-C61 chip (via builtin USB-JTAG)",
"description": "ESP32-C61 debugging via builtin USB-JTAG",
"target": "esp32c61",
"config_files": [
"board/esp32c61-builtin.cfg"
]
},
{
"name": "ESP32-C61 chip (via ESP-PROG)",
"description": "ESP32-C61 debugging via ESP-PROG board",
"target": "esp32c61",
"config_files": [
"board/esp32c61-ftdi.cfg"
]
},
{
"name": "ESP32-C61 chip (via ESP-PROG-2)",
"description": "ESP32-C61 debugging via ESP-PROG-2 board",
"target": "esp32c61",
"config_files": [
"board/esp32c61-bridge.cfg"
]
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing interface field in ESP32-C61 board configurations.

The ESP32-C61 board configurations (lines 251-273) are missing the interface field, while other board configurations include this field. This inconsistency may cause issues when the parser expects interface information.

Apply this diff to add the missing interface fields:

        {
            "name": "ESP32-C61 chip (via builtin USB-JTAG)",
            "description": "ESP32-C61 debugging via builtin USB-JTAG",
            "target": "esp32c61",
+           "interface": "esp_usb_jtag",
            "config_files": [
                "board/esp32c61-builtin.cfg"
            ]
        },
        {
            "name": "ESP32-C61 chip (via ESP-PROG)",
            "description": "ESP32-C61 debugging via ESP-PROG board",
            "target": "esp32c61",
+           "interface": "ftdi",
            "config_files": [
                "board/esp32c61-ftdi.cfg"
            ]
        },
        {
            "name": "ESP32-C61 chip (via ESP-PROG-2)",
            "description": "ESP32-C61 debugging via ESP-PROG-2 board",
            "target": "esp32c61",
+           "interface": "esp_usb_bridge",
            "config_files": [
                "board/esp32c61-bridge.cfg"
            ]
        }
📝 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
"name": "ESP32-C61 chip (via builtin USB-JTAG)",
"description": "ESP32-C61 debugging via builtin USB-JTAG",
"target": "esp32c61",
"config_files": [
"board/esp32c61-builtin.cfg"
]
},
{
"name": "ESP32-C61 chip (via ESP-PROG)",
"description": "ESP32-C61 debugging via ESP-PROG board",
"target": "esp32c61",
"config_files": [
"board/esp32c61-ftdi.cfg"
]
},
{
"name": "ESP32-C61 chip (via ESP-PROG-2)",
"description": "ESP32-C61 debugging via ESP-PROG-2 board",
"target": "esp32c61",
"config_files": [
"board/esp32c61-bridge.cfg"
]
},
{
"name": "ESP32-C61 chip (via builtin USB-JTAG)",
"description": "ESP32-C61 debugging via builtin USB-JTAG",
"target": "esp32c61",
"interface": "esp_usb_jtag",
"config_files": [
"board/esp32c61-builtin.cfg"
]
},
{
"name": "ESP32-C61 chip (via ESP-PROG)",
"description": "ESP32-C61 debugging via ESP-PROG board",
"target": "esp32c61",
"interface": "ftdi",
"config_files": [
"board/esp32c61-ftdi.cfg"
]
},
{
"name": "ESP32-C61 chip (via ESP-PROG-2)",
"description": "ESP32-C61 debugging via ESP-PROG-2 board",
"target": "esp32c61",
"interface": "esp_usb_bridge",
"config_files": [
"board/esp32c61-bridge.cfg"
]
}
🤖 Prompt for AI Agents
In tests/com.espressif.idf.core.test/resources/esp-config.json around lines 251
to 273, the ESP32-C61 board configurations lack the required "interface" field
present in other board entries. Add the appropriate "interface" field to each
ESP32-C61 configuration object to maintain consistency and ensure the parser can
correctly process these entries.

@AndriiFilippov

Copy link
Copy Markdown
Collaborator

@sigmaaa hi !
Tested under:
OS - Windows 11 / Mac arm64
ESP-IDF: v5.4.2

no exceptions like java.io.FileNotFoundException: \esp-config.json (The system cannot find the file specified)
since there is refactoring of esp-config parser -> also verified targets, boards, configs, voltage in Launch Targets / Debug Configs ✅

LGTM 👍

@AndriiFilippov

Copy link
Copy Markdown
Collaborator

@kolipakakondal @alirana01 hi !
Please, review

@alirana01 alirana01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just a few changes required I guess

@sigmaaa

sigmaaa commented Jul 23, 2025

Copy link
Copy Markdown
Collaborator Author

Hi @alirana01,

Thanks for the review. I've addressed the comments in the commit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/EspConfigParser.java (1)

79-94: Consider extracting magic string to constant.

The implementation is solid, but the hardcoded "ESP_FLASH_VOLTAGE" string could be extracted to a named constant for better maintainability.

+private static final String ESP_FLASH_VOLTAGE_OPTION = "ESP_FLASH_VOLTAGE";

-if ("ESP_FLASH_VOLTAGE".equals(option.name()) && option.values() != null)
+if (ESP_FLASH_VOLTAGE_OPTION.equals(option.name()) && option.values() != null)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87f4f5d and 1aedce0.

📒 Files selected for processing (14)
  • bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/DefaultBoardProvider.java (2 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/EspConfigParser.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/Board.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/EspConfig.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/Option.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/Target.java (1 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java (0 hunks)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/variable/JtagVariableResolver.java (3 hunks)
  • bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/util/ESPFlashUtil.java (1 hunks)
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java (6 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/templates/NewProjectCreationWizardPage.java (1 hunks)
  • tests/com.espressif.idf.core.test/resources/esp-config.json (1 hunks)
  • tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java (1 hunks)
💤 Files with no reviewable changes (1)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/EspConfigParser.java
✅ Files skipped from review due to trivial changes (6)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/Board.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/Target.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/Option.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/vo/EspConfig.java
  • bundles/com.espressif.idf.core/META-INF/MANIFEST.MF
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/com.espressif.idf.core.test/resources/esp-config.json
  • tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/EspConfigParserTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_macos
🔇 Additional comments (13)
bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/util/ESPFlashUtil.java (1)

30-30: LGTM! Import updated correctly.

The import statement has been properly updated to reflect the new package location of EspConfigParser.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/templates/NewProjectCreationWizardPage.java (1)

35-35: LGTM! Import updated correctly.

The import statement has been properly updated to reflect the new package location of EspConfigParser.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/variable/JtagVariableResolver.java (3)

8-8: LGTM! Import added for new API.

Added List import to support the new typed API that returns List<Board> instead of raw maps.


20-21: LGTM! Imports updated for new parser location.

Imports correctly updated to reflect the new package structure and typed Board objects.


78-90: Excellent refactoring to use typed objects!

The change from map-based board configuration access to typed Board objects significantly improves type safety and code readability. The stream-based filtering approach is clean and efficient.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/DefaultBoardProvider.java (3)

7-7: LGTM! Import added for new API.

Added List import to support the new typed API.


12-13: LGTM! Imports updated correctly.

Imports properly updated to use the new EspConfigParser and Board record from the restructured packages.


59-61: Excellent type-safe refactoring!

The change from map-based board access to typed Board objects improves code clarity and type safety while maintaining the same external API contract.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/configparser/EspConfigParser.java (5)

30-41: Excellent constructor design with performance optimization!

The two-constructor approach provides flexibility while the single config load during initialization optimizes performance by avoiding repeated file parsing.


43-61: Robust error handling and resource management!

Proper use of try-with-resources ensures file handles are closed, and the null return on errors allows graceful degradation in calling methods.


63-77: Good defensive programming with ordered results!

Using LinkedHashSet maintains target ordering while the null checks ensure safe operation even when configuration is missing.


96-110: Excellent type-safe filtering logic!

The method provides clean, type-safe access to board configurations with proper validation of required fields.


112-115: Simple and effective file existence check!

Clean implementation that serves the same purpose as the original API while being more straightforward.

@AndriiFilippov

Copy link
Copy Markdown
Collaborator

LGTM 👍

@alirana01 alirana01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@alirana01 alirana01 merged commit 660afae into master Jul 24, 2025
2 of 5 checks passed
@alirana01 alirana01 deleted the IEP-1600 branch July 24, 2025 12:10
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