Skip to content

Commit

Permalink
fix(workspace): Auto includes not getting calculated for submit
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
  • Loading branch information
GordonSmith committed Sep 22, 2020
1 parent 473ad02 commit 636815b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/ecl/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { eclDiagnostic } from "./diagnostic";

const logger = scopedLogger("debugger/ECLDEbugSession.ts");

function calcIncludeFolders(wsPath: string): string[] {
export function calcIncludeFolders(wsPath: string): string[] {
const dedup: { [key: string]: boolean } = {};
const retVal: string[] = [];
function safeAppend(fsPath: string) {
Expand Down
12 changes: 7 additions & 5 deletions src/hpccplatform/launchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { locateClientTools, AccountService, Activity, Workunit, WUQuery, WUUpdat
import { scopedLogger } from "@hpcc-js/util";
import { LaunchConfigState, LaunchMode, LaunchRequestArguments } from "../debugger/launchRequestArguments";
import { eclConfigurationProvider } from "./configProvider";
import { calcIncludeFolders } from "../ecl/check";

import * as fs from "fs";
import * as os from "os";
Expand Down Expand Up @@ -347,24 +348,25 @@ export class LaunchConfig {
});
}

async submit(filePath: string, targetCluster: string, mode: LaunchMode) {
async submit(fileUri: vscode.Uri, targetCluster: string, mode: LaunchMode) {
// const args = await this.localResolveDebugConfiguration(filePath);
// logger.debug("launchRequest: " + JSON.stringify(args));
return vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: "Submit ECL",
cancellable: false
}, (progress, token) => {
const uri = vscode.Uri.file(filePath);
const workspace = vscode.workspace.getWorkspaceFolder(uri);

const currentWorkspace = vscode.workspace.getWorkspaceFolder(fileUri);
const currentWorkspacePath = currentWorkspace ? currentWorkspace.uri.fsPath : "";
const includeFolders = calcIncludeFolders(currentWorkspacePath);
const filePath = fileUri.fsPath;
logger.info(`Fetch build version.${os.EOL}`);
const pathParts = path.parse(filePath);
let failedWU: Workunit;
return this.fetchBuild().then(build => {
progress.report({ increment: 10, message: "Locating Client Tools" });
logger.info(`Locating Client Tools.${os.EOL}`);
return locateClientTools(this.eclccPath, build, workspace.uri.fsPath, this.includeFolders, this.legacyMode);
return locateClientTools(this.eclccPath, build, currentWorkspace.uri.fsPath, includeFolders, this.legacyMode);
}).then((clientTools) => {
progress.report({ increment: 10, message: "Creating Archive" });
logger.info(`Client Tools: ${clientTools.eclccPath}.${os.EOL}`);
Expand Down
14 changes: 7 additions & 7 deletions src/hpccplatform/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class Session {
return this._launchConfig.wuQuery(request);
}

submit(fsPath: string) {
return this._launchConfig.submit(fsPath, this.targetCluster, "submit");
submit(uri: vscode.Uri) {
return this._launchConfig.submit(uri, this.targetCluster, "submit");
}

compile(fsPath: string) {
return this._launchConfig.submit(fsPath, this.targetCluster, "compile");
compile(uri: vscode.Uri) {
return this._launchConfig.submit(uri, this.targetCluster, "compile");
}

fetchRecordDef(lf: string) {
Expand Down Expand Up @@ -163,7 +163,7 @@ class SessionManager {
}
if (this.session) {
vscode.window.showWarningMessage("Submitting ECL via the Run/Debug page is being depricated. Please use the new Submit + Compile buttons at the top of the ECL Editor.");
this.session.submit(launchRequestArgs.program).then(wu => {
this.session.submit(vscode.Uri.file(launchRequestArgs.program)).then(wu => {
this._onDidCreateWorkunit.fire(wu);
});
}
Expand Down Expand Up @@ -221,7 +221,7 @@ class SessionManager {

submit(doc: vscode.TextDocument) {
if (this.session) {
return this.session.submit(doc.uri.fsPath).then(wu => {
return this.session.submit(doc.uri).then(wu => {
this._onDidCreateWorkunit.fire(wu);
return wu;
}).catch(e => {
Expand All @@ -232,7 +232,7 @@ class SessionManager {

compile(doc: vscode.TextDocument) {
if (this.session) {
return this.session.compile(doc.uri.fsPath).then(wu => {
return this.session.compile(doc.uri).then(wu => {
this._onDidCreateWorkunit.fire(wu);
return wu;
}).catch(e => {
Expand Down

0 comments on commit 636815b

Please sign in to comment.