From 0c001df2062eacbd77f560dfd07543d16b9cc1e3 Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:48:56 +0200 Subject: [PATCH 1/8] updated message and tools validation added --- .../src/com/espressif/idf/ui/install/IDFDownloadPage.java | 5 +++-- .../src/com/espressif/idf/ui/install/Messages.java | 2 +- .../src/com/espressif/idf/ui/install/messages.properties | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index a6bf8b5f4..fbff8e985 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -397,9 +397,10 @@ private void validate() } String idfPyPath = idfPath + File.separator + "tools" + File.separator + "idf.py"; //$NON-NLS-1$ //$NON-NLS-2$ - if (!new File (idfPyPath).exists()) + String idfToolsPyPth = idfPath + File.separator + "tools" + File.separator + "idf_tools.py"; //$NON-NLS-1$ //$NON-NLS-2$ + if (!new File (idfPyPath).exists() && !new File (idfToolsPyPth).exists()) { - setErrorMessage(MessageFormat.format(Messages.IDFDownloadPage_CantfindIDFpy, idfPath)); + setErrorMessage(MessageFormat.format(Messages.IDFDownloadPage_CantfindProperEspIDFDirectory, idfPath)); setPageComplete(false); return; } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java index a07a585b4..9778ced06 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java @@ -9,7 +9,7 @@ public class Messages extends NLS public static String IDFDownloadPage_0; public static String IDFDownloadPage_BrowseBtn; public static String IDFDownloadPage_BrowseBtnTxt; - public static String IDFDownloadPage_CantfindIDFpy; + public static String IDFDownloadPage_CantfindProperEspIDFDirectory; public static String IDFDownloadPage_CantFindRequirementsFile; public static String IDFDownloadPage_ChooseAnExistingIDF; public static String IDFDownloadPage_ChooseDirIDF; diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties index 5e07c8f83..b91f9a4d5 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties @@ -2,7 +2,7 @@ GitRepositoryBuilder_gitClone=git clone result: %s IDFDownloadPage_0=icons/espressif_logo.png IDFDownloadPage_BrowseBtn=Browse... IDFDownloadPage_BrowseBtnTxt=Browse... -IDFDownloadPage_CantfindIDFpy=Can not find idf.py in {0} tools +IDFDownloadPage_CantfindProperEspIDFDirectory=Can not find idf python scripts in {0} tools. Make sure to select valid ESP-IDF directory. IDFDownloadPage_ChooseAnExistingIDF=Use an existing ESP-IDF directory from file system IDFDownloadPage_ChooseDirIDF=Choose existing ESP-IDF directory: IDFDownloadPage_ChooseIDFDir=Choose a directory to download ESP-IDF to: From 15f9f18f7c0b247285a0121b32b152eb9e6b4c2d Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:52:35 +0200 Subject: [PATCH 2/8] review comments updated --- .../src/com/espressif/idf/ui/install/IDFDownloadPage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index fbff8e985..750e4c473 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -38,6 +38,7 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import com.espressif.idf.core.IDFConstants; import com.espressif.idf.core.IDFVersion; import com.espressif.idf.core.IDFVersionsReader; import com.espressif.idf.core.SystemExecutableFinder; @@ -396,8 +397,8 @@ private void validate() return; } - String idfPyPath = idfPath + File.separator + "tools" + File.separator + "idf.py"; //$NON-NLS-1$ //$NON-NLS-2$ - String idfToolsPyPth = idfPath + File.separator + "tools" + File.separator + "idf_tools.py"; //$NON-NLS-1$ //$NON-NLS-2$ + String idfPyPath = idfPath + File.separator + IDFConstants.TOOLS_FOLDER + File.separator + IDFConstants.IDF_PYTHON_SCRIPT; + String idfToolsPyPth = idfPath + File.separator + IDFConstants.TOOLS_FOLDER + File.separator + IDFConstants.IDF_TOOLS_SCRIPT; if (!new File (idfPyPath).exists() && !new File (idfToolsPyPth).exists()) { setErrorMessage(MessageFormat.format(Messages.IDFDownloadPage_CantfindProperEspIDFDirectory, idfPath)); From 7697ec47e4ec6e4cd53ebea0ee8953ee6c5a0e6c Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:59:27 +0200 Subject: [PATCH 3/8] review comment to improve check --- .../src/com/espressif/idf/ui/install/IDFDownloadPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index 750e4c473..b3058c7d9 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -399,7 +399,7 @@ private void validate() String idfPyPath = idfPath + File.separator + IDFConstants.TOOLS_FOLDER + File.separator + IDFConstants.IDF_PYTHON_SCRIPT; String idfToolsPyPth = idfPath + File.separator + IDFConstants.TOOLS_FOLDER + File.separator + IDFConstants.IDF_TOOLS_SCRIPT; - if (!new File (idfPyPath).exists() && !new File (idfToolsPyPth).exists()) + if (!new File (idfPyPath).exists() || !new File (idfToolsPyPth).exists()) { setErrorMessage(MessageFormat.format(Messages.IDFDownloadPage_CantfindProperEspIDFDirectory, idfPath)); setPageComplete(false); From 7dc27fda6615d15556ebb4a8943c50d6829c46cc Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:03:31 +0200 Subject: [PATCH 4/8] updated to handle the error message on wizard also changes to ensure full version displayed in the manager --- .../idf/ui/install/IDFDownloadPage.java | 134 ++++++++++++++---- .../espressif/idf/ui/install/Messages.java | 1 + .../idf/ui/install/messages.properties | 1 + .../com/espressif/idf/ui/tools/ToolsJob.java | 41 +++--- 4 files changed, 137 insertions(+), 40 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index b3058c7d9..4d8042f66 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -8,15 +8,19 @@ import java.net.MalformedURLException; import java.net.URL; import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -29,7 +33,6 @@ import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; @@ -39,9 +42,12 @@ import org.eclipse.ui.PlatformUI; import com.espressif.idf.core.IDFConstants; +import com.espressif.idf.core.IDFCorePlugin; import com.espressif.idf.core.IDFVersion; import com.espressif.idf.core.IDFVersionsReader; +import com.espressif.idf.core.ProcessBuilderFactory; import com.espressif.idf.core.SystemExecutableFinder; +import com.espressif.idf.core.logging.Logger; import com.espressif.idf.core.util.IDFUtil; import com.espressif.idf.core.util.StringUtil; import com.espressif.idf.ui.UIPlugin; @@ -391,10 +397,19 @@ private void validate() } if (idfPath.contains(" ")) //$NON-NLS-1$ { - setErrorMessage(Messages.IDFDownloadPage_IDFBuildNotSupported); - setPageComplete(false); - showMessage(); - return; + String version = getIdfVersionUsingGit(idfPath); + boolean validVersion = isVersionGreaterOrEqual(version, "5.0.0"); //$NON-NLS-1$ + if (!validVersion) + { + setErrorMessage(Messages.IDFDownloadPage_VersionSpaceError); + setPageComplete(false); + return; + } + if (getErrorMessage() == null || getErrorMessage().equals(Messages.IDFDownloadPage_VersionSpaceError)) + { + setErrorMessage(null); + setPageComplete(true); + } } String idfPyPath = idfPath + File.separator + IDFConstants.TOOLS_FOLDER + File.separator + IDFConstants.IDF_PYTHON_SCRIPT; @@ -457,6 +472,95 @@ private void validate() } } + private String getIdfVersionUsingGit(String idfPath) + { + if (!validateGitAndPython()) + return StringUtil.EMPTY; + + List commands = new ArrayList(); + commands.add(gitExecutablePath); + commands.add("describe"); //$NON-NLS-1$ + + ProcessBuilderFactory processRunner = new ProcessBuilderFactory(); + try + { + Logger.log("Executing commads: " + commands.toString()); + Map environment = new HashMap<>(System.getenv()); + IStatus status = processRunner.runInBackground(commands, Path.fromOSString(idfPath), environment); + if (status == null) + { + Logger.log(IDFCorePlugin.getPlugin(), + IDFCorePlugin.errorStatus("Unable to get the process status.", null)); //$NON-NLS-1$ + } + String cmdOutput = status.getMessage(); + String version = StringUtil.EMPTY; + String patternString = "\\d+\\.\\d+\\.\\d+"; //$NON-NLS-1$ + Pattern pattern = Pattern.compile(patternString); + Matcher matcher = pattern.matcher(cmdOutput); + if (matcher.find()) + { + version = matcher.group(0); + } + + if(StringUtil.isEmpty(version)) + { + return StringUtil.EMPTY; + } + + return version; + } + catch (Exception e) + { + Logger.log(e); + } + + return StringUtil.EMPTY; + } + + private boolean isVersionGreaterOrEqual(String version, String minVersion) + { + // Define the regex pattern to match version numbers + String pattern = "\\d+\\.\\d+\\.\\d+"; //$NON-NLS-1$ + Pattern r = Pattern.compile(pattern); + + // Now create matcher object. + Matcher m = r.matcher(version); + Matcher mMin = r.matcher(minVersion); + + if (m.find() && mMin.find()) + { + String[] currentVersionParts = m.group(0).split("\\."); //$NON-NLS-1$ + String[] minVersionParts = mMin.group(0).split("\\."); //$NON-NLS-1$ + + int currentMajor = Integer.parseInt(currentVersionParts[0]); + int currentMinor = Integer.parseInt(currentVersionParts[1]); + int currentPatch = Integer.parseInt(currentVersionParts[2]); + + int minMajor = Integer.parseInt(minVersionParts[0]); + int minMinor = Integer.parseInt(minVersionParts[1]); + int minPatch = Integer.parseInt(minVersionParts[2]); + + if (currentMajor > minMajor) + { + return true; + } + else if (currentMajor == minMajor) + { + if (currentMinor > minMinor) + { + return true; + } + else if (currentMinor == minMinor) + { + return currentPatch >= minPatch; + } + } + } + + return false; + } + + protected IDFVersion Version() { String versionTxt = versionCombo.getText(); @@ -478,24 +582,6 @@ public boolean isConfigureExistingEnabled() { return fileSystemBtn.getSelection(); } - - private void showMessage() - { - Display.getDefault().asyncExec(new Runnable() - { - - @Override - public void run() { - boolean allowToCreateProjectWithSpaces = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), Messages.IDFDownloadWizard_AllowSpacesTitle, - Messages.IDFDownloadWizard_AllowSpacesMsg); - - if (allowToCreateProjectWithSpaces) { - setErrorMessage(null); - setPageComplete(true); - } - } - }); - } public String getPythonExePath() { diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java index 9778ced06..cc53e5c79 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/Messages.java @@ -22,6 +22,7 @@ public class Messages extends NLS public static String IDFDownloadPage_DirectoryDialogMsg; public static String IDFDownloadPage_DirectoryDialogText; public static String IDFDownloadPage_DirectoryDialogTxt; + public static String IDFDownloadPage_VersionSpaceError; public static String IDFDownloadPage_DownloadIDF; public static String IDFDownloadPage_IDFBuildNotSupported; public static String IDFDownloadPage_Note; diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties index b91f9a4d5..fa4492eae 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties @@ -10,6 +10,7 @@ IDFDownloadPage_ChooseIDFVersion=Please choose ESP-IDF version to download: IDFDownloadPage_ClickFinishToDownload=Click on `Finish` to download IDFDownloadPage_ClickOnFinish=Click on `Finish` to configure IDF_PATH with IDFDownloadPage_DirDoesnotExist=Directory doesn''t exist: +IDFDownloadPage_VersionSpaceError=ESP-IDF build system support spaces in paths after v5.0. Please choose a different directory or continue if your ESP-IDF version supports spaces. IDFDownloadPage_DirectoryDialogMessage=Choose Directory to download ESP-IDF IDFDownloadPage_DirectoryDialogMsg=Select ESP-IDF Directory: IDFDownloadPage_DirectoryDialogText=Choose Directory diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java index 98c285809..51f653478 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java @@ -107,31 +107,40 @@ protected void processExportCmdOutput(final String exportCmdOp) } - idfToolSet.getEnvVars().put(IDFEnvironmentVariables.IDF_COMPONENT_MANAGER, "1"); + idfToolSet.getEnvVars().put(IDFEnvironmentVariables.IDF_COMPONENT_MANAGER, "1"); //$NON-NLS-1$ // IDF_MAINTAINER=1 to be able to build with the clang toolchain - idfToolSet.getEnvVars().put(IDFEnvironmentVariables.IDF_MAINTAINER, "1"); + idfToolSet.getEnvVars().put(IDFEnvironmentVariables.IDF_MAINTAINER, "1"); //$NON-NLS-1$ if (!StringUtil.isEmpty(idfPath)) { idfToolSet.getEnvVars().put(IDFEnvironmentVariables.IDF_PATH, idfPath); idfToolSet.setIdfLocation(idfPath); } - if (StringUtil.isEmpty(idfToolSet.getEnvVars().get(IDFEnvironmentVariables.ESP_IDF_VERSION))) +// if (StringUtil.isEmpty(idfToolSet.getEnvVars().get(IDFEnvironmentVariables.ESP_IDF_VERSION))) +// { +// IStatus status = getIdfVersionFromIdfPy(); +// String cmdOutput = status.getMessage(); +// Pattern pattern = Pattern.compile("v(\\d+\\.\\d+\\.\\d+)"); +// Matcher matcher = pattern.matcher(cmdOutput.toLowerCase()); +// if (matcher.find()) +// { +// idfToolSet.setIdfVersion(matcher.group(1)); +// } +// idfToolSet.getEnvVars().put(IDFEnvironmentVariables.ESP_IDF_VERSION, idfToolSet.getIdfVersion()); +// } +// else +// { +// idfToolSet.setIdfVersion(idfToolSet.getEnvVars().get(IDFEnvironmentVariables.ESP_IDF_VERSION)); +// } + IStatus status = getIdfVersionFromIdfPy(); + String cmdOutput = status.getMessage(); + Pattern pattern = Pattern.compile("v(\\d+\\.\\d+\\.\\d+)"); //$NON-NLS-1$ + Matcher matcher = pattern.matcher(cmdOutput.toLowerCase()); + if (matcher.find()) { - IStatus status = getIdfVersionFromIdfPy(); - String cmdOutput = status.getMessage(); - Pattern pattern = Pattern.compile("v(\\d+\\.\\d+\\.\\d+)"); - Matcher matcher = pattern.matcher(cmdOutput.toLowerCase()); - if (matcher.find()) - { - idfToolSet.setIdfVersion(matcher.group(1)); - } - idfToolSet.getEnvVars().put(IDFEnvironmentVariables.ESP_IDF_VERSION, idfToolSet.getIdfVersion()); - } - else - { - idfToolSet.setIdfVersion(idfToolSet.getEnvVars().get(IDFEnvironmentVariables.ESP_IDF_VERSION)); + idfToolSet.setIdfVersion(matcher.group(1)); } + idfToolSet.getEnvVars().put(IDFEnvironmentVariables.ESP_IDF_VERSION, idfToolSet.getIdfVersion()); } From 5ed5268894eb637734313df85eb6f179c0cb66e1 Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:56:54 +0200 Subject: [PATCH 5/8] validation updated for download --- .../com/espressif/idf/ui/install/IDFDownloadPage.java | 10 +++++++++- .../com/espressif/idf/ui/install/messages.properties | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index 4d8042f66..26b1f4abf 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -112,6 +112,14 @@ public void createControl(Composite parent) GridData gridData = new GridData(SWT.NONE, SWT.NONE, false, false, 2, 1); gridData.widthHint = 250; versionCombo.setLayoutData(gridData); + versionCombo.addSelectionListener(new SelectionAdapter() + { + @Override + public void widgetSelected(SelectionEvent e) + { + validate(); + } + }); versionsMap = new IDFVersionsReader().getVersionsMap(); Set keySet = versionsMap.keySet(); @@ -454,7 +462,7 @@ private void validate() if (!supportSpaces && directoryTxt.getText().contains(" ")) //$NON-NLS-1$ { - setErrorMessage(Messages.IDFDownloadPage_IDFBuildNotSupported); + setErrorMessage(Messages.IDFDownloadPage_VersionSpaceError); setPageComplete(false); return; } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties index fa4492eae..071dc26af 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/messages.properties @@ -10,7 +10,7 @@ IDFDownloadPage_ChooseIDFVersion=Please choose ESP-IDF version to download: IDFDownloadPage_ClickFinishToDownload=Click on `Finish` to download IDFDownloadPage_ClickOnFinish=Click on `Finish` to configure IDF_PATH with IDFDownloadPage_DirDoesnotExist=Directory doesn''t exist: -IDFDownloadPage_VersionSpaceError=ESP-IDF build system support spaces in paths after v5.0. Please choose a different directory or continue if your ESP-IDF version supports spaces. +IDFDownloadPage_VersionSpaceError=ESP-IDF build system support spaces in paths after v5.0. Please choose a different directory. IDFDownloadPage_DirectoryDialogMessage=Choose Directory to download ESP-IDF IDFDownloadPage_DirectoryDialogMsg=Select ESP-IDF Directory: IDFDownloadPage_DirectoryDialogText=Choose Directory From 79a6e0e920226b2812a5e8a5a185a451df1b059a Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:01:02 +0200 Subject: [PATCH 6/8] imports cleanup --- .../idf/ui/tools/manager/pages/ESPIDFMainTablePage.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java index 76bc486ac..0bfa5b5f0 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java @@ -36,7 +36,6 @@ import com.espressif.idf.core.tools.ToolSetConfigurationManager; import com.espressif.idf.core.tools.vo.IDFToolSet; import com.espressif.idf.core.util.IDFUtil; -import com.espressif.idf.ui.LaunchBarListener; import com.espressif.idf.ui.UIPlugin; import com.espressif.idf.ui.install.IDFNewToolsWizard; import com.espressif.idf.ui.tools.Messages; From 17e960d53544d2d4bdf7f54cf65bd00903b77fdc Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:55:24 +0200 Subject: [PATCH 7/8] fix for the empty folder issue --- .../src/com/espressif/idf/ui/install/IDFDownloadPage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index 26b1f4abf..89147d202 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -403,9 +403,11 @@ private void validate() setPageComplete(false); return; } - if (idfPath.contains(" ")) //$NON-NLS-1$ + + String version = getIdfVersionUsingGit(idfPath); + + if (idfPath.contains(" ") && !StringUtil.isEmpty(version)) //$NON-NLS-1$ { - String version = getIdfVersionUsingGit(idfPath); boolean validVersion = isVersionGreaterOrEqual(version, "5.0.0"); //$NON-NLS-1$ if (!validVersion) { From 49974189a21d7b60dbf5eddc67fba2a053e0ec58 Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:41:44 +0200 Subject: [PATCH 8/8] review comments resolved --- bundles/com.espressif.idf.swt.custom/.gitignore | 1 + .../idf/ui/install/IDFDownloadPage.java | 1 + .../src/com/espressif/idf/ui/tools/ToolsJob.java | 16 ---------------- 3 files changed, 2 insertions(+), 16 deletions(-) create mode 100644 bundles/com.espressif.idf.swt.custom/.gitignore diff --git a/bundles/com.espressif.idf.swt.custom/.gitignore b/bundles/com.espressif.idf.swt.custom/.gitignore new file mode 100644 index 000000000..ae3c17260 --- /dev/null +++ b/bundles/com.espressif.idf.swt.custom/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java index 89147d202..085580162 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/install/IDFDownloadPage.java @@ -501,6 +501,7 @@ private String getIdfVersionUsingGit(String idfPath) { Logger.log(IDFCorePlugin.getPlugin(), IDFCorePlugin.errorStatus("Unable to get the process status.", null)); //$NON-NLS-1$ + return StringUtil.EMPTY; } String cmdOutput = status.getMessage(); String version = StringUtil.EMPTY; diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java index 51f653478..e47e0cffa 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java @@ -116,22 +116,6 @@ protected void processExportCmdOutput(final String exportCmdOp) idfToolSet.setIdfLocation(idfPath); } -// if (StringUtil.isEmpty(idfToolSet.getEnvVars().get(IDFEnvironmentVariables.ESP_IDF_VERSION))) -// { -// IStatus status = getIdfVersionFromIdfPy(); -// String cmdOutput = status.getMessage(); -// Pattern pattern = Pattern.compile("v(\\d+\\.\\d+\\.\\d+)"); -// Matcher matcher = pattern.matcher(cmdOutput.toLowerCase()); -// if (matcher.find()) -// { -// idfToolSet.setIdfVersion(matcher.group(1)); -// } -// idfToolSet.getEnvVars().put(IDFEnvironmentVariables.ESP_IDF_VERSION, idfToolSet.getIdfVersion()); -// } -// else -// { -// idfToolSet.setIdfVersion(idfToolSet.getEnvVars().get(IDFEnvironmentVariables.ESP_IDF_VERSION)); -// } IStatus status = getIdfVersionFromIdfPy(); String cmdOutput = status.getMessage(); Pattern pattern = Pattern.compile("v(\\d+\\.\\d+\\.\\d+)"); //$NON-NLS-1$