Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build_devtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.29.0
version: 3.44.0

- name: Run Flutter Test
run: tool/gh_actions/devtool/run_devtool_test.sh
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.13.0

- name: Setup Node
uses: actions/setup-node@v4
Expand Down Expand Up @@ -75,7 +77,9 @@ jobs:

deploy-documentation:
name: Deploy Documentation
needs: run-checks
needs:
- run-checks
- build-devtool
if: github.event_name == 'push'
permissions:
contents: write # required for "JamesIves/github-pages-deploy-action"
Expand All @@ -94,6 +98,12 @@ jobs:
- name: Generate project documentation
run: tool/gh_actions/generate_documentation.sh

- name: Add standalone DevTools application
uses: actions/download-artifact@v4
with:
name: rohd-devtools-standalone
path: doc/api/rohd_devtools_extension

- name: Deploy generated documentation
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand All @@ -111,7 +121,7 @@ jobs:
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.29.0
version: 3.44.0

- name: Run Flutter Test
run: tool/gh_actions/devtool/run_devtool_test.sh
Expand All @@ -122,3 +132,13 @@ jobs:
- name: Test DevTools Installation
run: tool/gh_actions/devtool/test_devtools_install.sh extension/devtools

- name: Build standalone DevTools application
run: rohd_devtools_extension/tool/gh_actions/build_app.sh /rohd_devtools_extension/

- name: Upload standalone DevTools application
uses: actions/upload-artifact@v4
with:
name: rohd-devtools-standalone
path: rohd_devtools_extension/build/web
if-no-files-found: error
include-hidden-files: true
7 changes: 7 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ analyzer:
- packages/rohd_waveform
- rohd_devtools_extension
- rohd_extension
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

# keep up to date, matching https://dart.dev/tools/linter-rules/all
# some lints are not yet available, so disabled and marked with [not currently recognized]
Expand Down
19 changes: 17 additions & 2 deletions rohd_devtools_extension/Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
# Minimal build entrypoints for the upstream standalone extension package.

ROOT := $(shell pwd)
FLUTTER_WEB_BUILD_ARGS ?=

.PHONY: all linux clean-linux help
.PHONY: all linux web web-release clean-linux clean-web help

all: linux

linux:
@flutter pub get
@flutter build linux --target=lib/main_standalone.dart

web:
@flutter pub get
@flutter build web --release --target=lib/main_standalone.dart $(FLUTTER_WEB_BUILD_ARGS)

web-release:
@rm -f build/web/index.html
@$(MAKE) web

clean-linux:
-rm -rf $(ROOT)/build/linux
-rm -rf $(ROOT)/linux/flutter/ephemeral

clean-web:
-rm -rf $(ROOT)/build/web

help:
@echo "ROHD DevTools Extension"
@echo ""
@echo "Targets:"
@echo " all - Build the Linux standalone app (default)"
@echo " linux - Run flutter pub get and build Linux standalone"
@echo " clean-linux - Remove Linux build outputs"
@echo " web - Build the web standalone app"
@echo " web-release - Force a release web build"
@echo " clean-linux - Remove Linux build outputs"
@echo " clean-web - Remove web build outputs"
13 changes: 13 additions & 0 deletions rohd_devtools_extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ cd rohd_devtools_extension
flutter run --release -d web-server --web-port=9099 --web-hostname=0.0.0.0 lib/main_standalone.dart
```

Build a static bundle for a repository-scoped web path:

```sh
cd rohd_devtools_extension
tool/gh_actions/build_app.sh /rohd_devtools_extension/
```

The bundle is written to `build/web/`. The optional argument must start and end
with `/`; it becomes the Flutter base href used when the app is hosted below a
site root. Local builds default to `/rohd_devtools_extension/`. On pushes to
`main`, the `General` workflow includes this bundle in the existing ROHD
documentation deployment at `/rohd_devtools_extension/`.

Run the release Linux standalone form:

```sh
Expand Down
8 changes: 8 additions & 0 deletions rohd_devtools_extension/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# https://rydmike.com/blog_flutter_linting.html

analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
language:
strict-casts: true
strict-inference: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
include: package:lints/recommended.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: ../../analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// Copyright (C) 2026 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// module_info_helper.js
// Shared helper for querying FLC module info via the rohd_extension commands.
//
// Used by both rohd-schematic-viewer (plain JS) and rohd-wave-viewer
// (TypeScript) VS Code extensions to resolve format availability for a module.
//
// 2026 May
// Author: Desmond Kirkpatrick <desmond.a.kirkpatrick@intel.com>

const vscode = require('vscode');
const path = require('path');
const fs = require('fs');

/**
* Resolve the `.flc.json` sidecar path for a given document URI.
* Delegates to the `rohd.resolveFlcPath` command in rohd_extension.
* Falls back to local convention if the command is unavailable.
*
* @param {import('vscode').Uri} documentUri
* @param {import('vscode').OutputChannel} [output]
* @returns {Promise<string|null>}
*/
async function resolveFlcPath(documentUri, output) {
try {
const result = await vscode.commands.executeCommand('rohd.resolveFlcPath', {
documentFsPath: documentUri.fsPath,
});
return result ?? null;
} catch (_) {
// rohd_extension not installed - fall back to local convention.
const fsPath = documentUri.fsPath;
const dir = path.dirname(fsPath);
const base = path.basename(fsPath);
// .vcd/.fst/.ghw/.rohd.json -> .flc.json
const flcName = base.replace(/\.(vcd|fst|ghw|rohd\.json)$/i, '.flc.json');
if (flcName === base) return null;
const flcPath = path.join(dir, flcName);
return fs.existsSync(flcPath) ? flcPath : null;
}
}

