Skip to content

Commit

Permalink
feat: Add "publish" action
Browse files Browse the repository at this point in the history
Allow compile + publish a WU in a single step

Signed-off-by: Gordon Smith <gordonjsmith@gmail.com>
  • Loading branch information
GordonSmith committed Oct 11, 2019
1 parent 7296b6a commit d7bd786
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following Visual Studio Code settings are available for the ECL extension.

#### Launch Settings

Submitting or debugging ECL using VS-Code requires specifiying the target environment within the VS Code `launch.json` (pressing `F5` will prompt you to auto create a skeleton file if none exists):
Submitting or debugging ECL using VS-Code requires specifying the target environment within the VS Code `launch.json` (pressing `F5` will prompt you to auto create a skeleton file if none exists):

```javascript
{
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@
"enum": [
"submit",
"compile",
"publish",
"debug"
],
"default": "submit"
Expand Down Expand Up @@ -531,4 +532,4 @@
}
}
}
}
}
6 changes: 6 additions & 0 deletions src/debugger/ECLDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ export class ECLDebugSession extends DebugSession {
this.sendEvent(new InitializedEvent());
this.logger.debug("InitializeEvent");
});
if (this.launchConfig.isPublish()) {
this.workunit.watchUntilComplete().then(() => {
this.logger.debug("Publish");
this.workunit.publish();
});
}
}).catch((e) => {
this.sendEvent(new OutputEvent(`Launch failed - ${e}${os.EOL}`));
this.sendEvent(new TerminatedEvent());
Expand Down
7 changes: 6 additions & 1 deletion src/debugger/launchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { setTimeout } from "timers";
import { DebugProtocol } from "vscode-debugprotocol";

// This interface should always match the schema found in `package.json`.
export type LaunchMode = "submit" | "compile" | "debug";
export type LaunchMode = "submit" | "compile" | "publish" | "debug";
export type LaunchProtocol = "http" | "https";
export type LaunchLegacyMode = "true" | "false" | "";

Expand Down Expand Up @@ -54,6 +54,7 @@ export class LaunchConfig {
action(): WUUpdate.Action {
switch (this._config.mode) {
case "compile":
case "publish":
return WUUpdate.Action.Compile;
case "debug":
return WUUpdate.Action.Debug;
Expand All @@ -63,6 +64,10 @@ export class LaunchConfig {
}
}

isPublish() {
return this._config.mode === "publish";
}

legacyMode(): boolean | undefined {
switch (this._config.legacyMode) {
case "true":
Expand Down

0 comments on commit d7bd786

Please sign in to comment.