blob: 97a86f3e74c27360a39617a94902502c83400629 [file] [log] [blame]
"""
Copyright 2020-present Open Networking Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("@npm_bazel_karma//:index.bzl", "karma_web_test")
package(default_visibility = ["//:__subpackages__"])
exports_files(["lib/widget/panel.css"])
# We don't import from these, but the generated ngfactory code will
NG_FACTORY_ADDED_IMPORTS = [
"@npm//@angular/animations",
"@npm//@angular/forms",
]
ng_module(
name = "gui2-fw-lib",
srcs = glob(
include = [
"**/*.ts",
"public_api.ts",
],
exclude = [
"**/*.spec.ts",
],
),
assets = glob([
"lib/**/*.css",
"lib/**/*.html",
]),
entry_point = ":public_api.ts",
tsconfig = "//web/gui2:tsconfig.json",
deps = [
"@npm//@angular/animations",
"@npm//@angular/common",
"@npm//@angular/platform-browser",
"@npm//@angular/router",
"@npm//d3",
"@npm//rxjs",
],
)
ts_library(
name = "test_lib",
testonly = 1,
srcs = glob(
include = ["**/*.spec.ts"],
# TODO re-enable this test
exclude = ["lib/nav/nav.service.spec.ts"],
),
tsconfig = "//web/gui2:tsconfig-test",
deps = [
":gui2-fw-lib",
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/forms",
"@npm//@angular/platform-browser",
"@npm//@angular/router",
"@npm//@types/jasmine",
"@npm//rxjs",
],
)
karma_web_test(
name = "test",
srcs = [
# We are manaully adding the bazel generated named-UMD d3 bundle here as
# named-UMD bundles for non-APF npm packages are not yet automatically added.
# This file is generated by the npm_umd_bundle @npm//d3
# rule that is setup by yarn_install.
],
# do not sort
bootstrap = [
"@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",
"@npm//:node_modules/reflect-metadata/Reflect.js",
],
# browsers = [
# "@io_bazel_rules_webtesting//browsers:chromium-local",
# "@io_bazel_rules_webtesting//browsers:firefox-local",
# ],
tags = ["native"],
runtime_deps = [
"//web/gui2/src/main/webapp:initialize_testbed",
],
deps = [
":test_lib",
"//web/gui:src/main/webapp/data",
"//web/gui2/src/main/webapp:d3_requirejs",
"//web/gui2/src/main/webapp:rxjs_umd_modules",
],
)
# bazel run //web/gui2-fw-lib:npm_package.pack to create a tgz
ng_package(
name = "npm_package",
srcs = ["package.json"],
data = glob([
"**/*.css",
"**/*.html",
]),
entry_point = ":public_api.ts",
include_devmode_srcs = False,
readme_md = ":README.md",
deps = [
":gui2-fw-lib",
],
)