build: define the package building function for ng-dev release tooling (#39711)

The packages are built during the release process on demand via a function
defined locally in the ng-dev config.

PR Close #39711
This commit is contained in:
Joey Perrott 2020-11-12 11:01:01 -08:00 committed by Andrew Kushnir
parent 726d7c123c
commit d65c2e351f
2 changed files with 11 additions and 4 deletions

View File

@ -18,14 +18,16 @@ export const release: ReleaseConfig = {
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/platform-server',
'@angular/platform-webworker',
'@angular/platform-webworker-dynamic',
'@angular/router',
'@angular/service-worker',
'@angular/upgrade',
],
// TODO: Implement release package building here.
buildPackages: async () => [],
buildPackages: async () => {
// 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');
},
// TODO: This can be removed once there is an org-wide tool for changelog generation.
generateReleaseNotesForHead: async () => {
exec('yarn -s gulp changelog', {cwd: join(__dirname, '../')});

View File

@ -62,6 +62,7 @@ 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.
* @returns {Array<{name: string, outputPath: string}} A list of packages built.
*/
function buildTargetPackages(destPath, enableIvy, description) {
console.info('##################################');
@ -70,6 +71,8 @@ function buildTargetPackages(destPath, enableIvy, description) {
console.info(` Mode: ${description}`);
console.info('##################################');
/** The list of packages which were built. */
const builtPackages = [];
// List of targets to build, e.g. core, common, compiler, etc. Note that we want to also remove
// all carriage return (`\r`) characters form the query output, because otherwise the carriage
// return is part of the bazel target name and bazel will complain.
@ -97,10 +100,12 @@ function buildTargetPackages(destPath, enableIvy, description) {
rm('-rf', destDir);
cp('-R', srcDir, destDir);
chmod('-R', 'u+w', destDir);
builtPackages.push({name: `@angular/${pkg}`, outputPath: destDir});
}
});
console.info('');
return builtPackages;
}
/**