Skip to content

Commit

Permalink
build: update config flags for snapshot builds (#40095)
Browse files Browse the repository at this point in the history
Update the config flags used for snapshot builds and release builds.

PR Close #40095
  • Loading branch information
josephperrott authored and alxhub committed Dec 15, 2020
1 parent e715a50 commit a1c82e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .bazelrc
Expand Up @@ -47,9 +47,13 @@ build --nobuild_runfile_links
# 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"
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 #
###############################
Expand Down
2 changes: 1 addition & 1 deletion .ng-dev/release.ts
Expand Up @@ -26,7 +26,7 @@ export const release: ReleaseConfig = {
// The buildTargetPackages function is loaded at runtime as the loading the script causes an
// invocation of bazel.
const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder'));
return buildTargetPackages('dist/release-output', false, 'Release');
return buildTargetPackages('dist/release-output', false, 'Release', true);
},
// TODO: This can be removed once there is an org-wide tool for changelog generation.
generateReleaseNotesForHead: async () => {
Expand Down
10 changes: 6 additions & 4 deletions scripts/build/package-builder.js
Expand Up @@ -62,9 +62,10 @@ module.exports = {
* This path should either be absolute or relative to the project root.
* @param {boolean} enableIvy True, if Ivy should be used.
* @param {string} description Human-readable description of the build.
* @param {boolean?} isRelease True, if the build should be stamped for a release.
* @returns {Array<{name: string, outputPath: string}} A list of packages built.
*/
function buildTargetPackages(destPath, enableIvy, description) {
function buildTargetPackages(destPath, enableIvy, description, isRelease = false) {
console.info('##################################');
console.info(`${scriptPath}:`);
console.info(' Building @angular/* npm packages');
Expand All @@ -80,9 +81,10 @@ function buildTargetPackages(destPath, enableIvy, description) {
bazelCmd} query --output=label "attr('tags', '\\[.*release-with-framework.*\\]', //packages/...) intersect kind('ng_package|pkg_npm', //packages/...)"`;
const targets = exec(getTargetsCmd, true).split(/\r?\n/);

// Use `--config=release` so that snapshot builds get published with embedded version info.
exec(`${bazelCmd} build --config=release --config=${enableIvy ? 'ivy' : 'view-engine'} ${
targets.join(' ')}`);
// Use either `--config=snapshot` or `--config=release` so that builds are created with the
// correct embedded version info.
exec(`${bazelCmd} build --config=${isRelease ? 'release' : 'snapshot'} --config=${
enableIvy ? 'ivy' : 'view-engine'} ${targets.join(' ')}`);

// Create the output directory.
const absDestPath = resolve(baseDir, destPath);
Expand Down

0 comments on commit a1c82e7

Please sign in to comment.