build: update config flags for snapshot builds (#40095)

Update the config flags used for snapshot builds and release builds.

PR Close #40095
This commit is contained in:
Joey Perrott 2020-12-11 12:51:29 -08:00 committed by Alex Rickabaugh
parent c44baa4c5c
commit 245dccc478
3 changed files with 12 additions and 6 deletions

View File

@ -47,9 +47,13 @@ build --nobuild_runfile_links
# Releases should always be stamped with version control info # Releases should always be stamped with version control info
# This command assumes node on the path and is a workaround for # This command assumes node on the path and is a workaround for
# https://github.com/bazelbuild/bazel/issues/4802 # 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 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 # # Output #
############################### ###############################

View File

@ -26,7 +26,7 @@ export const release: ReleaseConfig = {
// The buildTargetPackages function is loaded at runtime as the loading the script causes an // The buildTargetPackages function is loaded at runtime as the loading the script causes an
// invocation of bazel. // invocation of bazel.
const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder')); 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. // TODO: This can be removed once there is an org-wide tool for changelog generation.
generateReleaseNotesForHead: async () => { generateReleaseNotesForHead: async () => {

View File

@ -62,9 +62,10 @@ module.exports = {
* This path should either be absolute or relative to the project root. * This path should either be absolute or relative to the project root.
* @param {boolean} enableIvy True, if Ivy should be used. * @param {boolean} enableIvy True, if Ivy should be used.
* @param {string} description Human-readable description of the build. * @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. * @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('##################################');
console.info(`${scriptPath}:`); console.info(`${scriptPath}:`);
console.info(' Building @angular/* npm packages'); 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/...)"`; 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/); const targets = exec(getTargetsCmd, true).split(/\r?\n/);
// Use `--config=release` so that snapshot builds get published with embedded version info. // Use either `--config=snapshot` or `--config=release` so that builds are created with the
exec(`${bazelCmd} build --config=release --config=${enableIvy ? 'ivy' : 'view-engine'} ${ // correct embedded version info.
targets.join(' ')}`); exec(`${bazelCmd} build --config=${isRelease ? 'release' : 'snapshot'} --config=${
enableIvy ? 'ivy' : 'view-engine'} ${targets.join(' ')}`);
// Create the output directory. // Create the output directory.
const absDestPath = resolve(baseDir, destPath); const absDestPath = resolve(baseDir, destPath);