[dev/build] avoid building packages twice (#24696)
This commit is contained in:
parent
84e77de924
commit
9cf22cbc99
6 changed files with 18 additions and 14 deletions
6
packages/kbn-pm/dist/index.js
vendored
6
packages/kbn-pm/dist/index.js
vendored
|
@ -48389,7 +48389,7 @@ Object.defineProperty(exports, "__esModule", {
|
|||
exports.buildProductionProjects = undefined;
|
||||
|
||||
let buildProductionProjects = exports.buildProductionProjects = (() => {
|
||||
var _ref = _asyncToGenerator(function* ({ kibanaRoot, buildRoot }) {
|
||||
var _ref = _asyncToGenerator(function* ({ kibanaRoot, buildRoots }) {
|
||||
const projects = yield getProductionProjects(kibanaRoot);
|
||||
const projectGraph = (0, _projects.buildProjectGraph)(projects);
|
||||
const batchedProjects = (0, _projects.topologicallyBatchProjects)(projects, projectGraph);
|
||||
|
@ -48401,7 +48401,9 @@ let buildProductionProjects = exports.buildProductionProjects = (() => {
|
|||
for (const project of batch) {
|
||||
yield deleteTarget(project);
|
||||
yield buildProject(project);
|
||||
yield copyToBuild(project, kibanaRoot, buildRoot);
|
||||
for (const buildRoot of buildRoots) {
|
||||
yield copyToBuild(project, kibanaRoot, buildRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -39,10 +39,10 @@ import {
|
|||
|
||||
export async function buildProductionProjects({
|
||||
kibanaRoot,
|
||||
buildRoot,
|
||||
buildRoots,
|
||||
}: {
|
||||
kibanaRoot: string;
|
||||
buildRoot: string;
|
||||
buildRoots: string[];
|
||||
}) {
|
||||
const projects = await getProductionProjects(kibanaRoot);
|
||||
const projectGraph = buildProjectGraph(projects);
|
||||
|
@ -55,7 +55,9 @@ export async function buildProductionProjects({
|
|||
for (const project of batch) {
|
||||
await deleteTarget(project);
|
||||
await buildProject(project);
|
||||
await copyToBuild(project, kibanaRoot, buildRoot);
|
||||
for (const buildRoot of buildRoots) {
|
||||
await copyToBuild(project, kibanaRoot, buildRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ describe('kbn-pm production', () => {
|
|||
});
|
||||
}
|
||||
|
||||
await buildProductionProjects({ kibanaRoot: tmpDir, buildRoot });
|
||||
await buildProductionProjects({ kibanaRoot: tmpDir, buildRoots: [buildRoot] });
|
||||
|
||||
const files = await globby(['**/*', '!**/node_modules/**'], {
|
||||
cwd: buildRoot,
|
||||
|
|
|
@ -69,7 +69,7 @@ describe('dev/build/lib/runner', () => {
|
|||
const runTask = sinon.stub();
|
||||
await run({ global: true, run: runTask });
|
||||
sinon.assert.calledOnce(runTask);
|
||||
sinon.assert.calledWithExactly(runTask, config, log);
|
||||
sinon.assert.calledWithExactly(runTask, config, log, sinon.match.array);
|
||||
});
|
||||
|
||||
it('does not call local tasks', async () => {
|
||||
|
@ -91,7 +91,7 @@ describe('dev/build/lib/runner', () => {
|
|||
const runTask = sinon.stub();
|
||||
await run({ global: true, run: runTask });
|
||||
sinon.assert.calledOnce(runTask);
|
||||
sinon.assert.calledWithExactly(runTask, config, log);
|
||||
sinon.assert.calledWithExactly(runTask, config, log, sinon.match.array);
|
||||
});
|
||||
|
||||
it('runs local tasks twice, passing config log and both builds', async () => {
|
||||
|
@ -114,7 +114,7 @@ describe('dev/build/lib/runner', () => {
|
|||
const runTask = sinon.stub();
|
||||
await run({ global: true, run: runTask });
|
||||
sinon.assert.calledOnce(runTask);
|
||||
sinon.assert.calledWithExactly(runTask, config, log);
|
||||
sinon.assert.calledWithExactly(runTask, config, log, sinon.match.array);
|
||||
});
|
||||
|
||||
it('runs local tasks once, passing config log and default build', async () => {
|
||||
|
@ -136,7 +136,7 @@ describe('dev/build/lib/runner', () => {
|
|||
const runTask = sinon.stub();
|
||||
await run({ global: true, run: runTask });
|
||||
sinon.assert.calledOnce(runTask);
|
||||
sinon.assert.calledWithExactly(runTask, config, log);
|
||||
sinon.assert.calledWithExactly(runTask, config, log, sinon.match.array);
|
||||
});
|
||||
|
||||
it('runs local tasks once, passing config log and oss build', async () => {
|
||||
|
|
|
@ -82,7 +82,7 @@ export function createRunner({ config, log, buildOssDist, buildDefaultDist }) {
|
|||
*/
|
||||
return async function run(task) {
|
||||
if (task.global) {
|
||||
await execTask(chalk`{dim [ global ]} ${task.description}`, task.run);
|
||||
await execTask(chalk`{dim [ global ]} ${task.description}`, task.run, builds);
|
||||
} else {
|
||||
for (const build of builds) {
|
||||
await execTask(`${build.getLogTag()} ${task.description}`, task.run, build);
|
||||
|
|
|
@ -67,12 +67,12 @@ import { buildProductionProjects } from '@kbn/pm';
|
|||
*/
|
||||
|
||||
export const BuildPackagesTask = {
|
||||
global: true,
|
||||
description: 'Building distributable versions of packages',
|
||||
async run(config, log, build) {
|
||||
async run(config, log, builds) {
|
||||
await buildProductionProjects({
|
||||
kibanaRoot: config.resolveFromRepo(),
|
||||
buildRoot: build.resolvePath(),
|
||||
oss: build.isOss(),
|
||||
buildRoots: builds.map(build => build.resolvePath()),
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue