From 245dccc4782d64395cbd915debb3ff8f4e2828d7 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Fri, 11 Dec 2020 12:51:29 -0800 Subject: [PATCH] build: update config flags for snapshot builds (#40095) Update the config flags used for snapshot builds and release builds. PR Close #40095 --- .bazelrc | 6 +++++- .ng-dev/release.ts | 2 +- scripts/build/package-builder.js | 10 ++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.bazelrc b/.bazelrc index 1f07b2fb6d..615785d2b2 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 # ############################### diff --git a/.ng-dev/release.ts b/.ng-dev/release.ts index 1867eab1b3..49aa2af849 100644 --- a/.ng-dev/release.ts +++ b/.ng-dev/release.ts @@ -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 () => { diff --git a/scripts/build/package-builder.js b/scripts/build/package-builder.js index bb0c90b688..530a286f67 100644 --- a/scripts/build/package-builder.js +++ b/scripts/build/package-builder.js @@ -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'); @@ -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);