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 | ]), |
| 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 Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 51 | tsconfig = "//web/gui2:tsconfig.json", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 52 | 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 Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 62 | ts_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 | |
| 84 | karma_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 | ], |
| 97 | browsers = [ |
| 98 | # "@io_bazel_rules_webtesting//browsers:chromium-local", |
| 99 | "@io_bazel_rules_webtesting//browsers:firefox-local", |
| 100 | ], |
| 101 | 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 | ) |