()
| 16 | let cached_bazel_executable: string | undefined; |
| 17 | |
| 18 | function getBazelCli(): string { |
| 19 | if (!cached_bazel_executable) { |
| 20 | const bazelBinEnv = process.env[BAZEL_BIN_ENV]; |
| 21 | if (bazelBinEnv) { |
| 22 | cached_bazel_executable = bazelBinEnv; |
| 23 | return bazelBinEnv; |
| 24 | } |
| 25 | |
| 26 | const found = BAZEL_EXECUTABLES.find(element => checkCommandExists(element)); |
| 27 | if (!found) { |
| 28 | throw new Error('Could not find bazel executable (bzl or bazel)'); |
| 29 | } |
| 30 | cached_bazel_executable = found; |
| 31 | } |
| 32 | |
| 33 | return cached_bazel_executable; |
| 34 | } |
| 35 | |
| 36 | function getBazelCommandString(baseCommand: string, extraArgs: string, quiet: boolean): string { |
| 37 | return `${getBazelCli()} ${BAZEL_PREFIXED_OPTIONS} ${baseCommand} ${extraArgs} ${quiet ? BAZEL_QUIET_OPTIONS : ''} ${BAZEL_POSTFIXED_OPTIONS}`.trim(); |
no test coverage detected