Skip to content

Commit

Permalink
build: lay foundation for migrating to ng-dev release tooling (#22167)
Browse files Browse the repository at this point in the history
Configure the release tooling from ng-dev.

(cherry picked from commit d66cb83)
  • Loading branch information
josephperrott authored and mmalerba committed Mar 15, 2021
1 parent 56851bf commit 97bad00
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .ng-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {github} from './github';
import {merge} from './merge';
import {commitMessage} from './commit-message';
import {caretaker} from './caretaker';
import {release} from './release';

module.exports = {
commitMessage,
format,
github,
merge,
caretaker,
release,
};
3 changes: 2 additions & 1 deletion .ng-dev/merge.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {DevInfraMergeConfig} from '@angular/dev-infra-private/pr/merge/config';
import {getDefaultTargetLabelConfiguration} from '@angular/dev-infra-private/pr/merge/defaults';
import {github} from './github';
import {release} from './release';

/**
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
Expand All @@ -22,6 +23,6 @@ export const merge: DevInfraMergeConfig['merge'] = async api => {
mergeReadyLabel: 'merge ready',
commitMessageFixupLabel: 'commit message fixup',
caretakerNoteLabel: 'caretaker note',
labels: await getDefaultTargetLabelConfiguration(api, github, '@angular/cdk'),
labels: await getDefaultTargetLabelConfiguration(api, github, release),
};
};
20 changes: 20 additions & 0 deletions .ng-dev/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {join} from 'path';
import {ReleaseConfig} from '@angular/dev-infra-private/release/config';
import {releasePackages} from '../tools/release/release-output/release-packages';
import {promptAndGenerateChangelog} from '../tools/release/changelog';

/** Configuration for the `ng-dev release` command. */
export const release: ReleaseConfig = {
publishRegistry: 'https://wombat-dressing-room.appspot.com',
npmPackages: releasePackages.map(pkg => `@angular/${pkg}`),
buildPackages: async () => {
// The performNpmReleaseBuild function is loaded at runtime as the loading the script causes an
// invocation of bazel.
const {performNpmReleaseBuild} = require(join(__dirname, '../scripts/build-packages-dist'));
return performNpmReleaseBuild();
},
// TODO: This can be removed once there is an org-wide tool for changelog generation.
generateReleaseNotesForHead: async () => {
await promptAndGenerateChangelog(join(__dirname, '../CHANGELOG.md'));
},
};
12 changes: 10 additions & 2 deletions scripts/build-packages-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ if (module === require.main) {

/** Builds the release packages for NPM. */
function performNpmReleaseBuild() {
buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ false);
return buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ false);
}

/**
* Builds the release packages as snapshot build. This means that the current
* Git HEAD SHA is included in the version (for easier debugging and back tracing).
*/
function performDefaultSnapshotBuild() {
buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ true);
return buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ true);
}

/**
Expand Down Expand Up @@ -103,6 +103,14 @@ function buildReleasePackages(useIvy, distPath, isSnapshotBuild) {
cp('-R', outputPath, targetFolder);
chmod('-R', 'u+w', targetFolder);
});

return packageNames.map(pkg => {
const outputPath = getOutputPath(pkg);
return {
name: `@angular/${pkg}`,
outputPath
}
})
}

/**
Expand Down

0 comments on commit 97bad00

Please sign in to comment.