blob: a28abd326c392aaac03265eb723a8374b4513f9e [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",
73 "@npm//@angular/http",
74 "@npm//@angular/platform-browser",
75 "@npm//@angular/router",
76 "@npm//@types/jasmine",
77 "@npm//rxjs",
78 ],
79)
80
81karma_web_test_suite(
82 name = "test",
83 srcs = [
84 # We are manaully adding the bazel generated named-UMD d3 bundle here as
85 # named-UMD bundles for non-APF npm packages are not yet automatically added.
86 # This file is generated by the npm_umd_bundle @npm//d3
87 # rule that is setup by yarn_install.
88 ],
89 # do not sort
90 bootstrap = [
91 "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",
92 "@npm//:node_modules/reflect-metadata/Reflect.js",
93 ],
Andrea Campanella0fa87872020-01-10 18:13:43 +010094 # browsers = [
95 # "@io_bazel_rules_webtesting//browsers:chromium-local",
96 # "@io_bazel_rules_webtesting//browsers:firefox-local",
97 # ],
Sean Condona3ad7792020-01-04 19:26:34 +000098 tags = ["native"],
99 runtime_deps = [
100 "//web/gui2/src/main/webapp:initialize_testbed",
101 ],
102 deps = [
103 ":test_lib",
104 "//web/gui:src/main/webapp/data",
105 "//web/gui2/src/main/webapp:d3_requirejs",
106 "//web/gui2/src/main/webapp:rxjs_umd_modules",
107 ],
108)