/**
* Build a RohdModuleInfo-compatible JSON object for [moduleName].
*
* Delegates to the `rohd.queryModule` VS Code command provided by
* rohd_extension, which owns all FLC parsing logic.
*
* @param {import('vscode').Uri} documentUri
* @param {string|null} moduleName
* @param {string[]|undefined} instancePath
* @param {import('vscode').OutputChannel} [output]
* @returns {Promise<object>} matching RohdModuleInfo.toJson() schema
*/
async function buildModuleInfo(documentUri, moduleName, instancePath, output) {
const flcPath = await resolveFlcPath(documentUri, output);
if (!flcPath) {
return {
extensionAvailable: true,
module: moduleName,
formats: {},
error: 'No .flc.json sidecar found. Generate with TraceService.writeFlcFiles().',
fstLoading: false,
};
}

const queryModule = async module => {
const payload = {
flcPath,
module,
};
if (instancePath && instancePath.length > 0) {
payload.instancePath = instancePath;
}
return vscode.commands.executeCommand('rohd.queryModule', payload);
};

try {
let info = await queryModule(moduleName);

const hasFormats =
info && typeof info === 'object' && Object.keys(info.formats ?? {}).length > 0;
if (!hasFormats && instancePath && instancePath.length > 0) {
const instanceName = [...instancePath]
.reverse()
.find(segment => typeof segment === 'string' && segment.length > 0);
if (instanceName && instanceName !== moduleName) {
if (output) {
output.appendLine(
'[moduleInfo] no formats for ' +
String(moduleName ?? '') +
'; retrying with instance name ' +
instanceName,
);
}
const fallbackInfo = await queryModule(instanceName);
const fallbackHasFormats =
fallbackInfo &&
typeof fallbackInfo === 'object' &&
Object.keys(fallbackInfo.formats ?? {}).length > 0;
if (fallbackHasFormats) {
info = fallbackInfo;
}
}
}

return info ?? {
extensionAvailable: true,
module: moduleName,
formats: {},
error: 'rohd.queryModule returned no result.',
fstLoading: false,
};
} catch (e) {
if (output) output.appendLine('[moduleInfo] rohd.queryModule failed: ' + e.message);
return {
extensionAvailable: true,
module: moduleName,
formats: {},
error: 'Install the ROHD extension for source format detection.',
fstLoading: false,
};
}
}

/**
* Look up signal source frames via rohd_extension's `rohd.lookupSignal` command.
*
* @param {string} flcPath
* @param {string|null} moduleName
* @param {string} signalName
* @param {string|undefined} format
* @param {import('vscode').OutputChannel} [output]
* @returns {Promise<Array>}
*/
async function lookupSignalFrames(flcPath, moduleName, signalName, format, output) {
try {
const frames = await vscode.commands.executeCommand('rohd.lookupSignal', {
flcPath,
module: moduleName,
signal: signalName,
format,
});
const typedFrames = frames ?? [];
const filteredFrames = format
? typedFrames.filter(frame => (frame?.type ?? 'rohd') === format)
: typedFrames;
// Reverse to outermost-first order (the ROHD extension returns
// innermost-first, matching raw stack-trace order).
return filteredFrames.reverse();
} catch (e) {
if (output) output.appendLine('[crossProbe] rohd.lookupSignal failed: ' + e.message);
return [];
}
}

module.exports = { resolveFlcPath, buildModuleInfo, lookupSignalFrames };
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,27 @@
// 2026 April
// Author: Desmond Kirkpatrick <desmond.a.kirkpatrick@intel.com>

// Help
export 'src/markdown_help_button.dart';

// Overlay
export 'src/app_bar_overlay.dart';

// Shared "Expand Bits" / "Define Bit Fields" popup-menu helpers
export 'src/bit_expansion_menu.dart';
// Bit-field parsing, formatting, and dialog utilities
export 'src/bit_field_utils.dart';
// PNG export
export 'src/capture_boundary.dart';
export 'src/export_button.dart';
export 'src/export_toast.dart';
export 'src/save_png_stub.dart'
if (dart.library.io) 'src/save_png_native.dart'
if (dart.library.js_interop) 'src/save_png_web.dart';

// Cross-probing
export 'src/cross_probe_service.dart';
export 'src/cross_probe_button.dart';
export 'src/cross_probe_menu.dart';

// Cross-probing
export 'src/cross_probe_service.dart';
export 'src/export_button.dart';
export 'src/export_toast.dart';
// Logic type utilities
export 'src/logic_type_utils.dart';

// Bit-field parsing, formatting, and dialog utilities
export 'src/bit_field_utils.dart';

// Shared "Expand Bits" / "Define Bit Fields" popup-menu helpers
export 'src/bit_expansion_menu.dart';

// Help
export 'src/markdown_help_button.dart';
export 'src/rohd_extension_client.dart';
// ROHD extension client
export 'src/rohd_extension_status.dart';
export 'src/rohd_extension_client.dart';
export 'src/save_png_stub.dart'
if (dart.library.io) 'src/save_png_native.dart'
if (dart.library.js_interop) 'src/save_png_web.dart';
Loading
Loading