| package(default_visibility = ["//visibility:public"]) |
| |
| load("//tools/build/bazel:jdk_genrule.bzl", "jdk_genrule") |
| load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package") |
| load("@npm_bazel_karma//:index.bzl", "ts_web_test_suite") |
| load("@npm_bazel_typescript//:index.bzl", "ts_devserver", "ts_library") |
| |
| ng_module( |
| name = "gui2-fw-lib", |
| srcs = glob( |
| include = [ |
| "src/lib/**/*.ts", |
| "src/environments/environment*ts", |
| "src/public_api.ts", |
| ], |
| exclude = [ |
| "**/*.spec.ts", |
| "src/test.ts", |
| "initialize_testbed.ts", |
| ], |
| ), |
| assets = glob([ |
| "src/lib/**/*.css", |
| "src/lib/**/*.html", |
| ]), |
| data = [ |
| ":tsconfig.lib.json", |
| ], |
| entry_point = ":src/public_api.ts", |
| module_name = "gui2-fw-lib", |
| tsconfig = "tsconfig.json", |
| deps = [ |
| "@npm//@angular/animations", |
| "@npm//@angular/core", |
| "@npm//@angular/platform-browser-dynamic", |
| "@npm//@angular/router", |
| "@npm//@types", |
| "@npm//d3", |
| "@npm//rxjs", |
| ], |
| ) |
| |
| filegroup( |
| name = "rxjs_umd_modules", |
| srcs = [ |
| # do not sort |
| "@npm//:node_modules/rxjs/bundles/rxjs.umd.js", |
| ":rxjs_shims.js", |
| ], |
| ) |
| |
| ts_library( |
| name = "test_lib", |
| testonly = 1, |
| srcs = glob(["**/*.spec.ts"]), |
| deps = [ |
| ":gui2-fw-lib", |
| "@npm//@angular/common", |
| "@npm//@angular/core", |
| "@npm//@angular/platform-browser", |
| "@npm//@angular/router", |
| "@npm//@types", |
| "@npm//rxjs", |
| ], |
| ) |
| |
| ts_library( |
| name = "initialize_testbed", |
| testonly = 1, |
| srcs = [ |
| "initialize_testbed.ts", |
| ], |
| deps = [ |
| "@npm//@angular/core", |
| "@npm//@angular/platform-browser-dynamic", |
| "@npm//@types", |
| ], |
| ) |
| |
| ng_package( |
| name = "gui2-fw-lib-pkg", |
| srcs = [ |
| "package.json", |
| ], |
| data = glob( |
| include = [ |
| "src/assets/**", |
| ], |
| exclude = [ |
| "**/*.spec.ts", |
| ], |
| ), |
| entry_point = ":src/public-api.ts", # In reality this is ignored and index.ts is used |
| # include_devmode_srcs = False, |
| readme_md = "README.md", |
| deps = [ |
| ":gui2-fw-lib", |
| "@npm//@angular/animations", |
| "@npm//@angular/common", |
| "@npm//@angular/core", |
| "@npm//@angular/platform-browser-dynamic", |
| "@npm//@angular/router", |
| "@npm//@types", |
| "@npm//d3", |
| "@npm//rxjs", |
| ], |
| ) |
| |
| genrule( |
| name = "onos-gui2-fw-ng-build", |
| srcs = [ |
| ":gui2-fw-lib-pkg", |
| ], |
| outs = [ |
| "gui2-fw-ng-build-prod.log", |
| "gui2-fw-lib-ver.tgz", |
| ], |
| cmd = "ROOT=`pwd` &&" + |
| " mkdir -p package &&" + |
| " cp -r bazel-out/k8-fastbuild/bin/web/gui2-fw-lib/projects/gui2-fw-lib/gui2-fw-lib-pkg/* package &&" + |
| " tar -czhf $$ROOT/$(location gui2-fw-lib-ver.tgz) package &&" + |
| " touch $$ROOT/$(location gui2-fw-ng-build-prod.log)", # to get the log always as the 2nd file |
| message = "GUI FW Lib build", |
| visibility = ["//visibility:public"], |
| ) |
| |
| ts_web_test_suite( |
| name = "gui2-fw-lib-test", |
| srcs = [ |
| "@npm//:node_modules/tslib/tslib.js", |
| ], |
| # do not sort |
| bootstrap = [ |
| "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js", |
| "@npm//:node_modules/reflect-metadata/Reflect.js", |
| ], |
| browsers = [ |
| "@io_bazel_rules_webtesting//browsers:chromium-local", |
| ], |
| runtime_deps = [ |
| ":initialize_testbed", |
| ], |
| deps = [ |
| ":rxjs_umd_modules", |
| ":test_lib", |
| "@npm//karma-jasmine", |
| ], |
| ) |
| |
| jdk_genrule( |
| name = "gui2_fw_lib_ext_css", |
| srcs = glob( |
| [ |
| "src/lib/widget/panel.css", |
| "src/lib/widget/panel-theme.css", |
| "src/lib/widget/table.css", |
| "src/lib/widget/table.theme.css", |
| "src/lib/widget/table.theme.css", |
| "src/lib/layer/loading.service.css", |
| ], |
| ), |
| outs = ["gui2_fw_lib_css.jar"], |
| cmd = " ROOT=`pwd` &&" + |
| " cd web/gui2-fw-lib/projects/gui2-fw-lib/src/lib &&" + |
| " jar Mcf $$ROOT/$@ .", |
| visibility = ["//visibility:public"], |
| ) |