2019-11-01 14:17:10 -04:00
|
|
|
load("//tools:defaults.bzl", "ng_module", "protractor_web_test_suite", "ts_library")
|
2019-02-20 12:54:42 -05:00
|
|
|
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
|
2019-01-28 15:59:25 -05:00
|
|
|
|
|
|
|
"""
|
|
|
|
Macro that can be used to create the Bazel targets for an "upgrade" example. Since the
|
|
|
|
upgrade examples bootstrap their application manually, and we cannot serve all examples,
|
|
|
|
we need to define the devserver for each example. This macro reduces code duplication
|
|
|
|
for defining these targets.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def create_upgrade_example_targets(name, srcs, e2e_srcs, entry_module, assets = []):
|
|
|
|
ng_module(
|
|
|
|
name = "%s_sources" % name,
|
|
|
|
srcs = srcs,
|
2019-11-12 12:52:34 -05:00
|
|
|
generate_ve_shims = True,
|
2019-01-28 15:59:25 -05:00
|
|
|
# TODO: FW-1004 Type checking is currently not complete.
|
|
|
|
type_check = False,
|
|
|
|
deps = [
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//@types/angular",
|
2019-03-22 05:42:52 -04:00
|
|
|
"@npm//@types/jasmine",
|
2019-01-28 15:59:25 -05:00
|
|
|
"//packages/core",
|
|
|
|
"//packages/platform-browser",
|
|
|
|
"//packages/platform-browser-dynamic",
|
|
|
|
"//packages/upgrade/static",
|
2019-03-22 05:42:52 -04:00
|
|
|
"//packages/core/testing",
|
|
|
|
"//packages/upgrade/static/testing",
|
2019-01-28 15:59:25 -05:00
|
|
|
],
|
|
|
|
tsconfig = "//packages/examples/upgrade:tsconfig-build.json",
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "%s_e2e_lib" % name,
|
|
|
|
srcs = e2e_srcs,
|
|
|
|
testonly = True,
|
|
|
|
deps = [
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//@types/jasminewd2",
|
|
|
|
"@npm//protractor",
|
2019-01-28 15:59:25 -05:00
|
|
|
"//packages/examples/test-utils",
|
|
|
|
"//packages/private/testing",
|
|
|
|
],
|
|
|
|
tsconfig = "//packages/examples:tsconfig-e2e.json",
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_devserver(
|
|
|
|
name = "devserver",
|
|
|
|
port = 4200,
|
|
|
|
entry_module = entry_module,
|
|
|
|
static_files = [
|
2019-10-05 23:06:53 -04:00
|
|
|
"//packages/zone.js/dist:zone.js",
|
2019-06-19 00:26:53 -04:00
|
|
|
"@npm//:node_modules/angular/angular.js",
|
|
|
|
"@npm//:node_modules/reflect-metadata/Reflect.js",
|
2019-01-28 15:59:25 -05:00
|
|
|
],
|
|
|
|
index_html = "//packages/examples:index.html",
|
2019-02-13 19:31:29 -05:00
|
|
|
scripts = [
|
2019-06-19 00:26:53 -04:00
|
|
|
"@npm//:node_modules/tslib/tslib.js",
|
2019-02-13 19:31:29 -05:00
|
|
|
"//tools/rxjs:rxjs_umd_modules",
|
|
|
|
],
|
2019-01-28 15:59:25 -05:00
|
|
|
deps = [":%s_sources" % name],
|
|
|
|
data = assets,
|
|
|
|
)
|
|
|
|
|
|
|
|
protractor_web_test_suite(
|
|
|
|
name = "%s_protractor" % name,
|
|
|
|
on_prepare = "//packages/examples/upgrade:start-server.js",
|
|
|
|
server = ":devserver",
|
|
|
|
deps = [
|
|
|
|
":%s_e2e_lib" % name,
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//protractor",
|
|
|
|
"@npm//selenium-webdriver",
|
2019-01-28 15:59:25 -05:00
|
|
|
],
|
|
|
|
)
|