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
11 changes: 6 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
bazel_dep(name = "yaml-cpp", version = "0.9.0")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")

# JavaScript / web UI (src/web uses @npm for bundled assets)
bazel_dep(name = "aspect_rules_js", version = "3.0.2")
bazel_dep(name = "rules_nodejs", version = "6.7.3")
# JavaScript / web UI — only used for JS unit tests in src/web/test
bazel_dep(name = "aspect_rules_js", version = "3.0.2", dev_dependency = True)
bazel_dep(name = "rules_nodejs", version = "6.7.3", dev_dependency = True)

# A from source build of QT that allows it to link into OpenROAD.
# Building like any other bazel project. scripts in the docker folder
Expand Down Expand Up @@ -171,17 +171,18 @@ use_repo(pip, "openroad-pip")
node = use_extension(
"@rules_nodejs//nodejs:extensions.bzl",
"node",
dev_dependency = True,
)
node.toolchain(node_version = "22.14.0")

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
isolate = True,
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//src/web:pnpm-lock.yaml",
pnpm_lock = "//src/web/test:pnpm-lock.yaml",
)
use_repo(npm, "npm")

Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

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

2 changes: 1 addition & 1 deletion src/web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*~
test/results
test/node_modules
TAGS
node_modules
15 changes: 5 additions & 10 deletions src/web/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2026, The OpenROAD Authors

load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//bazel:tcl_encode_or.bzl", "tcl_encode")
load("//bazel:tcl_wrap_cc.bzl", "tcl_wrap_cc")
Expand All @@ -12,8 +10,6 @@ package(
features = ["layering_check"],
)

npm_link_all_packages(name = "node_modules")

cc_library(
name = "web",
srcs = [
Expand Down Expand Up @@ -92,6 +88,11 @@ tcl_encode(
namespace = "web",
)

filegroup(
name = "js_files",
srcs = glob(["src/*.js"]),
)
Comment on lines +91 to +94
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better encapsulation, consider restricting the visibility of this filegroup. Since these JavaScript files are only used for tests in //src/web/test, a more specific visibility like visibility = ["//src/web/test:__pkg__"] would be more appropriate than the package's default visibility.

Suggested change
filegroup(
name = "js_files",
srcs = glob(["src/*.js"]),
)
filegroup(
name = "js_files",
srcs = glob(["src/*.js"]),
visibility = ["//src/web/test:__pkg__"],
)


tcl_wrap_cc(
name = "swig",
srcs = [
Expand All @@ -108,9 +109,3 @@ tcl_wrap_cc(
"//src/odb:swig",
],
)

js_library(
name = "js_sources",
srcs = glob(["src/*.js"]),
visibility = ["//src/web:__subpackages__"],
)
62 changes: 30 additions & 32 deletions src/web/test/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@aspect_rules_js//js:defs.bzl", "js_test")
load("@npm//:defs.bzl", "npm_link_all_packages")

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022-2026, The OpenROAD Authors
Expand All @@ -7,6 +8,8 @@ load("//test:regression.bzl", "regression_test")

package(features = ["layering_check"])

npm_link_all_packages(name = "node_modules")

TESTS = [
]

Expand All @@ -33,86 +36,81 @@ filegroup(
data = [":test_resources"],
) for test_name in TESTS]

JS_FILES = ["//src/web:js_files"]

DOM_TEST_DATA = [
"js/setup-dom.js",
":node_modules/jsdom",
] + JS_FILES

js_test(
name = "coordinates_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-coordinates.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "vis_tree_test",
data = [
"js/setup-dom.js",
"//src/web:js_sources",
"//src/web:node_modules/jsdom",
],
data = DOM_TEST_DATA,
entry_point = "js/test-vis-tree.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "websocket_manager_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-websocket-manager.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "checkbox_tree_model_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-checkbox-tree-model.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "display_controls_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-display-controls.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "clock_tree_widget_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-clock-tree-widget.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "charts_widget_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-charts-widget.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "inspector_test",
data = [
"js/setup-dom.js",
"//src/web:js_sources",
"//src/web:node_modules/jsdom",
],
data = DOM_TEST_DATA,
entry_point = "js/test-inspector.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "ruler_test",
data = ["//src/web:js_sources"],
data = JS_FILES,
entry_point = "js/test-ruler.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

js_test(
name = "tcl_completer_test",
data = [
"js/setup-dom.js",
"//src/web:js_sources",
"//src/web:node_modules/jsdom",
],
data = DOM_TEST_DATA,
entry_point = "js/test-tcl-completer.js",
no_copy_to_bin = ["//src/web:js_sources"],
no_copy_to_bin = JS_FILES,
)

cc_test(
Expand Down
File renamed without changes.
File renamed without changes.
Loading