From 2519f565972225fa26178e84923d4e02fd79190c Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 2 Mar 2021 23:26:53 -0500 Subject: [PATCH] chore(NA): look for bazel packages on npm_module folder during distributable build (#93262) (#93359) Co-authored-by: Tiago Costa --- packages/kbn-pm/dist/index.js | 11 +++++------ .../build_bazel_production_projects.ts | 17 ++++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index f9ddbcac1e09d..df9ab9b5515a9 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -59803,7 +59803,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(745); -/* harmony import */ var _utils_bazel_run__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(374); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(371); /* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(131); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(246); /* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(251); @@ -59832,7 +59832,7 @@ async function buildBazelProductionProjects({ const projects = await Object(_utils_projects__WEBPACK_IMPORTED_MODULE_8__["getBazelProjectsOnly"])(await Object(_build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_3__["getProductionProjects"])(kibanaRoot, onlyOSS)); const projectNames = [...projects.values()].map(project => project.name); _utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].info(`Preparing Bazel projects production build for [${projectNames.join(', ')}]`); - await Object(_utils_bazel_run__WEBPACK_IMPORTED_MODULE_4__["runBazel"])(['build', '//packages:build']); + await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["runBazel"])(['build', '//packages:build']); _utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].info(`All Bazel projects production builds for [${projectNames.join(', ')}] are complete}]`); for (const project of projects.values()) { @@ -59856,9 +59856,8 @@ async function copyToBuild(project, kibanaRoot, buildRoot) { // We want the package to have the same relative location within the build const relativeProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["relative"])(kibanaRoot, project.path); const buildProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["resolve"])(buildRoot, relativeProjectPath); - const bazelFilesToExclude = ['!*.sh.runfiles*', '!*.params', '!*_mappings.json', '!*_options.optionsvalid.d.ts', '!*_loader.js', '!*_require_patch.js', '!*.sh']; - await cpy__WEBPACK_IMPORTED_MODULE_0___default()(['**/*', '!node_modules/**', ...bazelFilesToExclude], buildProjectPath, { - cwd: Object(path__WEBPACK_IMPORTED_MODULE_2__["join"])(kibanaRoot, 'bazel', 'bin', 'packages', Object(path__WEBPACK_IMPORTED_MODULE_2__["basename"])(buildProjectPath)), + await cpy__WEBPACK_IMPORTED_MODULE_0___default()(['**/*'], buildProjectPath, { + cwd: Object(path__WEBPACK_IMPORTED_MODULE_2__["join"])(kibanaRoot, 'bazel', 'bin', 'packages', Object(path__WEBPACK_IMPORTED_MODULE_2__["basename"])(buildProjectPath), 'npm_module'), dot: true, onlyFiles: true, parents: true @@ -59880,7 +59879,7 @@ async function applyCorrectPermissions(project, kibanaRoot, buildRoot) { const buildProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["resolve"])(buildRoot, relativeProjectPath); const allPluginPaths = await globby__WEBPACK_IMPORTED_MODULE_1___default()([`**/*`], { onlyFiles: false, - cwd: Object(path__WEBPACK_IMPORTED_MODULE_2__["join"])(kibanaRoot, 'bazel', 'bin', 'packages', Object(path__WEBPACK_IMPORTED_MODULE_2__["basename"])(buildProjectPath)), + cwd: Object(path__WEBPACK_IMPORTED_MODULE_2__["join"])(kibanaRoot, 'bazel', 'bin', 'packages', Object(path__WEBPACK_IMPORTED_MODULE_2__["basename"])(buildProjectPath), 'npm_module'), dot: true }); diff --git a/packages/kbn-pm/src/production/build_bazel_production_projects.ts b/packages/kbn-pm/src/production/build_bazel_production_projects.ts index 1034253c5e0dc..313622d44276a 100644 --- a/packages/kbn-pm/src/production/build_bazel_production_projects.ts +++ b/packages/kbn-pm/src/production/build_bazel_production_projects.ts @@ -11,7 +11,7 @@ import globby from 'globby'; import { basename, join, relative, resolve } from 'path'; import { getProductionProjects } from './build_non_bazel_production_projects'; -import { runBazel } from '../utils/bazel/run'; +import { runBazel } from '../utils/bazel'; import { chmod, isFile, isDirectory } from '../utils/fs'; import { log } from '../utils/log'; import { @@ -60,18 +60,9 @@ async function copyToBuild(project: Project, kibanaRoot: string, buildRoot: stri // We want the package to have the same relative location within the build const relativeProjectPath = relative(kibanaRoot, project.path); const buildProjectPath = resolve(buildRoot, relativeProjectPath); - const bazelFilesToExclude = [ - '!*.sh.runfiles*', - '!*.params', - '!*_mappings.json', - '!*_options.optionsvalid.d.ts', - '!*_loader.js', - '!*_require_patch.js', - '!*.sh', - ]; - await copy(['**/*', '!node_modules/**', ...bazelFilesToExclude], buildProjectPath, { - cwd: join(kibanaRoot, 'bazel', 'bin', 'packages', basename(buildProjectPath)), + await copy(['**/*'], buildProjectPath, { + cwd: join(kibanaRoot, 'bazel', 'bin', 'packages', basename(buildProjectPath), 'npm_module'), dot: true, onlyFiles: true, parents: true, @@ -97,7 +88,7 @@ async function applyCorrectPermissions(project: Project, kibanaRoot: string, bui const buildProjectPath = resolve(buildRoot, relativeProjectPath); const allPluginPaths = await globby([`**/*`], { onlyFiles: false, - cwd: join(kibanaRoot, 'bazel', 'bin', 'packages', basename(buildProjectPath)), + cwd: join(kibanaRoot, 'bazel', 'bin', 'packages', basename(buildProjectPath), 'npm_module'), dot: true, });