| 
									
										
										
										
											2019-05-22 17:28:42 -07:00
										 |  |  | workspace( | 
					
						
							|  |  |  |     name = "angular", | 
					
						
							|  |  |  |     managed_directories = {"@npm": ["node_modules"]}, | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2017-09-25 12:40:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-05 12:16:14 -08:00
										 |  |  | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | 
					
						
							| 
									
										
										
										
											2018-12-01 16:08:15 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-22 14:26:52 -07:00
										 |  |  | # Uncomment for local bazel rules development | 
					
						
							|  |  |  | #local_repository( | 
					
						
							|  |  |  | #    name = "build_bazel_rules_nodejs", | 
					
						
							|  |  |  | #    path = "../rules_nodejs", | 
					
						
							|  |  |  | #) | 
					
						
							|  |  |  | #local_repository( | 
					
						
							| 
									
										
										
										
											2019-02-08 14:01:51 -08:00
										 |  |  | #    name = "npm_bazel_typescript", | 
					
						
							| 
									
										
										
										
											2018-10-22 14:26:52 -07:00
										 |  |  | #    path = "../rules_typescript", | 
					
						
							|  |  |  | #) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Fetch rules_nodejs so we can install our npm dependencies | 
					
						
							|  |  |  | http_archive( | 
					
						
							|  |  |  |     name = "build_bazel_rules_nodejs", | 
					
						
							| 
									
										
										
										
											2019-07-08 11:30:29 -07:00
										 |  |  |     patch_args = ["-p1"], | 
					
						
							|  |  |  |     # Patch https://github.com/bazelbuild/rules_nodejs/pull/903 | 
					
						
							|  |  |  |     patches = ["//tools:rollup_bundle_commonjs_ignoreGlobal.patch"], | 
					
						
							| 
									
										
										
										
											2019-07-24 08:52:26 -07:00
										 |  |  |     sha256 = "7c4a690268be97c96f04d505224ec4cb1ae53c2c2b68be495c9bd2634296a5cd", | 
					
						
							|  |  |  |     urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.34.0/rules_nodejs-0.34.0.tar.gz"], | 
					
						
							| 
									
										
										
										
											2018-06-25 11:22:23 -07:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Check the bazel version and download npm dependencies | 
					
						
							| 
									
										
										
										
											2019-03-14 19:35:00 -07:00
										 |  |  | load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "check_rules_nodejs_version", "node_repositories", "yarn_install") | 
					
						
							| 
									
										
										
										
											2018-05-10 13:12:30 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-22 17:28:42 -07:00
										 |  |  | # Bazel version must be at least the following version because: | 
					
						
							|  |  |  | #   - 0.26.0 managed_directories feature added which is required for nodejs rules 0.30.0 | 
					
						
							| 
									
										
										
										
											2019-06-12 18:18:26 -07:00
										 |  |  | #   - 0.27.0 has a fix for managed_directories after `rm -rf node_modules` | 
					
						
							| 
									
										
										
										
											2019-02-26 13:30:44 +01:00
										 |  |  | check_bazel_version( | 
					
						
							|  |  |  |     message = """
 | 
					
						
							| 
									
										
										
										
											2018-12-01 16:08:15 -08: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 19:10:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-16 10:19:01 +01:00
										 |  |  | """,
 | 
					
						
							| 
									
										
										
										
											2019-06-12 18:18:26 -07:00
										 |  |  |     minimum_bazel_version = "0.27.0", | 
					
						
							| 
									
										
										
										
											2019-01-16 10:19:01 +01:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2018-09-24 13:58:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-22 17:28:42 -07:00
										 |  |  | # The NodeJS rules version must be at least the following version because: | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | #   - 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 14:38:45 -08:00
										 |  |  | #   - 0.26.0 Fix for data files in yarn_install and npm_install | 
					
						
							| 
									
										
										
										
											2019-04-23 10:50:55 -07:00
										 |  |  | #   - 0.27.12 Adds NodeModuleSources provider for transtive npm deps support | 
					
						
							| 
									
										
										
										
											2019-05-22 17:28:42 -07:00
										 |  |  | #   - 0.30.0 yarn_install now uses symlinked node_modules with new managed directories Bazel 0.26.0 feature | 
					
						
							| 
									
										
										
										
											2019-06-07 09:28:41 -07:00
										 |  |  | #   - 0.31.1 entry_point attribute of nodejs_binary & rollup_bundle is now a label | 
					
						
							| 
									
										
										
										
											2019-06-18 21:26:53 -07:00
										 |  |  | #   - 0.32.0 yarn_install and npm_install no longer puts build files under symlinked node_modules | 
					
						
							|  |  |  | #   - 0.32.1 remove override of @bazel/tsetse & exclude typescript lib declarations in node_module_library transitive_declarations | 
					
						
							|  |  |  | #   - 0.32.2 resolves bug in @bazel/hide-bazel-files postinstall step | 
					
						
							| 
									
										
										
										
											2019-07-24 08:52:26 -07:00
										 |  |  | #   - 0.34.0 introduces protractor rule | 
					
						
							|  |  |  | check_rules_nodejs_version(minimum_version_string = "0.34.0") | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Setup the Node.js toolchain | 
					
						
							| 
									
										
										
										
											2018-05-10 23:35:21 -07:00
										 |  |  | node_repositories( | 
					
						
							| 
									
										
										
										
											2019-06-17 19:17:19 +02:00
										 |  |  |     node_repositories = { | 
					
						
							|  |  |  |         "10.16.0-darwin_amd64": ("node-v10.16.0-darwin-x64.tar.gz", "node-v10.16.0-darwin-x64", "6c009df1b724026d84ae9a838c5b382662e30f6c5563a0995532f2bece39fa9c"), | 
					
						
							|  |  |  |         "10.16.0-linux_amd64": ("node-v10.16.0-linux-x64.tar.xz", "node-v10.16.0-linux-x64", "1827f5b99084740234de0c506f4dd2202a696ed60f76059696747c34339b9d48"), | 
					
						
							|  |  |  |         "10.16.0-windows_amd64": ("node-v10.16.0-win-x64.zip", "node-v10.16.0-win-x64", "aa22cb357f0fb54ccbc06b19b60e37eefea5d7dd9940912675d3ed988bf9a059"), | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     node_version = "10.16.0", | 
					
						
							| 
									
										
										
										
											2018-09-11 18:11:32 -07:00
										 |  |  |     package_json = ["//:package.json"], | 
					
						
							| 
									
										
										
										
											2019-08-27 07:41:35 -07:00
										 |  |  |     yarn_repositories = { | 
					
						
							|  |  |  |         "1.17.3": ("yarn-v1.17.3.tar.gz", "yarn-v1.17.3", "e3835194409f1b3afa1c62ca82f561f1c29d26580c9e220c36866317e043c6f3"), | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-03-20 16:39:33 -04:00
										 |  |  |     # yarn 1.13.0 under Bazel has a regression on Windows that causes build errors on rebuilds: | 
					
						
							|  |  |  |     # ``` | 
					
						
							|  |  |  |     # ERROR: Source forest creation failed: C:/.../fyuc5c3n/execroot/angular/external (Directory not empty) | 
					
						
							|  |  |  |     # ``` | 
					
						
							|  |  |  |     # See https://github.com/angular/angular/pull/29431 for more information. | 
					
						
							|  |  |  |     # It possible that versions of yarn past 1.13.0 do not have this issue, however, before | 
					
						
							|  |  |  |     # advancing this version we need to test manually on Windows that the above error does not | 
					
						
							|  |  |  |     # happen as the issue is not caught by CI. | 
					
						
							| 
									
										
										
										
											2019-08-27 07:41:35 -07:00
										 |  |  |     yarn_version = "1.17.3", | 
					
						
							| 
									
										
										
										
											2018-05-10 23:35:21 -07:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2018-05-10 13:12:30 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | yarn_install( | 
					
						
							|  |  |  |     name = "npm", | 
					
						
							|  |  |  |     package_json = "//:package.json", | 
					
						
							| 
									
										
										
										
											2019-06-07 13:38:06 -07:00
										 |  |  |     yarn_lock = "//:yarn.lock", | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | # Install all bazel dependencies of the @npm npm packages | 
					
						
							|  |  |  | load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") | 
					
						
							| 
									
										
										
										
											2018-10-04 13:14:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | install_bazel_dependencies() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Load angular dependencies | 
					
						
							|  |  |  | load("//packages/bazel:package.bzl", "rules_angular_dev_dependencies") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rules_angular_dev_dependencies() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-24 08:52:26 -07:00
										 |  |  | # Load protractor dependencies | 
					
						
							|  |  |  | load("@npm_bazel_protractor//:package.bzl", "npm_bazel_protractor_dependencies") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | npm_bazel_protractor_dependencies() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Load karma dependencies | 
					
						
							| 
									
										
										
										
											2019-02-08 14:01:51 -08:00
										 |  |  | load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies") | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | rules_karma_dependencies() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Setup the rules_webtesting toolchain | 
					
						
							| 
									
										
										
										
											2019-02-13 09:33:48 -08:00
										 |  |  | load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories") | 
					
						
							| 
									
										
										
										
											2018-05-10 13:12:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | web_test_repositories() | 
					
						
							| 
									
										
										
										
											2018-09-24 13:58:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-13 09:33:48 -08:00
										 |  |  | # Temporary work-around for https://github.com/angular/angular/issues/28681 | 
					
						
							|  |  |  | # TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories | 
					
						
							| 
									
										
										
										
											2019-05-15 20:01:50 -07:00
										 |  |  | load("//:browser_repositories.bzl", "browser_repositories") | 
					
						
							| 
									
										
										
										
											2019-02-13 09:33:48 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | browser_repositories() | 
					
						
							| 
									
										
										
										
											2018-05-10 13:12:30 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Setup the rules_typescript tooolchain | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace") | 
					
						
							| 
									
										
										
										
											2018-05-10 13:12:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | ts_setup_workspace() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Setup the rules_sass toolchain | 
					
						
							| 
									
										
										
										
											2018-04-25 09:23:20 -07:00
										 |  |  | load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") | 
					
						
							| 
									
										
										
										
											2018-09-24 13:58:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-25 09:23:20 -07:00
										 |  |  | sass_repositories() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-04 15:53:32 -08:00
										 |  |  | # Setup the skydoc toolchain | 
					
						
							| 
									
										
										
										
											2018-04-25 09:23:20 -07:00
										 |  |  | load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories") | 
					
						
							| 
									
										
										
										
											2018-09-24 13:58:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-25 09:23:20 -07:00
										 |  |  | skydoc_repositories() | 
					
						
							| 
									
										
										
										
											2019-03-15 13:45:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | load("@bazel_toolchains//rules:environments.bzl", "clang_env") | 
					
						
							|  |  |  | load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rbe_autoconfig( | 
					
						
							|  |  |  |     name = "rbe_ubuntu1604_angular", | 
					
						
							| 
									
										
										
										
											2019-06-25 10:07:01 +02:00
										 |  |  |     # Need to specify a base container digest in order to ensure that we can use the checked-in | 
					
						
							|  |  |  |     # platform configurations for the "ubuntu16_04" image. Otherwise the autoconfig rule would | 
					
						
							|  |  |  |     # need to pull the image and run it in order determine the toolchain configuration. See: | 
					
						
							|  |  |  |     # https://github.com/bazelbuild/bazel-toolchains/blob/0.27.0/configs/ubuntu16_04_clang/versions.bzl | 
					
						
							|  |  |  |     base_container_digest = "sha256:94d7d8552902d228c32c8c148cc13f0effc2b4837757a6e95b73fdc5c5e4b07b", | 
					
						
							| 
									
										
										
										
											2019-03-15 13:45:20 -04:00
										 |  |  |     # Note that if you change the `digest`, you might also need to update the | 
					
						
							|  |  |  |     # `base_container_digest` to make sure marketplace.gcr.io/google/rbe-ubuntu16-04-webtest:<digest> | 
					
						
							|  |  |  |     # and marketplace.gcr.io/google/rbe-ubuntu16-04:<base_container_digest> have | 
					
						
							| 
									
										
										
										
											2019-06-25 10:07:01 +02:00
										 |  |  |     # the same Clang and JDK installed. Clang is needed because of the dependency on | 
					
						
							|  |  |  |     # @com_google_protobuf. Java is needed for the Bazel's test executor Java tool. | 
					
						
							|  |  |  |     digest = "sha256:76e2e4a894f9ffbea0a0cb2fbde741b5d223d40f265dbb9bca78655430173990", | 
					
						
							| 
									
										
										
										
											2019-03-15 13:45:20 -04:00
										 |  |  |     env = clang_env(), | 
					
						
							|  |  |  |     registry = "marketplace.gcr.io", | 
					
						
							| 
									
										
										
										
											2019-06-25 10:07:01 +02:00
										 |  |  |     # We can't use the default "ubuntu16_04" RBE image provided by the autoconfig because we need | 
					
						
							|  |  |  |     # a specific Linux kernel that comes with "libx11" in order to run headless browser tests. | 
					
						
							| 
									
										
										
										
											2019-03-15 13:45:20 -04:00
										 |  |  |     repository = "google/rbe-ubuntu16-04-webtest", | 
					
						
							|  |  |  | ) |