blob: 30df3be8ea50632c68b242eac987470fc642c740 [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 Condon59323be2020-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 Condon59323be2020-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 Condon3b3fdab2020-04-14 09:25:00 +010043 "lib/**/*.css",
44 "lib/**/*.html",
Sean Condon98b6ddb2019-12-24 08:07:40 +000045 ]),
Sean Condon3b3fdab2020-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 Condon59323be2020-04-13 10:30:35 +010079karma_web_test(
Sean Condon5b417fb2020-04-14 15:10:03 +010080 name = "test-not-coverage", # coverage is to avoid being picked up by 'ot' alias
Sean Condona3ad7792020-01-04 19:26:34 +000081 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 ],
Sean Condon5b417fb2020-04-14 15:10:03 +010092 config_file = "//web/gui2/src/main/webapp:karma.conf.js",
Sean Condona3ad7792020-01-04 19:26:34 +000093 tags = ["native"],
94 runtime_deps = [
95 "//web/gui2/src/main/webapp:initialize_testbed",
96 ],
97 deps = [
98 ":test_lib",
99 "//web/gui:src/main/webapp/data",
100 "//web/gui2/src/main/webapp:d3_requirejs",
101 "//web/gui2/src/main/webapp:rxjs_umd_modules",
Sean Condon5b417fb2020-04-14 15:10:03 +0100102 "@npm//@angular-devkit/build-angular",
103 "@npm//karma-coverage-istanbul-reporter",
104 "@npm//karma-jasmine-html-reporter",
Sean Condona3ad7792020-01-04 19:26:34 +0000105 ],
106)
Sean Condon59323be2020-04-13 10:30:35 +0100107
Sean Condon3b3fdab2020-04-14 09:25:00 +0100108# bazel run //web/gui2-fw-lib:npm_package.pack to create a tgz
Sean Condon59323be2020-04-13 10:30:35 +0100109ng_package(
110 name = "npm_package",
111 srcs = ["package.json"],
112 data = glob([
113 "**/*.css",
114 "**/*.html",
115 ]),
Sean Condon3b3fdab2020-04-14 09:25:00 +0100116 entry_point = ":public_api.ts",
Sean Condon59323be2020-04-13 10:30:35 +0100117 include_devmode_srcs = False,
118 readme_md = ":README.md",
119 deps = [
120 ":gui2-fw-lib",
121 ],
122)