blob: 5317f34717f9c390f9e23f7bf8f0fc8e93931deb [file] [log] [blame]
Sean Condon98b6ddb2019-12-24 08:07:40 +00001"""
2 Copyright 2020-present Open Networking Foundation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15"""
16
17load("@npm_angular_bazel//:index.bzl", "ng_module")
18load("@npm_bazel_typescript//:index.bzl", "ts_library")
Sean Condona3ad7792020-01-04 19:26:34 +000019load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
Sean Condon98b6ddb2019-12-24 08:07:40 +000020
21package(default_visibility = ["//:__subpackages__"])
22
23exports_files(["lib/widget/panel.css"])
24
25# We don't import from these, but the generated ngfactory code will
26NG_FACTORY_ADDED_IMPORTS = [
27 "@npm//@angular/animations",
28 "@npm//@angular/forms",
29]
30
31ng_module(
32 name = "gui2-fw-lib",
33 srcs = glob(
34 include = [
35 "**/*.ts",
36 "public_api.ts",
37 ],
38 exclude = [
39 "**/*.spec.ts",
Sean Condon98b6ddb2019-12-24 08:07:40 +000040 ],
41 ),
42 assets = glob([
43 "src/lib/**/*.css",
44 "src/lib/**/*.html",
45 ]),
Sean Condon98b6ddb2019-12-24 08:07:40 +000046 entry_point = ":src/public_api.ts",
Sean Condon98b6ddb2019-12-24 08:07:40 +000047 module_name = "gui2-fw-lib",
Sean Condona3ad7792020-01-04 19:26:34 +000048 tsconfig = "//web/gui2:tsconfig.json",
Sean Condon98b6ddb2019-12-24 08:07:40 +000049 deps = [
50 "@npm//@angular/animations",
51 "@npm//@angular/common",
52 "@npm//@angular/platform-browser",
53 "@npm//@angular/router",
54 "@npm//d3",
55 "@npm//rxjs",
56 ],
57)
58
Sean Condona3ad7792020-01-04 19:26:34 +000059ts_library(
60 name = "test_lib",
61 testonly = 1,
62 srcs = glob(
63 include = ["**/*.spec.ts"],
64 # TODO re-enable this test
65 exclude = ["lib/nav/nav.service.spec.ts"],
66 ),
67 tsconfig = "//web/gui2:tsconfig-test",
68 deps = [
69 ":gui2-fw-lib",
70 "@npm//@angular/common",
71 "@npm//@angular/core",
72 "@npm//@angular/forms",
Sean Condona3ad7792020-01-04 19:26:34 +000073 "@npm//@angular/platform-browser",
74 "@npm//@angular/router",
75 "@npm//@types/jasmine",
76 "@npm//rxjs",
77 ],
78)
79
80karma_web_test_suite(
81 name = "test",
82 srcs = [
83 # We are manaully adding the bazel generated named-UMD d3 bundle here as
84 # named-UMD bundles for non-APF npm packages are not yet automatically added.
85 # This file is generated by the npm_umd_bundle @npm//d3
86 # rule that is setup by yarn_install.
87 ],
88 # do not sort
89 bootstrap = [
90 "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",
91 "@npm//:node_modules/reflect-metadata/Reflect.js",
92 ],
Andrea Campanella0fa87872020-01-10 18:13:43 +010093 # browsers = [
94 # "@io_bazel_rules_webtesting//browsers:chromium-local",
95 # "@io_bazel_rules_webtesting//browsers:firefox-local",
96 # ],
Sean Condona3ad7792020-01-04 19:26:34 +000097 tags = ["native"],
98 runtime_deps = [
99 "//web/gui2/src/main/webapp:initialize_testbed",
100 ],
101 deps = [
102 ":test_lib",
103 "//web/gui:src/main/webapp/data",
104 "//web/gui2/src/main/webapp:d3_requirejs",
105 "//web/gui2/src/main/webapp:rxjs_umd_modules",
106 ],
107)