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
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ esbuild_repositories(npm_repository = "npm")
# rules_sass release information is difficult to find but it does seem to
# regularly release with same cadence and version as core sass.
# We typically upgrade this library whenever we upgrade rules_nodejs.
# The version used here is the most recent release as of 2023-07-11, which is the same version used by rules_nodejs 5.8.1.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The version used here is the most recent release as of 2023-07-11

I think it's uncommon to say most recent as of <a date in the past>, although perhaps technically correct (?).

Can we rephrase to say something like "This version was the latest one available when rules_nodejs 5.8.1 was released, so we use it because we know they're compatible", or "This version is used by rules_nodejs 5.8.1", or something like that.

#
# rules_sass 1.55.0: https://github.com/bazelbuild/rules_sass/tree/1.55.0
# rules_sass: https://github.com/bazelbuild/rules_sass/tags
http_archive(
name = "io_bazel_rules_sass",
sha256 = "1ea0103fa6adcb7d43ff26373b5082efe1d4b2e09c4f34f8a8f8b351e9a8a9b0",
strip_prefix = "rules_sass-1.55.0",
sha256 = "4285781b24dfd07cb01fcc2324faec87818d0f2174b02e0ed9038f6f809de80a",
strip_prefix = "rules_sass-1.69.5",
urls = [
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_sass/archive/1.55.0.zip",
"https://github.com/bazelbuild/rules_sass/archive/1.55.0.zip",
"https://github.com/bazelbuild/rules_sass/archive/refs/tags/1.69.5.tar.gz",
],
)

Expand Down
39 changes: 0 additions & 39 deletions tensorboard/defs/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -249,45 +249,6 @@ def tf_svg_bundle(name, srcs, out):
],
)

def tf_sass_binary(deps = [], include_paths = [], strict_deps = True, **kwargs):
"""TensorBoard wrap for declaring SASS binary.

It adds dependency on theme by default then add include Angular material
theme library paths for better node_modules library resolution.

strict_deps is included here and intentionally ignored so it can be used
internally.
"""
sass_binary(
deps = deps,
include_paths = include_paths + [
"external/npm/node_modules",
],
sourcemap = False,
**kwargs
)

def tf_sass_library(**kwargs):
"""TensorBoard wrap for declaring SASS library.

It re-exports the sass_libray symbol so users do not have to depend on
"@io_bazel_rules_sass//:defs.bzl".
"""
sass_library(
**kwargs
)

def tf_external_sass_libray(**kwargs):
"""TensorBoard wrapper for declaring external SASS dependency.

When an external (NPM) package have SASS files that has `import` statements,
TensorBoard has to depdend on them very specifically. This rule allows SASS
modules in NPM packages to be built properly.
"""
npm_sass_library(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can also remove the "load" statement at the top for these rules.

**kwargs
)

def tf_ng_module(assets = [], **kwargs):
"""TensorBoard wrapper for Angular modules."""
tf_ts_library(
Expand Down
6 changes: 4 additions & 2 deletions tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/BUILD
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ng_web_test_suite", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("@rules_python//python:py_binary.bzl", "py_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ng_web_test_suite", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "debugger_component_style",
src = "debugger_component.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("//tensorboard/defs:defs.bzl", "tf_sass_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_library(
sass_library(
name = "style_lib",
srcs = ["_lib.scss"],
deps = ["//tensorboard/webapp:angular_material_sass_deps"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "execution_data_styles",
src = "execution_data_component.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/webapp:angular_material_sass_deps",
"//tensorboard/webapp/theme",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "graph_styles",
src = "graph_component.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/common:style_lib",
"//tensorboard/webapp/theme",
],
)

tf_sass_binary(
sass_binary(
name = "graph_op_styles",
src = "graph_op_component.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/common:style_lib",
"//tensorboard/webapp:angular_material_sass_deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "graph_executions_styles",
src = "graph_executions_component.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/common:style_lib",
"//tensorboard/webapp/theme",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "source_files_component_style",
src = "source_files_component.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "stack_trace_styles",
src = "stack_trace_component.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/common:style_lib",
"//tensorboard/webapp/theme",
Expand Down
11 changes: 7 additions & 4 deletions tensorboard/webapp/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("//tensorboard/defs:defs.bzl", "tf_external_sass_libray", "tf_ng_module", "tf_ng_prod_js_binary", "tf_ng_web_test_suite", "tf_sass_binary", "tf_svg_bundle", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "npm_sass_library", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ng_prod_js_binary", "tf_ng_web_test_suite", "tf_svg_bundle", "tf_ts_library")
load("//tensorboard/defs:js.bzl", "tf_resource_digest_suffixer")
load("//tensorboard/defs:web.bzl", "tb_combine_html", "tf_web_library")

Expand Down Expand Up @@ -86,9 +87,10 @@ tf_ts_library(
],
)

tf_sass_binary(
sass_binary(
name = "app_styles",
src = "app_container.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)

Expand Down Expand Up @@ -379,13 +381,14 @@ tf_svg_bundle(
out = "icon_bundle.svg",
)

tf_external_sass_libray(
npm_sass_library(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this rule is not available internally. We might need to either in-line this dependency wherever it's used, or modify this to be a plain "sass_library", which AFAIU would require creating a file that @forwards whatever is used from this dependency.

The downside of in-lining it everywhere would be that if at some point we need or want another common dependency everywhere where this one is used, then we'd have to do that manually, or recreate this wrapper at that time and update all references anyway.

This sass_library wrapper would be useful to not have to update every place where this is currently used in that case, although I think that's somewhat unlikely.

Up to you, either way is fine by me.

name = "angular_material_sass_deps",
deps = ["@npm//@angular/material"],
)

tf_sass_binary(
sass_binary(
name = "styles",
src = "styles.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)
6 changes: 4 additions & 2 deletions tensorboard/webapp/alert/views/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

tf_sass_binary(
sass_binary(
name = "alert_display_snackbar_styles",
src = "alert_display_snackbar_container.scss",
include_paths = ["external/npm/node_modules"],
)

tf_ng_module(
Expand Down
6 changes: 4 additions & 2 deletions tensorboard/webapp/core/views/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

tf_sass_binary(
sass_binary(
name = "layout_styles",
src = "layout_container.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)

Expand Down
6 changes: 4 additions & 2 deletions tensorboard/webapp/feature_flag/views/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "style",
src = "feature_flag_dialog_component.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/webapp:angular_material_sass_deps",
"//tensorboard/webapp/theme",
Expand Down
9 changes: 6 additions & 3 deletions tensorboard/webapp/header/BUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

licenses(["notice"])

tf_sass_binary(
sass_binary(
name = "plugin_selector_styles",
src = "plugin_selector_component.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)

tf_sass_binary(
sass_binary(
name = "header_styles",
src = "header_component.scss",
include_paths = ["external/npm/node_modules"],
deps = ["//tensorboard/webapp/theme"],
)

Expand Down
8 changes: 5 additions & 3 deletions tensorboard/webapp/metrics/views/BUILD
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary", "tf_sass_library", "tf_ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_ts_library")

package(default_visibility = ["//tensorboard:internal"])

tf_sass_library(
sass_library(
name = "metrics_common_styles",
srcs = [
"_common.scss",
],
)

tf_sass_binary(
sass_binary(
name = "metrics_container_styles",
src = "metrics_container.scss",
include_paths = ["external/npm/node_modules"],
deps = [
"//tensorboard/webapp:angular_material_sass_deps",
"//tensorboard/webapp/theme",
Expand Down
Loading
Loading