Skip to content

Commit 245dccc

Browse files
josephperrottalxhub
authored andcommitted
build: update config flags for snapshot builds (#40095)
Update the config flags used for snapshot builds and release builds. PR Close #40095
1 parent c44baa4 commit 245dccc

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

.bazelrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ build --nobuild_runfile_links
4747
# Releases should always be stamped with version control info
4848
# This command assumes node on the path and is a workaround for
4949
# https://github.com/bazelbuild/bazel/issues/4802
50-
build:release --workspace_status_command="yarn -s ng-dev release build-env-stamp"
50+
build:release --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=release"
5151
build:release --stamp
5252

53+
# Snapshots should also be stamped with version control information.
54+
build:snapshot --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=snapshot"
55+
build:snapshot --stamp
56+
5357
###############################
5458
# Output #
5559
###############################

.ng-dev/release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const release: ReleaseConfig = {
2626
// The buildTargetPackages function is loaded at runtime as the loading the script causes an
2727
// invocation of bazel.
2828
const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder'));
29-
return buildTargetPackages('dist/release-output', false, 'Release');
29+
return buildTargetPackages('dist/release-output', false, 'Release', true);
3030
},
3131
// TODO: This can be removed once there is an org-wide tool for changelog generation.
3232
generateReleaseNotesForHead: async () => {

scripts/build/package-builder.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ module.exports = {
6262
* This path should either be absolute or relative to the project root.
6363
* @param {boolean} enableIvy True, if Ivy should be used.
6464
* @param {string} description Human-readable description of the build.
65+
* @param {boolean?} isRelease True, if the build should be stamped for a release.
6566
* @returns {Array<{name: string, outputPath: string}} A list of packages built.
6667
*/
67-
function buildTargetPackages(destPath, enableIvy, description) {
68+
function buildTargetPackages(destPath, enableIvy, description, isRelease = false) {
6869
console.info('##################################');
6970
console.info(`${scriptPath}:`);
7071
console.info(' Building @angular/* npm packages');
@@ -80,9 +81,10 @@ function buildTargetPackages(destPath, enableIvy, description) {
8081
bazelCmd} query --output=label "attr('tags', '\\[.*release-with-framework.*\\]', //packages/...) intersect kind('ng_package|pkg_npm', //packages/...)"`;
8182
const targets = exec(getTargetsCmd, true).split(/\r?\n/);
8283

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

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

0 commit comments

Comments
 (0)