| # 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", |
| 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:git.bzl", "git_repository") |
| 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 = "9473b207f1c5a61b603442cbfeeea8aaf2aa62870673fce2a1c52087f6ff4dc9", |
| urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.2.4/rules_nodejs-1.2.4.tar.gz"], |
| ) |
| |
| # Fetch sass rules for compiling sass files |
| http_archive( |
| name = "io_bazel_rules_sass", |
| sha256 = "77e241148f26d5dbb98f96fe0029d8f221c6cb75edbb83e781e08ac7f5322c5f", |
| strip_prefix = "rules_sass-1.24.0", |
| urls = [ |
| "https://github.com/bazelbuild/rules_sass/archive/1.24.0.zip", |
| "https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.24.0.zip", |
| ], |
| ) |
| |
| # Check the bazel version and download npm dependencies |
| load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") |
| |
| # 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 = "b663c411acc9cf191679823aa1eb9d665358239e8bf9e6f7cbb302b41f57317c", |
| strip_prefix = "bazel-toolchains-2.0.4", |
| urls = [ |
| "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/2.0.4/bazel-toolchains-2.0.4.tar.gz", |
| "https://github.com/bazelbuild/bazel-toolchains/releases/download/2.0.4/bazel-toolchains-2.0.4.tar.gz", |
| ], |
| ) |
| |
| #################################################### |
| # Support creating Docker images for our node apps # |
| #################################################### |
| |
| http_archive( |
| name = "io_bazel_rules_docker", |
| patches = ["//:rules_docker.patch"], |
| sha256 = "7d453450e1eb70e238eea6b31f4115607ec1200e91afea01c25f9804f37e39c8", |
| strip_prefix = "rules_docker-0.10.0", |
| urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.10.0.tar.gz"], |
| ) |
| |
| load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories") |
| |
| container_repositories() |
| |
| load("@io_bazel_rules_docker//nodejs:image.bzl", nodejs_image_repos = "repositories") |
| |
| nodejs_image_repos() |
| |
| #################################################### |
| # Kubernetes setup, for deployment to Google Cloud # |
| #################################################### |
| |
| git_repository( |
| name = "io_bazel_rules_k8s", |
| commit = "36ae5b534cc51ab0815c9bc723760469a9f7175c", |
| remote = "https://github.com/bazelbuild/rules_k8s.git", |
| shallow_since = "1545317854 -0500", |
| ) |
| |
| load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_defaults", "k8s_repositories") |
| |
| k8s_repositories() |
| |
| k8s_defaults( |
| # This creates a rule called "k8s_deploy" that we can call later |
| name = "k8s_deploy", |
| # This is the name of the cluster as it appears in: |
| # kubectl config view --minify -o=jsonpath='{.contexts[0].context.cluster}' |
| cluster = "_".join([ |
| "gke", |
| "internal-200822", |
| "us-west1-a", |
| "angular-bazel-example", |
| ]), |
| kind = "deployment", |
| ) |