Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 1 | """ |
| 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 | |
| 17 | load("@npm_angular_bazel//:index.bzl", "ng_module") |
| 18 | load("@npm_bazel_typescript//:index.bzl", "ts_library") |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 19 | load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite") |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 20 | |
| 21 | package(default_visibility = ["//:__subpackages__"]) |
| 22 | |
| 23 | exports_files(["lib/widget/panel.css"]) |
| 24 | |
| 25 | # We don't import from these, but the generated ngfactory code will |
| 26 | NG_FACTORY_ADDED_IMPORTS = [ |
| 27 | "@npm//@angular/animations", |
| 28 | "@npm//@angular/forms", |
| 29 | ] |
| 30 | |
| 31 | ng_module( |
| 32 | name = "gui2-fw-lib", |
| 33 | srcs = glob( |
| 34 | include = [ |
| 35 | "**/*.ts", |
| 36 | "public_api.ts", |
| 37 | ], |
| 38 | exclude = [ |
| 39 | "**/*.spec.ts", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 40 | ], |
| 41 | ), |
| 42 | assets = glob([ |
| 43 | "src/lib/**/*.css", |
| 44 | "src/lib/**/*.html", |
| 45 | ]), |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 46 | entry_point = ":src/public_api.ts", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 47 | module_name = "gui2-fw-lib", |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 48 | tsconfig = "//web/gui2:tsconfig.json", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 49 | 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 Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 59 | ts_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 Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 73 | "@npm//@angular/platform-browser", |
| 74 | "@npm//@angular/router", |
| 75 | "@npm//@types/jasmine", |
| 76 | "@npm//rxjs", |
| 77 | ], |
| 78 | ) |
| 79 | |
| 80 | karma_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 Campanella | 0fa8787 | 2020-01-10 18:13:43 +0100 | [diff] [blame] | 93 | # browsers = [ |
| 94 | # "@io_bazel_rules_webtesting//browsers:chromium-local", |
| 95 | # "@io_bazel_rules_webtesting//browsers:firefox-local", |
| 96 | # ], |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 97 | 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 | ) |