2017-12-19 18:03:29 -05:00
|
|
|
workspace(name = "angular")
|
2017-09-25 15:40:22 -04:00
|
|
|
|
2018-12-05 15:16:14 -05:00
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
2018-12-01 19:08:15 -05:00
|
|
|
|
2018-10-22 17:26:52 -04:00
|
|
|
# Uncomment for local bazel rules development
|
|
|
|
#local_repository(
|
|
|
|
# name = "build_bazel_rules_nodejs",
|
|
|
|
# path = "../rules_nodejs",
|
|
|
|
#)
|
|
|
|
#local_repository(
|
2019-02-08 17:01:51 -05:00
|
|
|
# name = "npm_bazel_typescript",
|
2018-10-22 17:26:52 -04:00
|
|
|
# path = "../rules_typescript",
|
|
|
|
#)
|
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Fetch rules_nodejs so we can install our npm dependencies
|
|
|
|
http_archive(
|
|
|
|
name = "build_bazel_rules_nodejs",
|
2019-03-18 17:50:52 -04:00
|
|
|
sha256 = "35511e7e9aa7d6fcfd429200a6e9b40733ebdd40ab1420935079798e9903c904",
|
|
|
|
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.27.6/rules_nodejs-0.27.6.tar.gz"],
|
2018-06-25 14:22:23 -04:00
|
|
|
)
|
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Check the bazel version and download npm dependencies
|
2019-03-14 22:35:00 -04:00
|
|
|
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "check_rules_nodejs_version", "node_repositories", "yarn_install")
|
2018-05-10 16:12:30 -04:00
|
|
|
|
2019-01-04 15:35:57 -05:00
|
|
|
# Bazel version must be at least v0.21.0 because:
|
2019-01-28 13:30:18 -05:00
|
|
|
# - 0.21.0 Using --incompatible_strict_action_env flag fixes cache when running `yarn bazel`
|
|
|
|
# (see https://github.com/angular/angular/issues/27514#issuecomment-451438271)
|
2019-02-26 07:30:44 -05:00
|
|
|
check_bazel_version(
|
|
|
|
message = """
|
2018-12-01 19:08:15 -05:00
|
|
|
You no longer need to install Bazel on your machine.
|
|
|
|
Angular has a dependency on the @bazel/bazel package which supplies it.
|
|
|
|
Try running `yarn bazel` instead.
|
|
|
|
(If you did run that, check that you've got a fresh `yarn install`)
|
2018-08-05 22:10:07 -04:00
|
|
|
|
2019-01-16 04:19:01 -05:00
|
|
|
""",
|
|
|
|
minimum_bazel_version = "0.21.0",
|
|
|
|
)
|
2018-09-24 16:58:23 -04:00
|
|
|
|
2019-02-20 12:54:42 -05:00
|
|
|
# The NodeJS rules version must be at least v0.15.3 because:
|
|
|
|
# - 0.15.2 Re-introduced the prod_only attribute on yarn_install
|
|
|
|
# - 0.15.3 Includes a fix for the `jasmine_node_test` rule ignoring target tags
|
|
|
|
# - 0.16.8 Supports npm installed bazel workspaces
|
2019-02-27 17:38:45 -05:00
|
|
|
# - 0.26.0 Fix for data files in yarn_install and npm_install
|
|
|
|
check_rules_nodejs_version("0.26.0")
|
2019-02-20 12:54:42 -05:00
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Setup the Node.js toolchain
|
2018-05-11 02:35:21 -04:00
|
|
|
node_repositories(
|
2018-09-24 16:58:23 -04:00
|
|
|
node_version = "10.9.0",
|
2018-09-11 21:11:32 -04:00
|
|
|
package_json = ["//:package.json"],
|
|
|
|
preserve_symlinks = True,
|
2019-03-14 14:09:01 -04:00
|
|
|
yarn_version = "1.13.0",
|
2018-05-11 02:35:21 -04:00
|
|
|
)
|
2018-05-10 16:12:30 -04:00
|
|
|
|
2019-02-20 12:54:42 -05:00
|
|
|
yarn_install(
|
|
|
|
name = "npm",
|
|
|
|
data = [
|
|
|
|
"//:tools/npm/@angular_bazel/index.js",
|
|
|
|
"//:tools/npm/@angular_bazel/package.json",
|
|
|
|
"//:tools/postinstall-patches.js",
|
|
|
|
"//:tools/yarn/check-yarn.js",
|
|
|
|
],
|
|
|
|
package_json = "//:package.json",
|
|
|
|
# Don't install devDependencies, they are large and not used under Bazel
|
|
|
|
prod_only = True,
|
|
|
|
yarn_lock = "//:yarn.lock",
|
|
|
|
)
|
2019-02-04 18:53:32 -05:00
|
|
|
|
2019-02-20 12:54:42 -05:00
|
|
|
yarn_install(
|
|
|
|
name = "ts-api-guardian_deps",
|
|
|
|
package_json = "@angular//tools/ts-api-guardian:package.json",
|
|
|
|
yarn_lock = "@angular//tools/ts-api-guardian:yarn.lock",
|
|
|
|
)
|
2019-02-04 18:53:32 -05:00
|
|
|
|
2019-02-20 12:54:42 -05:00
|
|
|
# Install all bazel dependencies of the @npm npm packages
|
|
|
|
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
|
2018-10-04 16:14:14 -04:00
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
install_bazel_dependencies()
|
|
|
|
|
|
|
|
# Load angular dependencies
|
|
|
|
load("//packages/bazel:package.bzl", "rules_angular_dev_dependencies")
|
|
|
|
|
|
|
|
rules_angular_dev_dependencies()
|
|
|
|
|
|
|
|
# Load karma dependencies
|
2019-02-08 17:01:51 -05:00
|
|
|
load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
|
2019-02-04 18:53:32 -05:00
|
|
|
|
|
|
|
rules_karma_dependencies()
|
|
|
|
|
|
|
|
# Setup the rules_webtesting toolchain
|
2019-02-13 12:33:48 -05:00
|
|
|
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
|
2018-05-10 16:12:30 -04:00
|
|
|
|
|
|
|
web_test_repositories()
|
2018-09-24 16:58:23 -04:00
|
|
|
|
2019-02-13 12:33:48 -05:00
|
|
|
# Temporary work-around for https://github.com/angular/angular/issues/28681
|
|
|
|
# TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories
|
2019-02-08 17:01:51 -05:00
|
|
|
load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
|
2019-02-13 12:33:48 -05:00
|
|
|
|
|
|
|
browser_repositories()
|
2018-05-10 16:12:30 -04:00
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Setup the rules_typescript tooolchain
|
2019-02-20 12:54:42 -05:00
|
|
|
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
|
2018-05-10 16:12:30 -04:00
|
|
|
|
|
|
|
ts_setup_workspace()
|
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Setup the rules_sass toolchain
|
2018-04-25 12:23:20 -04:00
|
|
|
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
|
2018-09-24 16:58:23 -04:00
|
|
|
|
2018-04-25 12:23:20 -04:00
|
|
|
sass_repositories()
|
|
|
|
|
2019-02-04 18:53:32 -05:00
|
|
|
# Setup the skydoc toolchain
|
2018-04-25 12:23:20 -04:00
|
|
|
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
|
2018-09-24 16:58:23 -04:00
|
|
|
|
2018-04-25 12:23:20 -04:00
|
|
|
skydoc_repositories()
|