diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index 63669fa33..fcd0b6f83 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -24,7 +24,7 @@ jobs: repository: espressif/esp-idf path: dependencies/idf-tools submodules: 'true' - ref: v4.4 + ref: v5.1 - name: Set up Python uses: actions/setup-python@v2 diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java index b48044a53..d3d4ddfad 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java @@ -32,11 +32,13 @@ public MessageConsoleStream getConsoleStream() { return getConsoleStream("ESP-IDF Console", null, false); //$NON-NLS-1$ } - - public MessageConsoleStream getConsoleStream(String consoleName, URL imageUrl, boolean errorStream) + + public MessageConsoleStream getConsoleStream(String consoleName, URL imageUrl, boolean errorStream, boolean handleControlChars) { // Create Tools console MessageConsole msgConsole = findConsole(consoleName, imageUrl); + msgConsole.setHandleControlCharacters(handleControlChars); + msgConsole.setCarriageReturnAsControlCharacter(handleControlChars); msgConsole.clearConsole(); MessageConsoleStream console = msgConsole.newMessageStream(); msgConsole.activate(); @@ -55,6 +57,12 @@ public void run() return console; } + + public MessageConsoleStream getConsoleStream(String consoleName, URL imageUrl, boolean errorStream) + { + return getConsoleStream(consoleName, imageUrl, errorStream, false); + } + /** * Find a console for a given name. If not found, it will create a new one and return * diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InputStreamConsoleThread.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InputStreamConsoleThread.java index 12b35b2e2..c85ac2870 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InputStreamConsoleThread.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InputStreamConsoleThread.java @@ -43,7 +43,14 @@ public void run() String line = null; while ((line = br.readLine()) != null) { - console.println(line); + if (line.matches("^\\d+%$")) + { + updateProgressBar(line); + } + else + { + console.println(line); + } } } catch (IOException e) @@ -63,4 +70,34 @@ public void run() } } } + + private void updateProgressBar(String progressLine) + { + // Extract the numeric value of the progress + int progress = Integer.parseInt(progressLine.replace("%", "")); + StringBuilder progressBar = new StringBuilder("["); + + // Assuming a 50-char wide progress bar for illustration + int totalBars = 50; + int filledBars = (progress * totalBars) / 100; + + for (int i = 0; i < totalBars; i++) + { + if (i < filledBars) + { + progressBar.append("="); + } + else if (i == filledBars) + { + progressBar.append(">"); + } + else + { + progressBar.append(" "); + } + } + progressBar.append("] ").append(progress).append("%"); + console.print("\r" + progressBar.toString()); + } + } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java index a1dfa529c..0a915411b 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java @@ -45,6 +45,7 @@ public abstract class AbstractToolsHandler extends AbstractHandler /** * Tools console */ + private IDFConsole idfConsole; protected MessageConsoleStream console; protected MessageConsoleStream errorConsoleStream; protected String idfPath; @@ -113,9 +114,10 @@ public Object execute(ExecutionEvent event) throws ExecutionException protected void activateIDFConsoleView() { - console = new IDFConsole().getConsoleStream(Messages.IDFToolsHandler_ToolsManagerConsole, null, false); - errorConsoleStream = new IDFConsole().getConsoleStream(Messages.IDFToolsHandler_ToolsManagerConsole, null, - true); + idfConsole = new IDFConsole(); + console = idfConsole.getConsoleStream(Messages.IDFToolsHandler_ToolsManagerConsole, null, false, true); + errorConsoleStream = idfConsole.getConsoleStream(Messages.IDFToolsHandler_ToolsManagerConsole, null, + true, true); } protected String getPythonExecutablePath() diff --git a/tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java b/tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java index 5b500dd32..dbfb36b03 100644 --- a/tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java +++ b/tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java @@ -119,20 +119,6 @@ public void givenNewIDFProjectIsCreatedAndBuiltUsingToolbarButtonThenProjectIsBu Fixture.thenConsoleShowsBuildSuccessful(); } - @Test - public void givenNewIDFProjectIsCreatedAndCopiedTheCopiedProjectIsBuiltSuccessfully() throws Exception - { - Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project"); - Fixture.givenProjectNameIs("NewProjectTest"); - Fixture.whenNewProjectIsSelected(); - Fixture.whenProjectIsCopied("NewProjectTest", "NewProjectTest2"); - Fixture.givenProjectNameIs("NewProjectTest2"); - Fixture.whenProjectIsBuiltUsingContextMenu(); - Fixture.thenConsoleShowsBuildSuccessful(); - Fixture.closeProject("NewProjectTest2"); - Fixture.deleteProject("NewProjectTest2"); - } - @Test public void givenNewIDFProjectIsDeletedWithAllRelatedConfigurations() throws Exception {