From fe3f79c6f3fa76eaf47882aa60ee94bb87b4686b Mon Sep 17 00:00:00 2001 From: Sanjula Date: Mon, 23 Feb 2026 01:21:20 -0500 Subject: [PATCH 1/2] Return build or compile result Signed-off-by: Sanjula --- src/iproject.ts | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/iproject.ts b/src/iproject.ts index 67cd027..2ae06fd 100644 --- a/src/iproject.ts +++ b/src/iproject.ts @@ -2,7 +2,7 @@ * (c) Copyright IBM Corp. 2023 */ -import { Action, CommandResult, DeploymentMethod, DeploymentParameters, IBMiObject } from "@halcyontech/vscode-ibmi-types"; +import { Action, ActionResult, CommandResult, DeploymentMethod, DeploymentParameters, IBMiObject } from "@halcyontech/vscode-ibmi-types"; import * as dotenv from 'dotenv'; import { ValidatorResult } from "jsonschema"; import * as path from "path"; @@ -61,6 +61,15 @@ export type Direction = 'up' | 'down'; */ export type Position = 'first' | 'last' | 'middle'; +/** + * Represents a build or compile result. + */ +export type BuildOrCompileResult = { + success: boolean, + output: string[], + message: string +}; + /** * Represents an IBM i Project. */ @@ -468,7 +477,13 @@ export class IProject { * @param fileUri The file uri to compile or `undefined` for builds. * @param object The specific object to build. */ - public async runBuildOrCompileCommand(isBuild: boolean, fileUri?: Uri, object?: string) { + public async runBuildOrCompileCommand(isBuild: boolean, fileUri?: Uri, object?: string): Promise { + let buildOrCompileResult: BuildOrCompileResult = { + success: false, + output: [], + message: '' + }; + const unresolvedState = await this.getUnresolvedState(); if (unresolvedState) { @@ -517,10 +532,25 @@ export class IProject { ".evfevent" ] }; - await commands.executeCommand(`code-for-ibmi.runAction`, { resourceUri: fileUri ? fileUri : this.workspaceFolder.uri }, undefined, action, this.deploymentMethod); + const actionResult: ActionResult = await commands.executeCommand(`code-for-ibmi.runAction`, { resourceUri: fileUri ? fileUri : this.workspaceFolder.uri }, undefined, action, this.deploymentMethod); ProjectManager.fire({ type: isBuild ? 'build' : 'compile', iProject: this }); + + buildOrCompileResult.success = actionResult.success; + buildOrCompileResult.message = actionResult.message; + if (actionResult.output.length > 0 && actionResult.output[0].output.length > 0) { + buildOrCompileResult.output = actionResult.output[0].output; + } + } else { + const commandField = isBuild ? + (object ? 'buildObjectCommand' : 'buildCommand') : + 'compileCommand'; + buildOrCompileResult.message = l10n.t('{0} not set', commandField); } + } else { + buildOrCompileResult.message = l10n.t('No iproj.json found'); } + + return buildOrCompileResult; } /** * Run the project's build, build object, or compile command. If no command @@ -1431,6 +1461,7 @@ export class IProject { this.liblVarsUpdated = false; // toggle off after it is cheched return returnValue; } + /** * Get the validation result of the project against the `iproj.json` schema. * From 875b3403ab927fb23b9f5bdb356cc4b746bb0bdf Mon Sep 17 00:00:00 2001 From: Sanjula Date: Wed, 25 Feb 2026 01:01:01 -0500 Subject: [PATCH 2/2] Check for action result for backwards compatability Signed-off-by: Sanjula --- src/iproject.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/iproject.ts b/src/iproject.ts index 2ae06fd..1fbcf2f 100644 --- a/src/iproject.ts +++ b/src/iproject.ts @@ -535,10 +535,12 @@ export class IProject { const actionResult: ActionResult = await commands.executeCommand(`code-for-ibmi.runAction`, { resourceUri: fileUri ? fileUri : this.workspaceFolder.uri }, undefined, action, this.deploymentMethod); ProjectManager.fire({ type: isBuild ? 'build' : 'compile', iProject: this }); - buildOrCompileResult.success = actionResult.success; - buildOrCompileResult.message = actionResult.message; - if (actionResult.output.length > 0 && actionResult.output[0].output.length > 0) { - buildOrCompileResult.output = actionResult.output[0].output; + if (actionResult) { + buildOrCompileResult.success = actionResult.success; + buildOrCompileResult.message = actionResult.message; + if (actionResult.output.length > 0 && actionResult.output[0].output.length > 0) { + buildOrCompileResult.output = actionResult.output[0].output; + } } } else { const commandField = isBuild ?