From edf5013405c60813f9c0e27ef3be5bfc5881275a Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Mon, 6 Mar 2023 22:04:50 -0800 Subject: [PATCH] build: use JS_BINARY__TARGET instead of BAZEL_BINDIR (#48795) `BAZEL_BINDIR` is set for build targets only while `JS_BINARY__TARGET` should be set for all js_binary & js_test targets for bazel build, test & run contexts. --- .mocharc.js | 2 +- babel.config.jest.js | 2 +- client/build-config/src/paths.ts | 2 +- client/build-config/src/webpack/getCacheConfig.ts | 2 +- jest.config.base.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.mocharc.js b/.mocharc.js index 0eb106b1300..7659d56b29a 100644 --- a/.mocharc.js +++ b/.mocharc.js @@ -1,4 +1,4 @@ -const IS_BAZEL = !!(process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST) const rootDir = IS_BAZEL ? process.cwd() : __dirname module.exports = { diff --git a/babel.config.jest.js b/babel.config.jest.js index e85d8ead46f..865fa52d2dd 100644 --- a/babel.config.jest.js +++ b/babel.config.jest.js @@ -8,7 +8,7 @@ const path = require('path') const logger = require('signale') // TODO(bazel): drop when non-bazel removed. -if (!(process.env.BAZEL_BINDIR || process.env.BAZEL_TEST)) { +if (!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST)) { throw new Error(__filename + ' is only for use with Bazel') } diff --git a/client/build-config/src/paths.ts b/client/build-config/src/paths.ts index ed058dcd64d..77988a12c50 100644 --- a/client/build-config/src/paths.ts +++ b/client/build-config/src/paths.ts @@ -3,7 +3,7 @@ import fs from 'fs' import path from 'path' // TODO(bazel): drop when non-bazel removed. -const IS_BAZEL = !!(process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST) // NOTE: use fs.realpathSync() in addition to path.resolve() to resolve // symlinks to the real path. This is required for webpack plugins using diff --git a/client/build-config/src/webpack/getCacheConfig.ts b/client/build-config/src/webpack/getCacheConfig.ts index 331794c9f6d..b69872e713a 100644 --- a/client/build-config/src/webpack/getCacheConfig.ts +++ b/client/build-config/src/webpack/getCacheConfig.ts @@ -5,7 +5,7 @@ import webpack from 'webpack' import { ROOT_PATH } from '../paths' // TODO(bazel): drop when non-bazel removed. -const IS_BAZEL = !!process.env.BAZEL_BINDIR +const IS_BAZEL = !!process.env.JS_BINARY__TARGET interface CacheConfigOptions { invalidateCacheFiles?: string[] diff --git a/jest.config.base.js b/jest.config.base.js index 6f1070eacb1..ebaa300e840 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -3,7 +3,7 @@ const path = require('path') // TODO(bazel): drop when non-bazel removed. -const IS_BAZEL = !!(process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) +const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_TEST) const SRC_EXT = IS_BAZEL ? 'js' : 'ts' const rootDir = IS_BAZEL ? process.cwd() : __dirname