| load("@aspect_rules_ts//ts:defs.bzl", "ts_config", "ts_project") | |
| load("@com_googlesource_gerrit_bazlets//js:defs.bzl", "gerrit_js_bundle") | |
| load("//tools/js:eslint.bzl", "plugin_eslint") | |
| load("//tools/bzl:js.bzl", "web_test_runner") | |
| package_group( | |
| name = "visibility", | |
| packages = [ | |
| "//plugins", | |
| "//plugins/codemirror-editor/...", | |
| ], | |
| ) | |
| package(default_visibility = [":visibility"]) | |
| ts_config( | |
| name = "tsconfig", | |
| src = "tsconfig.json", | |
| deps = [ | |
| "//plugins:tsconfig-plugins-base", | |
| ], | |
| ) | |
| ts_project( | |
| name = "codemirror-editor-ts", | |
| srcs = glob( | |
| ["*.ts"], | |
| exclude = ["**/*test*"], | |
| ), | |
| incremental = True, | |
| out_dir = "_bazel_ts_out", | |
| tsconfig = ":tsconfig", | |
| deps = [ | |
| "//plugins:node_modules", | |
| ], | |
| ) | |
| gerrit_js_bundle( | |
| name = "codemirror_editor", | |
| srcs = [":codemirror-editor-ts"], | |
| entry_point = "_bazel_ts_out/plugin.js", | |
| ) | |
| ts_project( | |
| name = "codemirror-element-ts", | |
| srcs = glob( | |
| ["element/*.ts"], | |
| exclude = ["**/*test*"], | |
| ), | |
| incremental = True, | |
| out_dir = "_bazel_ts_out", | |
| tsconfig = ":tsconfig", | |
| deps = [ | |
| "//plugins:node_modules", | |
| ], | |
| ) | |
| ts_project( | |
| name = "codemirror-editor-ts-tests", | |
| srcs = glob(["**/*.ts"]), | |
| incremental = True, | |
| out_dir = "_bazel_ts_out_tests", | |
| tsconfig = ":tsconfig", | |
| deps = [ | |
| "//plugins:node_modules", | |
| "//polygerrit-ui:node_modules", | |
| ], | |
| ) | |
| gerrit_js_bundle( | |
| name = "codemirror_element", | |
| srcs = [":codemirror-element-ts"], | |
| entry_point = "_bazel_ts_out/element/entry-point.js", | |
| ) | |
| # These are the test sources for the web-test-runner test in plugins/BUILD. | |
| # Run the tests with `bazel test plugins:web-test-runner`. | |
| filegroup( | |
| name = "codemirror-test-sources", | |
| srcs = glob( | |
| [ | |
| "**/*.ts", | |
| "**/tsconfig.json", | |
| ], | |
| ), | |
| ) | |
| # Run the lint tests with `bazel test plugins/codemirror-editor/web:lint_test`. | |
| plugin_eslint() | |
| # Run the lint tests with `bazel test plugins/codemirror-editor/web:web_test_runner`. | |
| web_test_runner( | |
| name = "web_test_runner", | |
| srcs = ["web_test_runner.sh"], | |
| data = [ | |
| ":codemirror-editor-ts-tests", | |
| ":tsconfig", | |
| "//plugins:node_modules", | |
| "//polygerrit-ui:node_modules", | |
| ], | |
| ) |