| # The WORKSPACE file tells Bazel that this directory is a "workspace", which is like a project root. |
| # The content of this file specifies all the external dependencies Bazel needs to perform a build. |
| |
| #################################### |
| # ESModule imports (and TypeScript imports) can be absolute starting with the workspace name. |
| # The name of the workspace should match the npm package where we publish, so that these |
| # imports also make sense when referencing the published package. |
| workspace( |
| name = "examples_angular_view_engine", |
| managed_directories = {"@npm": ["node_modules"]}, |
| ) |
| |
| # These rules are built-into Bazel but we need to load them first to download more rules |
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| |
| # Fetch rules_nodejs so we can install our npm dependencies |
| http_archive( |
| name = "build_bazel_rules_nodejs", |
| sha256 = "a54b2511d6dae42c1f7cdaeb08144ee2808193a088004fc3b464a04583d5aa2e", |
| urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.3/rules_nodejs-0.42.3.tar.gz"], |
| ) |
| |
| # Fetch sass rules for compiling sass files |
| http_archive( |
| name = "io_bazel_rules_sass", |
| sha256 = "617e444f47a1f3e25eb1b6f8e88a2451d54a2afdc7c50518861d9f706fc8baaa", |
| strip_prefix = "rules_sass-1.23.7", |
| urls = [ |
| "https://github.com/bazelbuild/rules_sass/archive/1.23.7.zip", |
| "https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.23.7.zip", |
| ], |
| ) |
| |
| # Check the bazel version and download npm dependencies |
| load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version", "yarn_install") |
| |
| # Bazel version must be at least the following version because: |
| # - 0.27.0 Adds managed directories support |
| check_bazel_version( |
| message = """ |
| 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`) |
| |
| """, |
| minimum_bazel_version = "0.27.0", |
| ) |
| |
| # Setup the Node.js toolchain & install our npm dependencies into @npm |
| yarn_install( |
| name = "npm", |
| package_json = "//:package.json", |
| yarn_lock = "//:yarn.lock", |
| ) |
| |
| # Install all bazel dependencies of our npm packages |
| load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") |
| |
| install_bazel_dependencies() |
| |
| # Load npm_bazel_protractor dependencies |
| load("@npm_bazel_protractor//:package.bzl", "npm_bazel_protractor_dependencies") |
| |
| npm_bazel_protractor_dependencies() |
| |
| # Load npm_bazel_karma dependencies |
| load("@npm_bazel_karma//:package.bzl", "npm_bazel_karma_dependencies") |
| |
| npm_bazel_karma_dependencies() |
| |
| # Setup the rules_webtesting toolchain |
| load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories") |
| |
| web_test_repositories() |
| |
| load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories") |
| |
| browser_repositories( |
| chromium = True, |
| firefox = True, |
| ) |
| |
| # Setup the rules_typescript tooolchain |
| load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace") |
| |
| ts_setup_workspace() |
| |
| # Setup the rules_sass toolchain |
| load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") |
| |
| sass_repositories() |
| |
| ################################ |
| # Support for Remote Execution # |
| ################################ |
| |
| http_archive( |
| name = "bazel_toolchains", |
| sha256 = "e2126599d29f2028e6b267eba273dcc8e7f4a35ff323e9600cf42fb03875b7c6", |
| strip_prefix = "bazel-toolchains-2.0.0", |
| urls = [ |
| "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/2.0.0/bazel-toolchains-2.0.0.tar.gz", |
| "https://github.com/bazelbuild/bazel-toolchains/releases/download/2.0.0/bazel-toolchains-2.0.0.tar.gz", |
| ], |
| ) |