blob: a5c5b9600817b421515d82191458ee8e00707166 [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 ]),
46 bundle_dts = True,
47 entry_point = ":src/public_api.ts",
48 # tsconfig = "tsconfig.json",
49 generate_ve_shims = True,
50 module_name = "gui2-fw-lib",
Sean Condona3ad7792020-01-04 19:26:34 +000051 tsconfig = "//web/gui2:tsconfig.json",
Sean Condon98b6ddb2019-12-24 08:07:40 +000052 deps = [
53 "@npm//@angular/animations",
54 "@npm//@angular/common",
55 "@npm//@angular/platform-browser",
56 "@npm//@angular/router",
57 "@npm//d3",
58 "@npm//rxjs",
59 ],
60)
61
Sean Condona3ad7792020-01-04 19:26:34 +000062ts_library(
63 name = "test_lib",
64 testonly = 1,
65 srcs = glob(
66 include = ["**/*.spec.ts"],
67 # TODO re-enable this test
68 exclude = ["lib/nav/nav.service.spec.ts"],
69 ),
70 tsconfig = "//web/gui2:tsconfig-test",
71 deps = [
72 ":gui2-fw-lib",
73 "@npm//@angular/common",
74 "@npm//@angular/core",
75 "@npm//@angular/forms",
76 "@npm//@angular/http",
77 "@npm//@angular/platform-browser",
78 "@npm//@angular/router",
79 "@npm//@types/jasmine",
80 "@npm//rxjs",
81 ],
82)
83
84karma_web_test_suite(
85 name = "test",
86 srcs = [
87 # We are manaully adding the bazel generated named-UMD d3 bundle here as
88 # named-UMD bundles for non-APF npm packages are not yet automatically added.
89 # This file is generated by the npm_umd_bundle @npm//d3
90 # rule that is setup by yarn_install.
91 ],
92 # do not sort
93 bootstrap = [
94 "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",
95 "@npm//:node_modules/reflect-metadata/Reflect.js",
96 ],
Andrea Campanella0fa87872020-01-10 18:13:43 +010097 # browsers = [
98 # "@io_bazel_rules_webtesting//browsers:chromium-local",
99 # "@io_bazel_rules_webtesting//browsers:firefox-local",
100 # ],
Sean Condona3ad7792020-01-04 19:26:34 +0000101 tags = ["native"],
102 runtime_deps = [
103 "//web/gui2/src/main/webapp:initialize_testbed",
104 ],
105 deps = [
106 ":test_lib",
107 "//web/gui:src/main/webapp/data",
108 "//web/gui2/src/main/webapp:d3_requirejs",
109 "//web/gui2/src/main/webapp:rxjs_umd_modules",
110 ],
111)