Skip to content

IEP-1755 Build folder path fails to save on first apply in Launch Configuration#1447

Merged
kolipakakondal merged 1 commit intomasterfrom
IEP-1755
Apr 28, 2026
Merged

IEP-1755 Build folder path fails to save on first apply in Launch Configuration#1447
kolipakakondal merged 1 commit intomasterfrom
IEP-1755

Conversation

@sigmaaa
Copy link
Copy Markdown
Collaborator

@sigmaaa sigmaaa commented Apr 23, 2026

Description

Moved IDFUtil.updateProjectBuildFolder() from the UI apply phase to the launchConfigurationChanged listener in IDFCoreLaunchConfigProvider. Previously, reading from an unsaved WorkingCopy resulted in saving the old build folder property. Deferring this to the listener ensures the configuration is completely saved to disk before we attempt to update the project properties.

Fixes # (IEP-1755)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  1. Edit the launch configuration -> set new custom build folder -> save the changes -> click build -> make sure the build folder is updated immediately.

  2. Create new configuration and set custom build folder -> click build -> make sure the build folder is updated immediately

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

  • Bug Fixes
    • Project build folder now updates when launch configurations change, ensuring consistency with current settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

📝 Walkthrough

Walkthrough

The PR relocates the project build folder update logic from the SerialFlashLaunchConfigTabGroup.performApply() method to the IDFCoreLaunchConfigProvider.launchConfigurationChanged() method, consolidating related functionality and removing now-redundant UI-layer code.

Changes

Cohort / File(s) Summary
Core Launch Config Provider
bundles/com.espressif.idf.launch.serial.core/.../IDFCoreLaunchConfigProvider.java
Implements project build folder update in launchConfigurationChanged() by invoking IDFUtil.updateProjectBuildFolder() with the launch configuration's working copy.
Serial Flash Launch Config UI
bundles/com.espressif.idf.launch.serial.ui/.../SerialFlashLaunchConfigTabGroup.java
Removes performApply() override that previously updated the project build folder; removes now-unused imports (ILaunchConfigurationWorkingCopy, IDFUtil).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • kolipakakondal
  • AndriiFilippov
  • alirana01

Poem

🐰 Build folders shuffle and shift,
From UI layer to core they drift,
One method now handles the quest,
Consolidation, oh so blessed!
Cleanup hops forward with delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly describes the main change: fixing a bug where build folder path fails to save on first apply in Launch Configuration, which matches the core issue addressed by moving updateProjectBuildFolder() from UI apply phase to the launchConfigurationChanged listener.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch IEP-1755

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java`:
- Around line 78-84: The method launchConfigurationChanged currently calls
IDFUtil.updateProjectBuildFolder unconditionally; add the same ownership guard
used in launchConfigurationAdded by early-returning when
CoreBuildLaunchConfigDelegate.getProject(configuration) is null so you only call
IDFUtil.updateProjectBuildFolder for configurations this provider owns, avoiding
unnecessary working-copy allocation and attribute lookups for foreign
configuration types.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a12b01bb-f923-4b16-9be3-cd23d25bfde8

📥 Commits

Reviewing files that changed from the base of the PR and between 6a67e13 and 05b2eb8.

📒 Files selected for processing (2)
  • bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java
💤 Files with no reviewable changes (1)
  • bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java

Comment on lines 78 to 84
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
{
// nothing to do
IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());

return false;
}
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 | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm listener fires for all configs and inspect ownsLaunchConfiguration semantics.
fd -e java ownsLaunchConfiguration -x rg -nP -C3 'ownsLaunchConfiguration' {}
rg -nP -C3 'launchConfigurationChanged' --type=java
rg -nP -C5 'getProject\s*\(\s*ILaunchConfiguration' --type=java

Repository: espressif/idf-eclipse-plugin

Length of output: 1112


🏁 Script executed:

# Get the full file to see method implementations
wc -l bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java

Repository: espressif/idf-eclipse-plugin

Length of output: 194


🏁 Script executed:

# Read the full file with line numbers
cat -n bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java

Repository: espressif/idf-eclipse-plugin

Length of output: 4398


🏁 Script executed:

# Find ownsLaunchConfiguration method definition
rg -nP 'ownsLaunchConfiguration' bundles/com.espressif.idf.launch.serial.core/src/ --type=java -B2 -A8

Repository: espressif/idf-eclipse-plugin

Length of output: 1670


🏁 Script executed:

# Find updateProjectBuildFolder implementation
rg -nP 'void updateProjectBuildFolder|updateProjectBuildFolder' bundles/com.espressif.idf.launch.serial.core/src/ --type=java -B2 -A10

Repository: espressif/idf-eclipse-plugin

Length of output: 2038


🏁 Script executed:

# Search for updateProjectBuildFolder across all bundles to find implementation
rg -nP 'updateProjectBuildFolder' --type=java -B2 -A12

Repository: espressif/idf-eclipse-plugin

Length of output: 10051


Add ownership check to gate unnecessary processing of foreign configuration types.

launchConfigurationChanged fires for every launch configuration change in the workspace. While the framework will call this method for all configuration types, this provider should only process configurations it owns—mirroring the pattern used in launchConfigurationAdded (line 75).

Although IDFUtil.updateProjectBuildFolder internally returns early if CoreBuildLaunchConfigDelegate.getProject(configuration) returns null (protecting against true "clobbering"), unconditional processing still wastes resources: each call allocates a working copy and performs attribute lookups even for unrelated configuration types.

Recommend early-returning for unowned configurations:

Proposed change
 	`@Override`
 	public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
 	{
+		if (!ownsLaunchConfiguration(configuration))
+		{
+			return false;
+		}
 		IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());
-
 		return false;
 	}
📝 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
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
{
// nothing to do
IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());
return false;
}
`@Override`
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
{
if (!ownsLaunchConfiguration(configuration))
{
return false;
}
IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());
return false;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java`
around lines 78 - 84, The method launchConfigurationChanged currently calls
IDFUtil.updateProjectBuildFolder unconditionally; add the same ownership guard
used in launchConfigurationAdded by early-returning when
CoreBuildLaunchConfigDelegate.getProject(configuration) is null so you only call
IDFUtil.updateProjectBuildFolder for configurations this provider owns, avoiding
unnecessary working-copy allocation and attribute lookups for foreign
configuration types.

Copy link
Copy Markdown
Collaborator

@AndriiFilippov AndriiFilippov left a comment

Choose a reason for hiding this comment

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

@sigmaaa hi !
Tested on:
Linux Ubuntu / Windows 11

the Launch Config does save changes to 'custom build folder' after first launch ✔️
LGTM 👍

Copy link
Copy Markdown
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

@kolipakakondal kolipakakondal merged commit 6e2de1e into master Apr 28, 2026
3 of 10 checks passed
@kolipakakondal kolipakakondal deleted the IEP-1755 branch April 28, 2026 06:23
@kolipakakondal kolipakakondal added this to the v4.3.0 milestone Apr 28, 2026
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