Skip to content

[WIP] Release/v4.0.0 This is just to have the release 4.0 builds for testing (Please dont merge it yet #1217

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,31 @@ name: Java CI with Maven

on:
push:
branches: [ master ]
branches:
- master
- release/**
pull_request:
branches: [ master ]
branches:
- master
- release/**
Comment on lines +8 to +14
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix YAML indentation under triggers
The list items for push.branches and pull_request.branches are mis-indented (5 spaces instead of 6). Correcting this will prevent YAML parsing issues.

   on:
     push:
-    branches:
-     - master
-     - release/**
+    branches:
+      - master
+      - release/**
     pull_request:
-    branches:
-     - master
-     - release/**
+    branches:
+      - master
+      - release/**
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 9-9: wrong indentation: expected 6 but found 5

(indentation)


[warning] 13-13: wrong indentation: expected 6 but found 5

(indentation)


jobs:
build:
build_linux:

runs-on:
- self-hosted
- eclipse
- BrnoUBU0004
runs-on: [self-hosted, eclipse, BrnoUBU0004]

steps:
- uses: actions/checkout@v2

- name: Clone IDF Release From Github
uses: actions/checkout@v2
with:
repository: espressif/esp-idf
path: dependencies/idf-tools
submodules: 'true'
ref: release/v5.1
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.10'
Comment on lines 24 to +27
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update Python setup action to latest version
The workflow uses actions/setup-python@v2, which is outdated. Align with other workflows and benefit from bug fixes by upgrading to:

-    uses: actions/setup-python@v2
+    uses: actions/setup-python@v4
📝 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: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.10'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
🧰 Tools
🪛 actionlint (1.7.4)

25-25: the runner of "actions/setup-python@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


- name: Install ESP-IDF via eim
uses: espressif/install-esp-idf-action@v1
with:
version: 'v5.3'

Comment on lines +29 to 33
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove tab characters to fix YAML syntax error
Line 29 contains tab characters, which YAML does not allow. Replace tabs with spaces:

-      uses: espressif/install-esp-idf-action@v1		# contains tabs
+      uses: espressif/install-esp-idf-action@v1    # tabs → spaces
📝 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: Install ESP-IDF via eim
uses: espressif/install-esp-idf-action@v1
with:
version: 'v5.3'
- name: Install ESP-IDF via eim
uses: espressif/install-esp-idf-action@v1
with:
version: 'v5.3'
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 29-29: syntax error: found character '\t' that cannot start any token

(syntax)

- name: Set up Maven
uses: stCarolas/setup-maven@v5
Expand All @@ -42,8 +40,9 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: export NO_AT_BRIDGE=1 && mvn clean verify -Djarsigner.skip=true -DskipTests=false -DtestWorkspace=/opt/actions-runner/_work/workspace

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ name: Java CI with Maven on Windows

on:
push:
branches: [ master ]
branches:
- master
- release/**
pull_request:
branches: [ master ]
branches:
- master
- release/**
Comment on lines +8 to +14
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix YAML indentation under triggers
Indentation of list items under both push.branches and pull_request.branches is off by one space (5 vs. 6), which can lead to malformed YAML or unexpected behavior.

Proposed patch:

   on:
     push:
-    branches:
-     - master
-     - release/**
+    branches:
+      - master
+      - release/**
     pull_request:
-    branches:
-     - master
-     - release/**
+    branches:
+      - master
+      - release/**
📝 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
branches:
- master
- release/**
pull_request:
branches: [ master ]
branches:
- master
- release/**
on:
push:
branches:
- master
- release/**
pull_request:
branches:
- master
- release/**
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 9-9: wrong indentation: expected 6 but found 5

(indentation)


[warning] 13-13: wrong indentation: expected 6 but found 5

(indentation)


jobs:
build_windows:
Expand Down
1 change: 1 addition & 0 deletions bundles/com.espressif.idf.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Export-Package: com.espressif.idf.core,
com.espressif.idf.core.tools,
com.espressif.idf.core.tools.util,
com.espressif.idf.core.tools.vo,
com.espressif.idf.core.tools.watcher,
com.espressif.idf.core.util,
com.espressif.idf.core.variable,
org.json.simple,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;

import com.espressif.idf.core.util.IDFUtil;

/**
* @author Kondal Kolipaka
*
Expand All @@ -32,16 +29,6 @@ public class IDFCorePreferenceConstants
public static final boolean CMAKE_CCACHE_DEFAULT_STATUS = true;
public static final boolean AUTOMATE_BUILD_HINTS_DEFAULT_STATUS = true;
public static final boolean HIDE_ERRORS_IDF_COMPONENTS_DEFAULT_STATUS = true;
public static final String IDF_GITHUB_ASSETS = "IDF_GITHUB_ASSETS"; //$NON-NLS-1$
public static final String IDF_GITHUB_ASSETS_DEFAULT_GLOBAL = "dl.espressif.com/github_assets"; //$NON-NLS-1$
public static final String IDF_GITHUB_ASSETS_DEFAULT_CHINA = "dl.espressif.cn/github_assets"; //$NON-NLS-1$
public static final String PIP_EXTRA_INDEX_URL = "PIP_EXTRA_INDEX_URL"; //$NON-NLS-1$
public static final String PIP_EXTRA_INDEX_URL_DEFAULT_GLOBAL = "https://dl.espressif.com/pypi"; //$NON-NLS-1$
public static final String PIP_EXTRA_INDEX_URL_DEFAULT_CHINA = "https://dl.espressif.cn/pypi"; //$NON-NLS-1$
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)
? IDFUtil.resolveEnvVariable("%USERPROFILE%\\.espressif") //$NON-NLS-1$
: IDFUtil.resolveEnvVariable("$HOME/.espressif"); //$NON-NLS-1$

/**
* Returns the node in the preference in the given context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;

import com.espressif.idf.core.logging.Logger;
import com.espressif.idf.core.util.IDFUtil;
import com.espressif.idf.core.util.StringUtil;

/**
Expand Down Expand Up @@ -52,6 +51,8 @@ public class IDFEnvironmentVariables

public static final String IDF_CCACHE_ENABLE = "IDF_CCACHE_ENABLE"; //$NON-NLS-1$

public static final String ESP_IDF_EIM_ID = "ESP_IDF_EIM_ID"; //$NON-NLS-1$

/**
* @param variableName Environment variable Name
* @return IEnvironmentVariable
Expand Down Expand Up @@ -129,16 +130,12 @@ public Map<String, String> getSystemEnvMap()
IEnvironmentVariableManager buildEnvironmentManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
IEnvironmentVariable[] variables = buildEnvironmentManager.getVariables((ICConfigurationDescription) null,
true);
Map<String, String> envMap = IDFUtil.getSystemEnv();
Map<String, String> envMap = new HashMap<String, String>(System.getenv());
if (variables != null)
{
for (IEnvironmentVariable iEnvironmentVariable : variables)
{
String key = iEnvironmentVariable.getName();
if (key.equals(IDFCorePreferenceConstants.IDF_TOOLS_PATH))
{
continue;
}
String value = iEnvironmentVariable.getValue();
envMap.put(key, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,6 @@ private void runCmakeBuildCommand(IConsole console, IProgressMonitor monitor, IP
}
}

envVars.add(new EnvironmentVariable(IDFCorePreferenceConstants.IDF_TOOLS_PATH,
IDFUtil.getIDFToolsPathFromPreferences()));

String buildCommand = getProperty(BUILD_COMMAND);
if (buildCommand.isBlank())
{
Expand Down Expand Up @@ -479,10 +476,8 @@ private void runCmakeCommand(IConsole console, IProgressMonitor monitor, IProjec
// Set PYTHONUNBUFFERED to 1/TRUE to dump the messages back immediately without
// buffering
IEnvironmentVariable bufferEnvVar = new EnvironmentVariable("PYTHONUNBUFFERED", "1"); //$NON-NLS-1$ //$NON-NLS-2$
IEnvironmentVariable idfToolsPathEnvVar = new EnvironmentVariable(IDFCorePreferenceConstants.IDF_TOOLS_PATH,
IDFUtil.getIDFToolsPathFromPreferences());

Process p = startBuildProcess(command, new IEnvironmentVariable[] { bufferEnvVar, idfToolsPathEnvVar },
Process p = startBuildProcess(command, new IEnvironmentVariable[] { bufferEnvVar },
workingDir, errConsole, monitor);
if (p == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,23 @@ public class Messages extends NLS
public static String ToolsInitializationDifferentPathMessageBoxOptionYes;
public static String ToolsInitializationDifferentPathMessageBoxOptionNo;
public static String IDFToolChainsMissingErrorMsg;

public static String ToolsInitializationEimMissingMsgBoxTitle;
public static String ToolsInitializationEimMissingMsgBoxMessage;

public static String RefreshingProjects_JobName;

public static String NoActiveEspIdfInWorkspaceMsgTitle;
public static String NoActiveEspIdfInWorkspaceMsg;

public static String OldConfigFoundMsgBoxTitle;
public static String OldConfigFoundMsgBoxMsg;
public static String OldConfigExportDirectorSelectionDialogTitle;
public static String OldConfigExportDirectorSelectionDialogInfo;
public static String OldConfigExportCompleteSuccessMsgTitle;
public static String OldConfigExportCompleteSuccessMsg;
public static String OldConfigExportCompleteFailMsgTitle;
public static String OldConfigExportCompleteFailMsg;

static
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@ IDFBuildConfiguration_ParseCommand=Parse Compile Commands File
IncreasePartitionSizeTitle=Low Application Partition Size
IncreasePartitionSizeMessage=Less than 30% of application partition size is free({0} of {1} bytes), would you like to increase it? Please click <a href={2}>here</a> to check more details.
ToolsInitializationDifferentPathMessageBoxTitle=Different IDF path found in the config file
ToolsInitializationEimMissingMsgBoxTitle=ESP-IDF Not Found
ToolsInitializationEimMissingMsgBoxMessage=ESP-IDF is not found on your system. To use the IDE, install ESP-IDF using <a href="{0}">EIM - GUI Installer</a>. \n\nOnce installed, the IDE will automatically detect ESP-IDF. You can verify and activate it from the ESP-IDF Manager, accessible via the menu: Espressif > ESP-IDF Manager.\n\n
ToolsInitializationDifferentPathMessageBoxMessage=A different ESP-IDF path was found in the esp_idf.json.json configuration file. Do you want to install the tools in the new path or the old path? Please click on the appropriate button.\nNew Path: {0}\nOld Path: {1}
ToolsInitializationDifferentPathMessageBoxOptionYes=Use New Path
ToolsInitializationDifferentPathMessageBoxOptionNo=Use Old Path
RefreshingProjects_JobName=Refreshing Projects...
IDFBuildConfiguration_PreCheck_DifferentIdfPath=The project was built using the ESP-IDF located at the {0} path.\nThe currently active ESP-IDF path in the IDE is {1}.\nPlease clean the project using "ESP-IDF:Project Full Clean" menu option to use the active ESP-IDF configuration.
IDFToolChainsMissingErrorMsg=Toolchains are missing. Please use ESP-IDF Manager for configuring
IDFToolChainsMissingErrorMsg=Toolchains are missing. Please use ESP-IDF Manager for configuring

NoActiveEspIdfInWorkspaceMsgTitle=ESP-IDF Setup
NoActiveEspIdfInWorkspaceMsg=ESP-IDF is required to use Espressif IDE. Would you like to configure it now?

OldConfigFoundMsgBoxTitle=Old Configuration Found
OldConfigFoundMsgBoxMsg=An old ESP-IDF configuration has been detected.\nIf you want to use these you need to export these configuration and pass them on to EIM for updated configurations.\nWould you like to export these settings?\n\nPress 'Yes' to choose a location to save.
OldConfigExportDirectorSelectionDialogTitle=Select Destination
OldConfigExportDirectorSelectionDialogInfo=Choose a directory to save the exported settings.
OldConfigExportCompleteSuccessMsgTitle=Export Successful
OldConfigExportCompleteSuccessMsg=The configuration has been successfully copied to:\n{0}
OldConfigExportCompleteFailMsgTitle=Export Failed
OldConfigExportCompleteFailMsg=An error occurred while copying the configuration.\n{0}
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public File findToolChain(List<String> paths, String filePattern)

private Path[] getDirectories(String path)
{
return Arrays.stream(path.split(File.pathSeparator)).map(String::trim).map(Paths::get).filter(Files::exists)
return Arrays.stream(path.split(File.pathSeparator)).map(String::trim).map(Paths::get).filter(Files::exists).filter(Files::isDirectory)
.toArray(Path[]::new);
}

Expand Down Expand Up @@ -316,7 +316,7 @@ protected String getIdfToolsExportPath()
Logger.log(commands.toString());

IStatus idfToolsExportStatus = new ProcessBuilderFactory().runInBackground(commands,
org.eclipse.core.runtime.Path.ROOT, IDFUtil.getSystemEnv());
org.eclipse.core.runtime.Path.ROOT, System.getenv());
if (idfToolsExportStatus != null && idfToolsExportStatus.isOK())
{
String message = idfToolsExportStatus.getMessage();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.espressif.idf.core.tools;

public interface EimConstants
{
String EIM_JSON = "eim_idf.json"; //$NON-NLS-1$

String EIM_POSIX_DIR = System.getProperty("user.home").concat("/.espressif/tools/"); //$NON-NLS-1$//$NON-NLS-2$

String EIM_WIN_DIR = "C:\\Espressif\\tools\\"; //$NON-NLS-1$
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid hardcoding installation paths

The Windows installation directory is hardcoded, which may not respect user customizations or non-standard installation locations. Consider using environment variables or configuration settings to allow for customization.


String EIM_WIN_PATH = EIM_WIN_DIR + EIM_JSON;

String EIM_URL = "https://dl.espressif.com/dl/eim/"; //$NON-NLS-1$

String EIM_POSIX_PATH = EIM_POSIX_DIR + EIM_JSON;

String INSTALL_TOOLS_FLAG = "INSTALL_TOOLS_FLAG"; //$NON-NLS-1$

String TOOL_SET_CONFIG_LEGACY_CONFIG_FILE = "tool_set_config.json"; //$NON-NLS-1$

String OLD_CONFIG_EXPORTED_FLAG = "OLD_CONFIG_EXPORTED_FLAG"; //$NON-NLS-1$
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.espressif.idf.core.tools;

import java.io.FileReader;
import java.io.IOException;

import org.eclipse.core.runtime.Platform;

import com.espressif.idf.core.tools.vo.EimJson;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class EimIdfConfiguratinParser
{
private EimJson eimJson;
private Gson gson;

public EimIdfConfiguratinParser()
{
gson = new GsonBuilder().setPrettyPrinting().enableComplexMapKeySerialization()
.excludeFieldsWithoutExposeAnnotation().create();
}

private void load() throws IOException
{
try (FileReader fileReader = new FileReader(
Platform.getOS().equals(Platform.OS_WIN32) ? EimConstants.EIM_WIN_PATH : EimConstants.EIM_POSIX_PATH))
{
eimJson = gson.fromJson(fileReader, EimJson.class);
}
}
Comment on lines +23 to +30
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add file existence check before attempting to read

The load() method doesn't check if the file exists before attempting to read it. This could lead to unclear error messages when the file is not found.

private void load() throws IOException
{
+	File file = new File(Platform.getOS().equals(Platform.OS_WIN32) ? EimConstants.EIM_WIN_PATH : EimConstants.EIM_POSIX_PATH);
+	if (!file.exists()) {
+		throw new FileNotFoundException("EIM JSON configuration file not found: " + file.getAbsolutePath());
+	}
	try (FileReader fileReader = new FileReader(
-			Platform.getOS().equals(Platform.OS_WIN32) ? EimConstants.EIM_WIN_PATH : EimConstants.EIM_POSIX_PATH))
+			file))
	{
		eimJson = gson.fromJson(fileReader, EimJson.class);
	}
}
📝 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
private void load() throws IOException
{
try (FileReader fileReader = new FileReader(
Platform.getOS().equals(Platform.OS_WIN32) ? EimConstants.EIM_WIN_PATH : EimConstants.EIM_POSIX_PATH))
{
eimJson = gson.fromJson(fileReader, EimJson.class);
}
}
private void load() throws IOException
{
File file = new File(
Platform.getOS().equals(Platform.OS_WIN32)
? EimConstants.EIM_WIN_PATH
: EimConstants.EIM_POSIX_PATH);
if (!file.exists()) {
throw new FileNotFoundException(
"EIM JSON configuration file not found: " + file.getAbsolutePath());
}
try (FileReader fileReader = new FileReader(
file))
{
eimJson = gson.fromJson(fileReader, EimJson.class);
}
}



public EimJson getEimJson(boolean reload) throws IOException
{
if (reload)
{
load();
}

if (eimJson == null)
{
load();
}

return eimJson;
}
Comment on lines +32 to +46
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve method efficiency and thread safety

The getEimJson method could potentially perform duplicate loads if both reload is true and eimJson is null. Additionally, there are no synchronization mechanisms to ensure thread safety.

-public EimJson getEimJson(boolean reload) throws IOException
+public synchronized EimJson getEimJson(boolean reload) throws IOException
{
-	if (reload)
+	if (reload || eimJson == null)
	{
		load();
	}
-	
-	if (eimJson == null)
-	{
-		load();
-	}
	
	return eimJson;
}

}

This file was deleted.

This file was deleted.

Loading
Loading