Skip to content

Commit

Permalink
Fixing building for ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Radu Rentea committed Apr 3, 2024
1 parent 413695f commit b5d93df
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/build/buildTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ export class BuildTask {
private currentWorkspace: vscode.Uri;
private idfPathDir: string;
private adapterTargetName: string;
private processOptions: vscode.ProcessExecutionOptions;
private modifiedEnv: { [key: string]: string };
private pythonBinPath: string;

constructor(workspaceUri: vscode.Uri) {
this.currentWorkspace = workspaceUri;
this.idfPathDir = idfConf.readParameter(
Expand All @@ -49,15 +45,6 @@ export class BuildTask {
"idf.buildPath",
workspaceUri
) as string;
this.modifiedEnv = appendIdfAndToolsToPath(workspaceUri);
this.processOptions = {
cwd: this.buildDirPath,
env: this.modifiedEnv,
};
this.pythonBinPath = idfConf.readParameter(
"idf.pythonBinPath",
workspaceUri
) as string;
}

public building(flag: boolean) {
Expand Down Expand Up @@ -87,16 +74,21 @@ export class BuildTask {
throw new Error("ALREADY_BUILDING");
}
this.building(true);
const modifiedEnv = appendIdfAndToolsToPath(this.currentWorkspace);
const processOptions = {
cwd: this.buildDirPath,
env: modifiedEnv,
};
await ensureDir(this.buildDirPath);
const canAccessCMake = await isBinInPath(
"cmake",
this.currentWorkspace.fsPath,
this.modifiedEnv
modifiedEnv
);
const canAccessNinja = await isBinInPath(
"ninja",
this.currentWorkspace.fsPath,
this.modifiedEnv
modifiedEnv
);

const cmakeCachePath = join(this.buildDirPath, "CMakeCache.txt");
Expand Down Expand Up @@ -164,7 +156,7 @@ export class BuildTask {
}
}
const cmakeCommand = "cmake";
const compileExecution = new vscode.ProcessExecution(cmakeCommand, compilerArgs, this.processOptions);
const compileExecution = new vscode.ProcessExecution(cmakeCommand, compilerArgs, processOptions);
const compilePresentationOptions = {
reveal: showTaskOutput,
showReuseMessage: false,
Expand All @@ -191,7 +183,7 @@ export class BuildTask {
string
>) || [];
const ninjaCommand = "ninja";
const buildExecution = new vscode.ProcessExecution(ninjaCommand, buildArgs, this.processOptions);
const buildExecution = new vscode.ProcessExecution(ninjaCommand, buildArgs, processOptions);
const buildPresentationOptions = {
reveal: showTaskOutput,
showReuseMessage: false,
Expand All @@ -213,6 +205,15 @@ export class BuildTask {
const modifiedEnv = appendIdfAndToolsToPath(this.currentWorkspace);
await ensureDir(this.buildDirPath);

const processOptions = {
cwd: this.buildDirPath,
env: modifiedEnv,
};
const pythonBinPath = idfConf.readParameter(
"idf.pythonBinPath",
this.currentWorkspace
) as string;

const currentWorkspaceFolder = vscode.workspace.workspaceFolders.find(
(w) => w.uri === this.currentWorkspace
);
Expand All @@ -237,7 +238,7 @@ export class BuildTask {
"--pid",
selectedDFUAdapterId(this.adapterTargetName)
];
const writeExecution = new vscode.ProcessExecution(this.pythonBinPath, args, this.processOptions);
const writeExecution = new vscode.ProcessExecution(pythonBinPath, args, processOptions);
const buildPresentationOptions = {
reveal: showTaskOutput,
showReuseMessage: false,
Expand Down

0 comments on commit b5d93df

Please sign in to comment.