Skip to content

Commit

Permalink
chore(NA): update kbn pm with last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Jan 27, 2021
1 parent e705f84 commit e2116db
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47982,28 +47982,16 @@ async function readBazelToolsVersionFile(repoRootPath, versionFilename) {
const version = (await Object(_fs__WEBPACK_IMPORTED_MODULE_2__["readFile"])(Object(path__WEBPACK_IMPORTED_MODULE_0__["resolve"])(repoRootPath, versionFilename))).toString().split('\n')[0];

if (!version) {
throw new Error(`${versionFilename} file do not contain any version set`);
throw new Error(`[bazel_tools] Failed on reading bazel tools versions\n ${versionFilename} file do not contain any version set`);
}

return version;
}

async function readBazelToolsVersion(repoRootPath) {
try {
const bazeliskVersion = await readBazelToolsVersionFile(repoRootPath, '.bazeliskversion');
const bazelVersion = await readBazelToolsVersionFile(repoRootPath, '.bazelversion');
return {
bazelisk: bazeliskVersion,
bazel: bazelVersion
};
} catch (e) {
throw new Error(`[bazel_tools] Failed on reading bazel tools versions\n ${e}`);
}
}

async function installBazelTools(repoRootPath) {
_log__WEBPACK_IMPORTED_MODULE_3__["log"].debug(`[bazel_tools] reading bazel tools versions from version files`);
const bazelToolsVersions = await readBazelToolsVersion(repoRootPath); // Check what globals are installed
const bazeliskVersion = await readBazelToolsVersionFile(repoRootPath, '.bazeliskversion');
const bazelVersion = await readBazelToolsVersionFile(repoRootPath, '.bazelversion'); // Check what globals are installed

_log__WEBPACK_IMPORTED_MODULE_3__["log"].debug(`[bazel_tools] verify if bazelisk is installed`);
const {
Expand All @@ -48012,12 +48000,12 @@ async function installBazelTools(repoRootPath) {
stdio: 'pipe'
}); // Install bazelisk if not installed

if (!stdout.includes(`@bazel/bazelisk@${bazelToolsVersions.bazelisk}`)) {
if (!stdout.includes(`@bazel/bazelisk@${bazeliskVersion}`)) {
_log__WEBPACK_IMPORTED_MODULE_3__["log"].info(`[bazel_tools] installing Bazel tools`);
_log__WEBPACK_IMPORTED_MODULE_3__["log"].debug(`[bazel_tools] bazelisk is not installed. Installing @bazel/bazelisk@${bazelToolsVersions.bazelisk} and bazel@${bazelToolsVersions.bazel}`);
await Object(_child_process__WEBPACK_IMPORTED_MODULE_1__["spawn"])('yarn', ['global', 'add', `@bazel/bazelisk@${bazelToolsVersions.bazelisk}`], {
_log__WEBPACK_IMPORTED_MODULE_3__["log"].debug(`[bazel_tools] bazelisk is not installed. Installing @bazel/bazelisk@${bazeliskVersion} and bazel@${bazelVersion}`);
await Object(_child_process__WEBPACK_IMPORTED_MODULE_1__["spawn"])('yarn', ['global', 'add', `@bazel/bazelisk@${bazeliskVersion}`], {
env: {
USE_BAZEL_VERSION: bazelToolsVersions.bazel
USE_BAZEL_VERSION: bazelVersion
},
stdio: 'pipe'
});
Expand Down

0 comments on commit e2116db

Please sign in to comment.