Skip to content

Commit

Permalink
Remove unnecessary validation
Browse files Browse the repository at this point in the history
We don't need to use "=" in the commands anymore
  • Loading branch information
radurentea committed Oct 27, 2024
1 parent c8a4e82 commit bf43756
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
26 changes: 6 additions & 20 deletions src/build/buildTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import * as vscode from "vscode";
import * as idfConf from "../idfConfiguration";
import {
appendIdfAndToolsToPath,
compareVersion,
getEspIdfFromCMake,
getSDKConfigFilePath,
isBinInPath,
Expand Down Expand Up @@ -119,7 +118,6 @@ export class BuildTask {
if (!cmakeCacheExists) {
const espIdfVersion = await getEspIdfFromCMake(this.idfPathDir);
let defaultCompilerArgs;
const useEqualSign = compareVersion(espIdfVersion, "4.4") >= 0;
if (espIdfVersion === "x.x") {
Logger.warn(
"Could not determine ESP-IDF version. Using default compiler arguments for the latest known version."
Expand All @@ -129,12 +127,6 @@ export class BuildTask {
"-DPYTHON_DEPS_CHECKED=1",
"-DESP_PLATFORM=1",
];
} else if (useEqualSign) {
defaultCompilerArgs = [
"-G=Ninja",
"-DPYTHON_DEPS_CHECKED=1",
"-DESP_PLATFORM=1",
];
} else {
defaultCompilerArgs = [
"-G",
Expand All @@ -153,19 +145,11 @@ export class BuildTask {
}
let buildPathArgsIndex = compilerArgs.indexOf("-B");
if (buildPathArgsIndex !== -1) {
compilerArgs.splice(buildPathArgsIndex, useEqualSign ? 1 : 2);
}
if (useEqualSign) {
compilerArgs.push(`-B=${this.buildDirPath}`);
} else {
compilerArgs.push("-B", this.buildDirPath);
compilerArgs.splice(buildPathArgsIndex, 2);
}
compilerArgs.push("-B", this.buildDirPath);
if (compilerArgs.indexOf("-S") === -1) {
if (useEqualSign) {
compilerArgs.push(`-S=${this.currentWorkspace.fsPath}`);
} else {
compilerArgs.push("-S", this.currentWorkspace.fsPath);
}
compilerArgs.push("-S", this.currentWorkspace.fsPath);
}

const sdkconfigFile = await getSDKConfigFilePath(this.currentWorkspace);
Expand Down Expand Up @@ -261,7 +245,9 @@ export class BuildTask {
this.currentWorkspace
) as string;

const adapterTargetName = await getIdfTargetFromSdkconfig(this.currentWorkspace);
const adapterTargetName = await getIdfTargetFromSdkconfig(
this.currentWorkspace
);
const showTaskOutput =
notificationMode === idfConf.NotificationMode.All ||
notificationMode === idfConf.NotificationMode.Output
Expand Down
12 changes: 3 additions & 9 deletions src/espIdf/reconfigure/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
workspace,
} from "vscode";
import { NotificationMode, readParameter } from "../../idfConfiguration";
import { appendIdfAndToolsToPath, compareVersion, getEspIdfFromCMake, getSDKConfigFilePath } from "../../utils";
import { appendIdfAndToolsToPath, getSDKConfigFilePath } from "../../utils";
import { join } from "path";
import { TaskManager } from "../../taskManager";
import { getVirtualEnvPythonPath } from "../../pythonManager";
Expand Down Expand Up @@ -65,18 +65,12 @@ export class IdfReconfigureTask {

const idfPy = join(this.idfPathDir, "tools", "idf.py");
const reconfigureArgs = [idfPy];
const espIdfVersion = await getEspIdfFromCMake(this.idfPathDir);
const useEqualSign = compareVersion(espIdfVersion, "4.4") >= 0;

let buildPathArgsIndex = reconfigureArgs.indexOf("-B");
if (buildPathArgsIndex !== -1) {
reconfigureArgs.splice(buildPathArgsIndex, useEqualSign ? 1 : 2);
}
if (useEqualSign) {
reconfigureArgs.push(`-B=${this.buildDirPath}`);
} else {
reconfigureArgs.push("-B", this.buildDirPath);
reconfigureArgs.splice(buildPathArgsIndex, 2);
}
reconfigureArgs.push("-B", this.buildDirPath);

const sdkconfigFile = await getSDKConfigFilePath(this.curWorkspace);
if (reconfigureArgs.indexOf("SDKCONFIG") === -1) {
Expand Down

0 comments on commit bf43756

Please sign in to comment.