blob: 97a86f3e74c27360a39617a94902502c83400629 [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
Sean Condone4e8f6a2020-04-13 10:30:35 +010017load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package")
Sean Condon98b6ddb2019-12-24 08:07:40 +000018load("@npm_bazel_typescript//:index.bzl", "ts_library")
Sean Condone4e8f6a2020-04-13 10:30:35 +010019load("@npm_bazel_karma//:index.bzl", "karma_web_test")
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([
Sean Condon3dd062f2020-04-14 09:25:00 +010043 "lib/**/*.css",
44 "lib/**/*.html",
Sean Condon98b6ddb2019-12-24 08:07:40 +000045 ]),
Sean Condon3dd062f2020-04-14 09:25:00 +010046 entry_point = ":public_api.ts",
Sean Condona3ad7792020-01-04 19:26:34 +000047 tsconfig = "//web/gui2:tsconfig.json",
Sean Condon98b6ddb2019-12-24 08:07:40 +000048 deps = [
49 "@npm//@angular/animations",
50 "@npm//@angular/common",
51 "@npm//@angular/platform-browser",
52 "@npm//@angular/router",
53 "@npm//d3",
54 "@npm//rxjs",
55 ],
56)
57
Sean Condona3ad7792020-01-04 19:26:34 +000058ts_library(
59 name = "test_lib",
60 testonly = 1,
61 srcs = glob(
62 include = ["**/*.spec.ts"],
63 # TODO re-enable this test
64 exclude = ["lib/nav/nav.service.spec.ts"],
65 ),
66 tsconfig = "//web/gui2:tsconfig-test",
67 deps = [
68 ":gui2-fw-lib",
69 "@npm//@angular/common",
70 "@npm//@angular/core",
71 "@npm//@angular/forms",
Sean Condona3ad7792020-01-04 19:26:34 +000072 "@npm//@angular/platform-browser",
73 "@npm//@angular/router",
74 "@npm//@types/jasmine",
75 "@npm//rxjs",
76 ],
77)
78
Sean Condone4e8f6a2020-04-13 10:30:35 +010079karma_web_test(
Sean Condona3ad7792020-01-04 19:26:34 +000080 name = "test",
81 srcs = [
82 # We are manaully adding the bazel generated named-UMD d3 bundle here as
83 # named-UMD bundles for non-APF npm packages are not yet automatically added.
84 # This file is generated by the npm_umd_bundle @npm//d3
85 # rule that is setup by yarn_install.
86 ],
87 # do not sort
88 bootstrap = [
89 "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",
90 "@npm//:node_modules/reflect-metadata/Reflect.js",
91 ],
Andrea Campanella0fa87872020-01-10 18:13:43 +010092 # browsers = [
93 # "@io_bazel_rules_webtesting//browsers:chromium-local",
94 # "@io_bazel_rules_webtesting//browsers:firefox-local",
95 # ],
Sean Condona3ad7792020-01-04 19:26:34 +000096 tags = ["native"],
97 runtime_deps = [
98 "//web/gui2/src/main/webapp:initialize_testbed",
99 ],
100 deps = [
101 ":test_lib",
102 "//web/gui:src/main/webapp/data",
103 "//web/gui2/src/main/webapp:d3_requirejs",
104 "//web/gui2/src/main/webapp:rxjs_umd_modules",
105 ],
106)
Sean Condone4e8f6a2020-04-13 10:30:35 +0100107
Sean Condon3dd062f2020-04-14 09:25:00 +0100108# bazel run //web/gui2-fw-lib:npm_package.pack to create a tgz
Sean Condone4e8f6a2020-04-13 10:30:35 +0100109ng_package(
110 name = "npm_package",
111 srcs = ["package.json"],
112 data = glob([
113 "**/*.css",
114 "**/*.html",
115 ]),
Sean Condon3dd062f2020-04-14 09:25:00 +0100116 entry_point = ":public_api.ts",
Sean Condone4e8f6a2020-04-13 10:30:35 +0100117 include_devmode_srcs = False,
118 readme_md = ":README.md",
119 deps = [
120 ":gui2-fw-lib",
121 ],
122)