Skip to content

Commit

Permalink
Add fix for version 5.1.0 or above (#1039)
Browse files Browse the repository at this point in the history
* Add fix for version 5.1.0 or above

* No duplicate functions

* Fix lint

* Add CI fix
  • Loading branch information
radurentea authored Oct 2, 2023
1 parent 8510d85 commit 7ed86ab
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/espIdf/size/idfSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 });

Expand All @@ -77,7 +87,7 @@ export class IDFSize {
"idf_size.py",
mapFilePath,
"--archives",
"--json",
...formatArgs,
]);
progress.report({ increment: 30, message: locMsg });

Expand All @@ -89,7 +99,7 @@ export class IDFSize {
"idf_size.py",
mapFilePath,
"--file",
"--json",
...formatArgs,
]);
progress.report({ increment: 30, message: locMsg });

Expand Down

0 comments on commit 7ed86ab

Please sign in to comment.