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 | |
Sean Condon | 59323be | 2020-04-13 10:30:35 +0100 | [diff] [blame] | 17 | load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package") |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 18 | load("@npm_bazel_typescript//:index.bzl", "ts_library") |
Sean Condon | 59323be | 2020-04-13 10:30:35 +0100 | [diff] [blame] | 19 | load("@npm_bazel_karma//:index.bzl", "karma_web_test") |
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([ |
Sean Condon | 3b3fdab | 2020-04-14 09:25:00 +0100 | [diff] [blame] | 43 | "lib/**/*.css", |
| 44 | "lib/**/*.html", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 45 | ]), |
Sean Condon | 3b3fdab | 2020-04-14 09:25:00 +0100 | [diff] [blame] | 46 | entry_point = ":public_api.ts", |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 47 | tsconfig = "//web/gui2:tsconfig.json", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 48 | 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 Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 58 | ts_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 Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 72 | "@npm//@angular/platform-browser", |
| 73 | "@npm//@angular/router", |
| 74 | "@npm//@types/jasmine", |
| 75 | "@npm//rxjs", |
| 76 | ], |
| 77 | ) |
| 78 | |
Sean Condon | 59323be | 2020-04-13 10:30:35 +0100 | [diff] [blame] | 79 | karma_web_test( |
Sean Condon | 5b417fb | 2020-04-14 15:10:03 +0100 | [diff] [blame] | 80 | name = "test-not-coverage", # coverage is to avoid being picked up by 'ot' alias |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 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 | ], |
Sean Condon | 5b417fb | 2020-04-14 15:10:03 +0100 | [diff] [blame] | 92 | config_file = "//web/gui2/src/main/webapp:karma.conf.js", |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 93 | 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 Condon | 5b417fb | 2020-04-14 15:10:03 +0100 | [diff] [blame] | 102 | "@npm//@angular-devkit/build-angular", |
| 103 | "@npm//karma-coverage-istanbul-reporter", |
| 104 | "@npm//karma-jasmine-html-reporter", |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 105 | ], |
| 106 | ) |
Sean Condon | 59323be | 2020-04-13 10:30:35 +0100 | [diff] [blame] | 107 | |
Sean Condon | 3b3fdab | 2020-04-14 09:25:00 +0100 | [diff] [blame] | 108 | # bazel run //web/gui2-fw-lib:npm_package.pack to create a tgz |
Sean Condon | 59323be | 2020-04-13 10:30:35 +0100 | [diff] [blame] | 109 | ng_package( |
| 110 | name = "npm_package", |
| 111 | srcs = ["package.json"], |
| 112 | data = glob([ |
| 113 | "**/*.css", |
| 114 | "**/*.html", |
| 115 | ]), |
Sean Condon | 3b3fdab | 2020-04-14 09:25:00 +0100 | [diff] [blame] | 116 | entry_point = ":public_api.ts", |
Sean Condon | 59323be | 2020-04-13 10:30:35 +0100 | [diff] [blame] | 117 | include_devmode_srcs = False, |
| 118 | readme_md = ":README.md", |
| 119 | deps = [ |
| 120 | ":gui2-fw-lib", |
| 121 | ], |
| 122 | ) |