2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Building and Testing Angular
  
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This document describes how to set up your development environment to build and test Angular.
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 18:40:09 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								It also explains the basic mechanics of using `git` , `node` , and `yarn` .
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-09 09:33:10 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Prerequisite Software ](#prerequisite-software ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  [Getting the Sources ](#getting-the-sources ) 
						 
					
						
							
								
									
										
										
										
											2016-07-21 11:48:23 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Installing NPM Modules ](#installing-npm-modules ) 
						 
					
						
							
								
									
										
										
										
											2016-07-08 13:00:27 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Building ](#building ) 
						 
					
						
							
								
									
										
										
										
											2015-04-09 09:33:10 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Running Tests Locally ](#running-tests-locally ) 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Formatting your Source Code ](#formatting-your-source-code ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  [Linting/verifying your Source Code ](#lintingverifying-your-source-code ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  [Publishing Snapshot Builds ](#publishing-snapshot-builds ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  [Bazel Support ](#bazel-support ) 
						 
					
						
							
								
									
										
										
										
											2015-04-09 09:33:10 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								See the [contribution guidelines ](https://github.com/angular/angular/blob/master/CONTRIBUTING.md )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if you'd like to contribute to Angular.
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Prerequisite Software
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Before you can build and test Angular, you must install and configure the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								following products on your development machine:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-16 22:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Git ](https://git-scm.com/ ) and/or the [**GitHub app** ](https://desktop.github.com/ ) (for Mac and Windows); 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  [GitHub's Guide to Installing Git ](https://help.github.com/articles/set-up-git ) is a good source of information.
							 
						 
					
						
							
								
									
										
										
										
											2016-01-21 13:30:03 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-16 22:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Node.js ](https://nodejs.org ), (version specified in the engines field of [`package.json` ](../package.json )) which is used to run a development web server, 
						 
					
						
							
								
									
										
										
										
											2017-12-06 09:22:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  run tests, and generate distributable files.
							 
						 
					
						
							
								
									
										
										
										
											2016-01-21 13:30:03 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-06 09:22:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Yarn ](https://yarnpkg.com ) (version specified in the engines field of [`package.json` ](../package.json )) which is used to install dependencies. 
						 
					
						
							
								
									
										
										
										
											2017-09-21 15:39:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-24 15:36:15 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  Optional: [Java ](https://openjdk.java.net/ ) version 7 or higher as required by [Closure Compiler ](https://developers.google.com/closure/compiler ). Most developers will not need this. Java is required for running some of the integration tests. 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Getting the Sources
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-17 16:02:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Fork and clone the Angular repository:
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-17 16:02:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  Login to your GitHub account or create one by following the instructions given 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								   [here ](https://github.com/signup/free ).
							 
						 
					
						
							
								
									
										
										
										
											2020-11-16 22:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  [Fork ](https://help.github.com/forking ) the [main Angular 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								   repository](https://github.com/angular/angular).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								3.  Clone your fork of the Angular repository and define an `upstream`  remote pointing back to 
						 
					
						
							
								
									
										
										
										
											2015-04-17 16:02:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   the Angular repository that you forked in the first place.
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```shell
							 
						 
					
						
							
								
									
										
										
										
											2015-04-17 16:02:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Clone your GitHub repository:
  
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								git clone git@github .com:< github  username > /angular.git
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Go to the Angular directory:
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								cd angular
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Add the main Angular repository as an upstream remote to your repository:
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								git remote add upstream https://github.com/angular/angular.git
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 11:48:23 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Installing NPM Modules
  
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 11:38:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Next, install the JavaScript modules needed to build and test Angular:
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```shell
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Install Angular project dependencies (package.json)
  
						 
					
						
							
								
									
										
										
										
											2017-09-21 15:39:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								yarn install
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-08 13:00:27 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Building
  
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-08 13:00:27 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								To build Angular run:
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```shell
							 
						 
					
						
							
								
									
										
										
										
											2020-02-29 22:25:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								node ./scripts/build/build-packages-dist.js
							 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-05 22:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  Results are put in the `dist/packages-dist`  folder. 
						 
					
						
							
								
									
										
										
										
											2015-03-17 18:48:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Running Tests Locally
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-18 11:06:30 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Bazel is used as the primary tool for building and testing Angular. Building and testing are
							 
						 
					
						
							
								
									
										
										
										
											2019-01-05 22:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								incremental with Bazel, and it's possible to only run tests for an individual package instead
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								of for all packages. Read more about this in the [BAZEL.md ](./BAZEL.md ) document.
							 
						 
					
						
							
								
									
										
										
										
											2015-11-07 00:16:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-20 16:05:04 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You should execute all test suites before submitting a PR to GitHub. Note that not all tests
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								support both Ivy and View Engine, so they need to be run separately:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  `yarn test-ivy-aot //packages/...`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  `yarn test-non-ivy //packages/...`  
						 
					
						
							
								
									
										
										
										
											2016-07-14 08:51:05 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								**Note**: The first test run will be much slower than future runs. This is because future runs will
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								benefit from Bazel's capability to do incremental builds.
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								All the tests are executed on our Continuous Integration infrastructure. PRs can only be
							 
						 
					
						
							
								
									
										
										
										
											2019-01-05 22:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								merged if the code is formatted properly and all tests are passing.
							 
						 
					
						
							
								
									
										
										
										
											2016-07-14 08:51:05 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-19 18:12:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< a  name = "formatting-your-source-code" >  
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< a  name = "clang-format" > < / a >  
						 
					
						
							
								
									
										
										
										
											2020-06-02 14:19:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-25 10:15:13 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Testing changes against a local library/project
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Often for developers the best way to ensure the changes they have made work as expected is to run
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								use changes in another library or project. To do this developers can build Angular locally, and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using `yarn link`  build a local project with the created artifacts.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								This can be done by running:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								yarn ng-dev build-and-link < path-to-local-project-root > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Formatting your source code
  
						 
					
						
							
								
									
										
										
										
											2016-07-14 08:51:05 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-16 22:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Angular uses [clang-format ](https://clang.llvm.org/docs/ClangFormat.html ) to format the source code.
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 18:40:09 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								If the source code is not properly formatted, the CI will fail and the PR cannot be merged.
							 
						 
					
						
							
								
									
										
										
										
											2016-07-14 08:51:05 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can automatically format your code by running:
							 
						 
					
						
							
								
									
										
										
										
											2020-05-04 11:37:21 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								-  `yarn ng-dev format changed [shaOrRef]` : format only files changed since the provided sha/ref. `shaOrRef`  defaults to `master` . 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  `yarn ng-dev format all` : format _all_  source code 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  `yarn ng-dev format files <files..>` : format only provided files 
						 
					
						
							
								
									
										
										
										
											2016-07-14 08:51:05 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 08:03:37 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								A better way is to set up your IDE to format the changed file on each file save.
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 09:42:29 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 08:03:37 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### VS Code
  
						 
					
						
							
								
									
										
										
										
											2018-12-03 14:52:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  Install [Clang-Format ](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format ) extension for VS Code. 
						 
					
						
							
								
									
										
										
										
											2019-10-16 00:04:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  It will automatically pick up the settings from `.vscode/settings.json` . 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								If you haven't already, create a `settings.json`  file by following the instructions [here ](../.vscode/README.md ).
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 09:42:29 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### WebStorm / IntelliJ
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Install the [ClangFormatIJ ](https://plugins.jetbrains.com/plugin/8396-clangformatij ) plugin 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Open `Preferences->Tools->clang-format`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Find the field named "PATH" 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Add `<PATH_TO_YOUR_WORKSPACE>/angular/node_modules/clang-format/bin/<OS>/`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  where the OS options are: `darwin_x64` , `linux_x64` , and `win32` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 21:43:24 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Vim
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Install [Vim Clang-Format ](https://github.com/rhysd/vim-clang-format ). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  Create a [project-specific `.vimrc` ](https://andrew.stwrt.ca/posts/project-specific-vimrc/ ) in 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   your Angular directory containing
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```vim
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								let g:clang_format#command  = '$ANGULAR_PATH/node_modules/.bin/clang-format'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								where `$ANGULAR_PATH`  is an environment variable of the absolute path of your Angular directory.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Linting/verifying your Source Code
  
						 
					
						
							
								
									
										
										
										
											2016-12-31 03:54:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can check that your code is properly formatted and adheres to coding style by running:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								``` shell
							 
						 
					
						
							
								
									
										
										
										
											2020-03-02 18:35:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ yarn lint
							 
						 
					
						
							
								
									
										
										
										
											2016-12-31 03:54:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Publishing Snapshot Builds
  
						 
					
						
							
								
									
										
										
										
											2017-01-19 14:25:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								When a build of any branch on the upstream fork angular/angular is green on CircleCI, it
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								automatically publishes build artifacts to repositories in the Angular org, eg. the `@angular/core` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								package is published to https://github.com/angular/core-builds.
							 
						 
					
						
							
								
									
										
										
										
											2016-07-14 08:51:05 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You may find that your un-merged change needs some validation from external participants.
							 
						 
					
						
							
								
									
										
										
										
											2019-10-22 16:57:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Rather than requiring them to pull your Pull Request and build Angular locally, they can depend on
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								snapshots of the Angular packages created based on the code in the Pull Request.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Getting Packages from Build Artifacts
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Each CI run for a Pull Request stores the built Angular packages as
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[build artifacts ](https://circleci.com/docs/2.0/artifacts ). The artifacts are not guaranteed to be
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								available as a long-term distribution mechanism, but they are guaranteed to be available around the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								time of the build.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can access the artifacts for a specific CI run by going to the workflow page, clicking on the
							 
						 
					
						
							
								
									
										
										
										
											2020-08-22 21:41:49 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`publish_packages_as_artifacts`  job and then switching to the "ARTIFACTS" tab. 
						 
					
						
							
								
									
										
										
										
											2019-10-22 16:57:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### Archives for each Package
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								On the "Artifacts" tab, there is a list of links to compressed archives for Angular packages. The
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								archive names are of the format `<package-name>-pr<pr-number>-<sha>.tgz`  (for example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`core-pr12345-a1b2c3d.tgz` ). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								One can use the URL to the `.tgz`  file for each package to install them as dependencies in a
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								project they need to test the Pull Request changes against. Both
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[npm ](https://docs.npmjs.com/cli/install.html ) and [yarn ](https://yarnpkg.com/lang/en/docs/cli/add )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								support installing dependencies from URLs to `.tgz`  files, for example by updating the dependencies
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								in `package.json`  to point to the artifact URLs and then running `npm/yarn install` :
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"dependencies": {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "@angular/common ": "https://< ... > .circle-artifacts.com/0/angular/common-pr12345-a1b2c3d.tgz",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "@angular/core ": "https://< ... > .circle-artifacts.com/0/angular/core-pr12345-a1b2c3d.tgz",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "...": "..."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### Download all Packages
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								In addition to the individual package archives, a `.tgz`  file including all packages is also
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								available (named `all-pr<pr-number>-<sha>.tgz` ). This can be used if one prefers to download all
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								packages locally and test them by either of the following ways:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Update the dependencies in `package.json`  to point to the local uncompressed package directories. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  Directly copy the local uncompressed package directories into the `node_modules/`  directory of a 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   project.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Note that (while faster) the second approach has limitations. For example:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								a. Any transitive dependencies of the copied packages will not be automatically updated.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								b. The packages need to be copied over every time `npm/yarn install`  is run.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								c. Some package managers (such as `pnpm`  or `yarn pnp` ) might not work correctly.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-18 11:06:30 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Publishing to GitHub Repos
  
						 
					
						
							
								
									
										
										
										
											2019-10-22 16:57:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You can also manually publish `*-builds`  snapshots just like our CircleCI build does for upstream
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								builds. Before being able to publish the packages, you need to build them locally by running the
							 
						 
					
						
							
								
									
										
										
										
											2020-02-29 22:25:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`./scripts/build/build-packages-dist.js`  script. 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								First time, you need to create the GitHub repositories:
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								``` shell
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$ export TOKEN=[get one from https://github.com/settings/tokens]
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ CREATE_REPOS=1 ./scripts/ci/publish-build-artifacts.sh [GitHub username]
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								For subsequent snapshots, just run:
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								``` shell
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ ./scripts/ci/publish-build-artifacts.sh [GitHub username]
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 11:19:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2016-12-20 22:52:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The script will publish the build snapshot to a branch with the same name as your current branch,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								and create it if it doesn't exist.
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 08:03:37 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Bazel Support
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-11 12:03:59 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### IDEs
  
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-11 12:03:59 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#### VS Code
  
						 
					
						
							
								
									
										
										
										
											2018-11-21 08:03:37 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Install [Bazel ](https://marketplace.visualstudio.com/items?itemName=DevonDCarew.bazel-code ) extension for VS Code. 
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-11 12:03:59 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#### WebStorm / IntelliJ
  
						 
					
						
							
								
									
										
										
										
											2019-02-28 20:09:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  Install the [Bazel ](https://plugins.jetbrains.com/plugin/8609-bazel ) plugin 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  You can find the settings under `Preferences->Other Settings->Bazel Settings`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								It will automatically recognize `*.bazel`  and `*.bzl`  files.
							 
						 
					
						
							
								
									
										
										
										
											2019-10-11 12:03:59 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Remote Build Execution and Remote Caching
  
						 
					
						
							
								
									
										
										
										
											2019-11-18 13:45:37 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Bazel builds in the Angular repository use a shared cache.  When a build occurs a hash of the inputs is computed
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								and checked against available outputs in the shared cache.  If an output is found, it is used as the output for the
							 
						 
					
						
							
								
									
										
										
										
											2019-10-17 12:04:06 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								build action rather than performing the build locally.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-18 13:45:37 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								>  Remote Build Execution requires authentication as a google.com or angular.io account.
  
						 
					
						
							
								
									
										
										
										
											2019-10-11 12:03:59 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 15:49:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#### --config=remote flag
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The `--config=remote`  flag can be added to enable remote execution of builds.  This flag can be added to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								the `.bazelrc.user`  file using the script at `scripts/local-dev/setup-rbe.sh` .