2018-01-09 18:24:00 -05:00
|
|
|
"""Re-export of some bazel rules with repository-wide defaults."""
|
2018-03-13 14:00:53 -04:00
|
|
|
load("@build_bazel_rules_nodejs//:defs.bzl", _npm_package = "npm_package")
|
2018-05-11 12:43:06 -04:00
|
|
|
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library", _ts_web_test_suite = "ts_web_test_suite")
|
2018-02-13 14:26:06 -05:00
|
|
|
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
|
2018-02-16 11:45:21 -05:00
|
|
|
load("//packages/bazel/src:ng_module.bzl", _ivy_ng_module = "internal_ivy_ng_module")
|
2018-01-09 18:24:00 -05:00
|
|
|
|
|
|
|
DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
|
|
|
|
|
2018-03-13 14:00:53 -04:00
|
|
|
# Packages which are versioned together on npm
|
|
|
|
ANGULAR_SCOPED_PACKAGES = ["@angular/%s" % p for p in [
|
2018-04-11 01:03:24 -04:00
|
|
|
# core should be the first package because it's the main package in the group
|
|
|
|
# this is significant for Angular CLI and "ng update" specifically, @angular/core
|
|
|
|
# is considered the identifier of the group by these tools.
|
2018-03-13 14:00:53 -04:00
|
|
|
"core",
|
2018-04-11 01:03:24 -04:00
|
|
|
"bazel",
|
2018-03-13 14:00:53 -04:00
|
|
|
"common",
|
|
|
|
"compiler",
|
|
|
|
"compiler-cli",
|
|
|
|
"animations",
|
2018-04-14 06:48:32 -04:00
|
|
|
"elements",
|
2018-03-13 14:00:53 -04:00
|
|
|
"platform-browser",
|
|
|
|
"platform-browser-dynamic",
|
|
|
|
"forms",
|
|
|
|
"http",
|
|
|
|
"platform-server",
|
|
|
|
"platform-webworker",
|
|
|
|
"platform-webworker-dynamic",
|
|
|
|
"upgrade",
|
|
|
|
"router",
|
|
|
|
"language-service",
|
|
|
|
"service-worker",
|
|
|
|
]]
|
|
|
|
|
|
|
|
PKG_GROUP_REPLACEMENTS = {
|
|
|
|
"\"NG_UPDATE_PACKAGE_GROUP\"": """[
|
|
|
|
%s
|
|
|
|
]""" % ",\n ".join(["\"%s\"" % s for s in ANGULAR_SCOPED_PACKAGES])
|
|
|
|
}
|
|
|
|
|
2018-01-09 18:24:00 -05:00
|
|
|
def ts_library(tsconfig = None, **kwargs):
|
|
|
|
if not tsconfig:
|
|
|
|
tsconfig = DEFAULT_TSCONFIG
|
|
|
|
_ts_library(tsconfig = tsconfig, **kwargs)
|
|
|
|
|
2018-02-13 14:26:06 -05:00
|
|
|
def ng_module(name, tsconfig = None, entry_point = None, **kwargs):
|
2018-01-09 18:24:00 -05:00
|
|
|
if not tsconfig:
|
|
|
|
tsconfig = DEFAULT_TSCONFIG
|
2018-02-13 14:26:06 -05:00
|
|
|
if not entry_point:
|
|
|
|
entry_point = "public_api.ts"
|
2018-03-15 21:04:34 -04:00
|
|
|
_ng_module(name = name, flat_module_out_file = name, tsconfig = tsconfig, entry_point = entry_point, **kwargs)
|
2018-02-13 14:26:06 -05:00
|
|
|
|
2018-04-12 20:43:27 -04:00
|
|
|
def ng_package(name, readme_md = None, license_banner = None, **kwargs):
|
2018-02-13 14:26:06 -05:00
|
|
|
if not readme_md:
|
|
|
|
readme_md = "//packages:README.md"
|
|
|
|
if not license_banner:
|
|
|
|
license_banner = "//packages:license-banner.txt"
|
|
|
|
|
|
|
|
_ng_package(
|
|
|
|
name = name,
|
|
|
|
readme_md = readme_md,
|
|
|
|
license_banner = license_banner,
|
2018-03-13 14:00:53 -04:00
|
|
|
replacements = PKG_GROUP_REPLACEMENTS,
|
|
|
|
**kwargs)
|
|
|
|
|
|
|
|
def npm_package(name, replacements = {}, **kwargs):
|
|
|
|
_npm_package(
|
|
|
|
name = name,
|
|
|
|
replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS),
|
2018-02-13 14:26:06 -05:00
|
|
|
**kwargs)
|
2018-03-15 21:33:52 -04:00
|
|
|
|
2018-05-11 12:43:06 -04:00
|
|
|
def ts_web_test_suite(bootstrap = [], deps = [], **kwargs):
|
2018-03-15 21:33:52 -04:00
|
|
|
if not bootstrap:
|
|
|
|
bootstrap = ["//:web_test_bootstrap_scripts"]
|
|
|
|
local_deps = [
|
|
|
|
"//:node_modules/tslib/tslib.js",
|
|
|
|
"//tools/testing:browser",
|
|
|
|
] + deps
|
|
|
|
|
2018-05-11 12:43:06 -04:00
|
|
|
_ts_web_test_suite(
|
2018-03-15 21:33:52 -04:00
|
|
|
bootstrap = bootstrap,
|
|
|
|
deps = local_deps,
|
2018-05-16 13:10:57 -04:00
|
|
|
# Run unit tests on local Chromium by default.
|
2018-05-11 12:43:06 -04:00
|
|
|
# You can exclude tests based on tags, e.g. to skip Firefox testing,
|
|
|
|
# `bazel test --test_tag_filters=-browser:firefox-local [targets]`
|
|
|
|
browsers = [
|
|
|
|
"@io_bazel_rules_webtesting//browsers:chromium-local",
|
2018-05-16 13:10:57 -04:00
|
|
|
# Don't test on local Firefox by default, for faster builds.
|
|
|
|
# We think that bugs in Angular tend to be caught the same in any
|
|
|
|
# evergreen browser.
|
|
|
|
# "@io_bazel_rules_webtesting//browsers:firefox-local",
|
|
|
|
# TODO(alexeagle): add remote browsers on SauceLabs
|
2018-05-11 12:43:06 -04:00
|
|
|
],
|
2018-02-16 11:45:21 -05:00
|
|
|
**kwargs)
|
|
|
|
|
|
|
|
def ivy_ng_module(name, tsconfig = None, **kwargs):
|
|
|
|
if not tsconfig:
|
|
|
|
tsconfig = DEFAULT_TSCONFIG
|
|
|
|
_ivy_ng_module(name = name, tsconfig = tsconfig, **kwargs)
|