Skip to content

Commit

Permalink
build: do not use --config=release when building AIO for development (
Browse files Browse the repository at this point in the history
angular#48329)

When building AIO using `yarn build` the `--config=release` is added.
This was done as part of the Bazel migration to make sure the footer
shows a Git revision via Bazel stamping.

This does not provide enough benefits, compared to the downside of
reduced caching. Bazel will discard the analysis cache when the stamp
configuration changes.

This may happen easily when you work in framework where
`--config=release` is not used. Then when starting work in AIO: the
config changes and the cache is discarded. This may even mean that
existing framework package build artifacts may be discarded when an
AIO local build is started.

Co-authored-by: Joey Perrott <[email protected]>

PR Close angular#48329
  • Loading branch information
devversion authored and AndrewKushnir committed Dec 2, 2022
1 parent ef5b8a2 commit eb43ed2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion aio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ You should run all these tasks from the `angular/aio` folder.
Here are the most important tasks you might need to use:

* `yarn` - install all the dependencies.
* `yarn build` - create a production build of the application.
* `yarn build` - create a development build of the application.
* `yarn build-prod` - create a production build of the application.
* `yarn build-local` - same as `build`, but uses locally built Angular packages from source code rather than from npm.
* `yarn start` - run a development web server that watches, rebuilds, and reloads the page when there are changes to the source code or docs.
* `yarn start-local` - same as `start`, but uses local Angular packages.
Expand Down
3 changes: 2 additions & 1 deletion aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"postinstall": "node tools/cli-patches/patch.js",
"prebuild": "yarn setup",
"build": "bazel build //aio:build --config=release",
"build": "bazel build //aio:build",
"build-prod": "yarn build --config=release",
"build-local": "yarn build --config=aio_local_deps",
"lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint && yarn security-lint",
"test": "bazel test //aio:test --test_output=streamed",
Expand Down
2 changes: 1 addition & 1 deletion aio/scripts/build-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readonly deployedUrl=https://pr${prNumber}-${prLastSha:0:7}.ngbuilds.io/
cd $PROJECT_ROOT/aio

# Build and store the app
yarn build
yarn build-prod

# Remove write protection from the opensearch.xml in the Bazel
# output tree so that the url can be substituted.
Expand Down
2 changes: 1 addition & 1 deletion aio/scripts/deploy-to-firebase/pre-deploy-actions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default exp;
// Helpers
function build({deployedUrl, deployEnv}) {
u.logSectionHeader('Build the AIO app.');
u.yarn(`build --aio_build_config=${deployEnv}`);
u.yarn(`build-prod --aio_build_config=${deployEnv}`);

u.logSectionHeader('Remove write protection on the Bazel AIO distribution.');
sh.chmod('-R', 'u+w', BAZEL_DIST_DIR);
Expand Down
4 changes: 2 additions & 2 deletions aio/scripts/deploy-to-firebase/pre-deploy-actions.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('deploy-to-firebase/pre-deploy-actions:', () => {

it('should build the app for the appropriate mode', () => {
pre.build({deployedUrl: 'http://example.com/foo/', deployEnv: 'bar'});
expect(yarnSpy).toHaveBeenCalledWith('build --aio_build_config=bar');
expect(yarnSpy).toHaveBeenCalledWith('build-prod --aio_build_config=bar');
});

it('should remove write protection from the dist folder', () => {
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('deploy-to-firebase/pre-deploy-actions:', () => {

pre.build({deployedUrl: 'http://example.com/foo/', deployEnv: 'bar'});
expect(logs).toEqual([
'yarn build --aio_build_config=bar',
'yarn build-prod --aio_build_config=bar',
'chmod -R u+w ../dist/bin/aio/build',
'yarn set-opensearch-url http://example.com/foo/',
'cp -rf ../dist/bin/aio/build dist',
Expand Down

0 comments on commit eb43ed2

Please sign in to comment.