From 7ed86abbfaad4cdcab49470dda7f89a903251cde Mon Sep 17 00:00:00 2001 From: Radu Date: Mon, 2 Oct 2023 13:18:17 +0300 Subject: [PATCH] Add fix for version 5.1.0 or above (#1039) * Add fix for version 5.1.0 or above * No duplicate functions * Fix lint * Add CI fix --- src/espIdf/size/idfSize.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/espIdf/size/idfSize.ts b/src/espIdf/size/idfSize.ts index 62eab714f..53d7339fe 100644 --- a/src/espIdf/size/idfSize.ts +++ b/src/espIdf/size/idfSize.ts @@ -23,6 +23,7 @@ import { LocDictionary } from "../../localizationDictionary"; import { Logger } from "../../logger/logger"; import { fileExists, spawn } from "../../utils"; import { getProjectName } from "../../workspaceConfig"; +import * as utils from "../../utils"; export class IDFSize { private readonly workspaceRoot: vscode.Uri; @@ -62,10 +63,19 @@ export class IDFSize { "idfSize.overviewMsg", "Gathering Overview" ); + const espIdfPath = idfConf.readParameter( + "idf.espIdfPath", + this.workspaceRoot + ) as string; + const version = await utils.getEspIdfFromCMake(espIdfPath); + const formatArgs = + utils.compareVersion(version, "5.1.0") >= 0 + ? ["--format", "json"] + : ["--json"]; const overview = await this.idfCommandInvoker([ "idf_size.py", mapFilePath, - "--json", + ...formatArgs, ]); progress.report({ increment: 30, message: locMsg }); @@ -77,7 +87,7 @@ export class IDFSize { "idf_size.py", mapFilePath, "--archives", - "--json", + ...formatArgs, ]); progress.report({ increment: 30, message: locMsg }); @@ -89,7 +99,7 @@ export class IDFSize { "idf_size.py", mapFilePath, "--file", - "--json", + ...formatArgs, ]); progress.report({ increment: 30, message: locMsg });