A previous commit implemented a streamlined performance metric reporting system for the compiler-cli, controlled via the compiler option `tracePerformance`. This commit adds a custom Bazel flag rule //packages/compiler-cli:ng_perf to the repository, and wires it through to the `ng_module` implementation such that if the flag is set, `ng_module` will produce perf results as part of the build. The underlying mechanism of `//:ng_perf` is not exported from `@angular/bazel` as a public rule that consumers can use, so there is little risk of accidental dependency on the contents of these perf traces. An alias is added so that `--ng_perf` is a Bazel flag which works in our repository. PR Close #41125
		
			
				
	
	
		
			158 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			158 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # Enable debugging tests with --config=debug
 | |
| test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
 | |
| 
 | |
| ###############################
 | |
| # Filesystem interactions     #
 | |
| ###############################
 | |
| 
 | |
| # Create symlinks in the project:
 | |
| # - dist/bin for outputs
 | |
| # - dist/testlogs, dist/genfiles
 | |
| # - bazel-out
 | |
| # NB: bazel-out should be excluded from the editor configuration.
 | |
| # The checked-in /.vscode/settings.json does this for VSCode.
 | |
| # Other editors may require manual config to ignore this directory.
 | |
| # In the past, we say a problem where VSCode traversed a massive tree, opening file handles and
 | |
| # eventually a surprising failure with auto-discovery of the C++ toolchain in
 | |
| # MacOS High Sierra.
 | |
| # See https://github.com/bazelbuild/bazel/issues/4603
 | |
| build --symlink_prefix=dist/
 | |
| 
 | |
| # Turn off legacy external runfiles
 | |
| build --nolegacy_external_runfiles
 | |
| run --nolegacy_external_runfiles
 | |
| test --nolegacy_external_runfiles
 | |
| 
 | |
| # Turn on --incompatible_strict_action_env which was on by default
 | |
| # in Bazel 0.21.0 but turned off again in 0.22.0. Follow
 | |
| # https://github.com/bazelbuild/bazel/issues/7026 for more details.
 | |
| # This flag is needed to so that the bazel cache is not invalidated
 | |
| # when running bazel via `yarn bazel`.
 | |
| # See https://github.com/angular/angular/issues/27514.
 | |
| build --incompatible_strict_action_env
 | |
| run --incompatible_strict_action_env
 | |
| test --incompatible_strict_action_env
 | |
| 
 | |
| # Do not build runfile trees by default. If an execution strategy relies on runfile
 | |
| # symlink teee, the tree is created on-demand. See: https://github.com/bazelbuild/bazel/issues/6627
 | |
| # and https://github.com/bazelbuild/bazel/commit/03246077f948f2790a83520e7dccc2625650e6df
 | |
| build --nobuild_runfile_links
 | |
| 
 | |
| ###############################
 | |
| # Release support             #
 | |
| # Turn on these settings with #
 | |
| #  --config=release           #
 | |
| ###############################
 | |
| 
 | |
| # Releases should always be stamped with version control info
 | |
| # This command assumes node on the path and is a workaround for
 | |
| # https://github.com/bazelbuild/bazel/issues/4802
 | |
| build:release --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=release"
 | |
| build:release --stamp
 | |
| 
 | |
| # Snapshots should also be stamped with version control information.
 | |
| build:snapshot --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=snapshot"
 | |
| build:snapshot --stamp
 | |
| 
 | |
| ###############################
 | |
| # Output                      #
 | |
| ###############################
 | |
| 
 | |
| # A more useful default output mode for bazel query
 | |
| # Prints eg. "ng_module rule //foo:bar" rather than just "//foo:bar"
 | |
| query --output=label_kind
 | |
| 
 | |
| # By default, failing tests don't print any output, it goes to the log file
 | |
| test --test_output=errors
 | |
| 
 | |
| ################################
 | |
| # Settings for CircleCI        #
 | |
| ################################
 | |
| 
 | |
| # Bazel flags for CircleCI are in /.circleci/bazel.linux.rc and /.circleci/bazel.windows.rc
 | |
| 
 | |
| ##################################
 | |
| # Settings for integration tests #
 | |
| ##################################
 | |
| 
 | |
| # Trick bazel into treating BUILD files under integration/bazel as being regular files
 | |
