-
Notifications
You must be signed in to change notification settings - Fork 133
Dynamic ESP-IDF Target Discovery and Support Preview Targets #1302
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
Changes from 5 commits
5c8de8f
c54f0bf
7023f7d
ffa3fad
014477a
f3b7996
4510d2f
6952d2a
db964d1
51c14c6
feef302
3cb1caa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,143 @@ | ||||||||||||||||||||||||||||||||
| /******************************************************************************* | ||||||||||||||||||||||||||||||||
| * Copyright 2025 Espressif Systems (Shanghai) PTE LTD. All rights reserved. | ||||||||||||||||||||||||||||||||
| * Use is subject to license terms. | ||||||||||||||||||||||||||||||||
| *******************************************************************************/ | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| package com.espressif.idf.core.toolchain; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| import java.util.ArrayList; | ||||||||||||||||||||||||||||||||
| import java.util.List; | ||||||||||||||||||||||||||||||||
| import java.util.stream.Collectors; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| import com.espressif.idf.core.toolchain.enums.Target; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||
| * Class to hold ESP-IDF target information including preview status | ||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||
| * @author Kondal Kolipaka <[email protected]>, Ali Azam Rana <[email protected]> | ||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
| public class IDFTargets | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| private List<IDFTarget> supportedTargets; | ||||||||||||||||||||||||||||||||
| private List<IDFTarget> previewTargets; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| public IDFTargets() | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| this.supportedTargets = new ArrayList<>(); | ||||||||||||||||||||||||||||||||
| this.previewTargets = new ArrayList<>(); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| public void addSupportedTarget(String targetName) | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| Target t = Target.fromString(targetName); | ||||||||||||||||||||||||||||||||
| if (t != null) | ||||||||||||||||||||||||||||||||
| supportedTargets.add(new IDFTarget(t, false)); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| public void addSupportedTarget(String targetName) | |
| { | |
| Target t = Target.fromString(targetName); | |
| if (t != null) | |
| supportedTargets.add(new IDFTarget(t, false)); | |
| } | |
| public void addSupportedTarget(String targetName) | |
| { | |
| Target t = Target.fromString(targetName); | |
| if (t != null) { | |
| supportedTargets.add(new IDFTarget(t, false)); | |
| } else { | |
| supportedTargets.add(IDFTarget.dynamic(targetName, false)); | |
| } | |
| } |
🤖 Prompt for AI Agents
In
bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/IDFTargets.java
around lines 31 to 36, Target.fromString(targetName) returns null for
unknown/new targets so they are skipped; change the logic to fall back to
creating a dynamic target when t is null by constructing an IDFTarget that uses
the raw targetName and marks it as dynamic/unknown (instead of skipping), e.g.
when t != null keep existing new IDFTarget(t, false) else create a dynamic
IDFTarget using the name and a true dynamic flag so new targets (like esp32c5)
are preserved for “future-proof” discovery.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue for preview targets
Preview targets not present in the enum are silently ignored.
public void addPreviewTarget(String targetName)
{
Target t = Target.fromString(targetName);
- if (t != null)
- previewTargets.add(new IDFTarget(t, true));
+ if (t != null) {
+ previewTargets.add(new IDFTarget(t, true));
+ } else {
+ previewTargets.add(IDFTarget.dynamic(targetName, true));
+ }
}📝 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.
| public void addPreviewTarget(String targetName) | |
| { | |
| Target t = Target.fromString(targetName); | |
| if (t != null) | |
| previewTargets.add(new IDFTarget(t, true)); | |
| } | |
| public void addPreviewTarget(String targetName) | |
| { | |
| Target t = Target.fromString(targetName); | |
| if (t != null) { | |
| previewTargets.add(new IDFTarget(t, true)); | |
| } else { | |
| previewTargets.add(IDFTarget.dynamic(targetName, true)); | |
| } | |
| } |
🤖 Prompt for AI Agents
In
bundles/com.espressif.idf.core/src/com/espressif/idf/core/toolchain/IDFTargets.java
around lines 38 to 43, the method addPreviewTarget currently ignores unknown
target names because Target.fromString returning null is silently skipped;
change this to the same behavior as the non-preview addTarget path by validating
the result of Target.fromString and throwing an IllegalArgumentException (or
otherwise reporting an error) if the targetName is not found so unknown preview
targets are not silently ignored.
Uh oh!
There was an error while loading. Please reload this page.