Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions FASTBuildMonitorVSCode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@
"activationEvents": [],
"main": "./out/extension.js",
"contributes": {
"viewsContainers": {
"panel": [
{
"id": "fbuildMonitorPanel",
"title": "FASTBuild Monitor",
"icon": "icon.png"
}
]
},
"views": {
"fbuildMonitorPanel": [
{
"type": "webview",
"id": "fbuildMonitor.fbuildMonitorView",
"name": "FASTBuild Monitor"
}
]
},
"commands": [
{
"command": "fbuildMonitor.show",
Expand Down
5 changes: 4 additions & 1 deletion FASTBuildMonitorVSCode/src/buildMonitorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ReportProgressEvent,
} from "./buildWatcher";
import { BuildJob, BuildJobStatus, BuildSession, WorkerInfo } from "./models";
import { Logger } from "./utilities/logger";

/**
* Service that tracks build state from FASTBuild log events.
Expand All @@ -23,7 +24,7 @@ export class BuildMonitorService extends EventEmitter {
private currentSession: BuildSession | undefined;
private monitoring = false;

constructor(customLogPath?: string, ) {
constructor(private logger: Logger, customLogPath?: string) {
super();
this.watcher = new BuildWatcher(customLogPath);

Expand Down Expand Up @@ -66,6 +67,7 @@ export class BuildMonitorService extends EventEmitter {
if (this.monitoring) {
return;
}
this.logger.info("Starting build monitoring...");
this.monitoring = true;
this.watcher.start(pollIntervalMs);
this.emit("stateChanged");
Expand All @@ -75,6 +77,7 @@ export class BuildMonitorService extends EventEmitter {
if (!this.monitoring) {
return;
}
this.logger.info("Stopping build monitoring...");
this.monitoring = false;
this.watcher.stop();
this.emit("stateChanged");
Expand Down
18 changes: 10 additions & 8 deletions FASTBuildMonitorVSCode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import * as vscode from "vscode";
import { BuildMonitorService } from "./buildMonitorService";
import { MonitorPanel } from "./monitorPanel";
import { MonitorPanelProvider } from "./monitorPanelProvider";
import { Logger } from "./utilities/logger";
import { ConfigIssue, ConfigManager } from "./utilities/configManager";

Expand Down Expand Up @@ -53,33 +53,35 @@ function initializeMonitorPanel(
const config = vscode.workspace.getConfiguration("fbuildMonitor");
const customLogPath = config.get<string>("logPath", "");

service = new BuildMonitorService(customLogPath || undefined);
service = new BuildMonitorService(logger, customLogPath || undefined);

logger.info(
"Initialized BuildMonitorService with log path: " + service.getLogPath(),
);

MonitorPanelProvider.getOrCreate(context, service);

// Show panel command
context.subscriptions.push(
vscode.commands.registerCommand("fbuildMonitor.show", () => {
MonitorPanel.createOrShow(context.extensionUri, service!);
MonitorPanelProvider.getOrCreate(context, service!).show();
}),
);

// Start monitoring command
context.subscriptions.push(
vscode.commands.registerCommand("fbuildMonitor.start", () => {
const pollInterval = config.get<number>("pollIntervalMs", 500);
service!.start(pollInterval);
const panelProviderInstance = MonitorPanelProvider.getOrCreate(context, service!);
panelProviderInstance.start();
// Also open the panel if not already open
MonitorPanel.createOrShow(context.extensionUri, service!);
panelProviderInstance.show();
}),
);

// Stop monitoring command
context.subscriptions.push(
vscode.commands.registerCommand("fbuildMonitor.stop", () => {
service!.stop();
MonitorPanelProvider.getInstance()?.stop();
}),
);

Expand Down
146 changes: 0 additions & 146 deletions FASTBuildMonitorVSCode/src/monitorPanel.ts

This file was deleted.

Loading
Loading