| # This lets us glob() up all the files inside this integration test to make them inputs to tests
 | |
| # (Note, we cannot use common --deleted_packages because the bazel version command doesn't support it)
 | |
| build --deleted_packages=integration/bazel,integration/bazel/src,integration/bazel/src/hello-world,integration/bazel/test,integration/bazel/tools,integration/bazel/test/e2e
 | |
| query --deleted_packages=integration/bazel,integration/bazel/src,integration/bazel/src/hello-world,integration/bazel/test,integration/bazel/tools,integration/bazel/test/e2e
 | |
| 
 | |
| ################################
 | |
| # Temporary Settings for Ivy   #
 | |
| ################################
 | |
| # To determine if the compiler used should be Ivy instead of ViewEngine, one can use `--config=ivy`
 | |
| # on any bazel target. This is a temporary flag until codebase is permanently switched to Ivy.
 | |
| build --define=angular_ivy_enabled=False
 | |
| 
 | |
| build:view-engine --define=angular_ivy_enabled=False
 | |
| build:ivy --define=angular_ivy_enabled=True
 | |
| 
 | |
| ##################################
 | |
| # Remote Build Execution support #
 | |
| # Turn on these settings with    #
 | |
| #  --config=remote               #
 | |
| ##################################
 | |
| 
 | |
| # The following --define=EXECUTOR=remote will be able to be removed
 | |
| # once https://github.com/bazelbuild/bazel/issues/7254 is fixed
 | |
| build:remote --define=EXECUTOR=remote
 | |
| 
 | |
| # Set a higher timeout value, just in case.
 | |
| build:remote --remote_timeout=600
 | |
| 
 | |
| # Increase the default number of jobs by 50% because our build has lots of
 | |
| # parallelism
 | |
| build:remote --jobs=150
 | |
| build:remote --google_default_credentials
 | |
| 
 | |
| # Force remote exeuctions to consider the entire run as linux
 | |
| build:remote --cpu=k8
 | |
| build:remote --host_cpu=k8
 | |
| 
 | |
| # Toolchain and platform related flags
 | |
| build:remote --host_javabase=@rbe_ubuntu1604_angular//java:jdk
 | |
| build:remote --javabase=@rbe_ubuntu1604_angular//java:jdk
 | |
| build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
 | |
| build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
 | |
| build:remote --crosstool_top=@rbe_ubuntu1604_angular//cc:toolchain
 | |
| build:remote --extra_toolchains=@rbe_ubuntu1604_angular//config:cc-toolchain
 | |
| build:remote --extra_execution_platforms=//tools:rbe_ubuntu1604-angular
 | |
| build:remote --host_platform=//tools:rbe_ubuntu1604-angular
 | |
| build:remote --platforms=//tools:rbe_ubuntu1604-angular
 | |
| 
 | |
| # Remote instance and caching
 | |
| build:remote --remote_instance_name=projects/internal-200822/instances/default_instance
 | |
| build:remote --project_id=internal-200822
 | |
| build:remote --remote_cache=remotebuildexecution.googleapis.com
 | |
| build:remote --remote_executor=remotebuildexecution.googleapis.com
 | |
| 
 | |
| ##################################
 | |
| # Saucelabs tests settings       #
 | |
| # Turn on these settings with    #
 | |
| #  --config=saucelabs            #
 | |
| ##################################
 | |
| 
 | |
| # For saucelabs tests we don't want to enable flaky test attempts. Karma has its own integrated
 | |
| # retry mechanism and we do not want to retry unnecessarily if Karma already tried multiple times.
 | |
| test:saucelabs --flaky_test_attempts=1
 | |
| 
 | |
| ################
 | |
| # Flag Aliases #
 | |
| ################
 | |
| 
 | |
| # --ng_perf will ask the Ivy compiler to produce performance results for each build.
 | |
| build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf
 | |
| 
 | |
| ####################################################
 | |
| # User bazel configuration
 | |
| # NOTE: This needs to be the *last* entry in the config.
 | |
| ####################################################
 | |
| 
 | |
| # Load any settings which are specific to the current user. Needs to be *last* statement
 | |
| # in this config, as the user configuration should be able to overwrite flags from this file.
 | |
| try-import .bazelrc.user
 |