refactor(dev-infra): remove invoke bazel clean command from release tool (#42101)

Currently the ng-dev release tool always run `bazel clean` before
calling the configured build release function. The clean is necessary
to ensure the release output is actually built; and not restored
from previous builds which could have different bazel workspace
status variables (which provide the NPM package version).

Instead of doing this as part of the release tool, the
actual script running to build the release output should
run the `bazel clean`. The release tool does not intend to
know about details on how the release output is built. This
is necessary because the build setup could vary between version
branches (especially for older ones; such as LTS version branches).

PR Close #42101
This commit is contained in:
Paul Gschwendtner
2021-05-14 20:23:52 +02:00
committed by Zach Arend
parent 3aec55b626
commit 7fb8527e1e
5 changed files with 11 additions and 40 deletions
+10
View File
@@ -81,6 +81,16 @@ function buildTargetPackages(destDir, enableIvy, description, isRelease = false)
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/);
// If we are in release mode, run `bazel clean` to ensure the execroot and action cache
// are not populated. This is necessary because targets using `npm_package` rely on
// workspace status variables for the package version. Such NPM package targets are not
// rebuilt if only the workspace status variables change. This could result in accidental
// re-use of previously built package output with a different `version` in the `package.json`.
if (isRelease) {
console.info('Building in release mode. Resetting the Bazel execroot and action cache..');
exec(`${bazelCmd} clean`);
}
// 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=${