Move bazel from being a shell function to being a script at build/bazel/bin/bazel

Bug: 254713799
Test: b build //packages/modules/adb/apex:com.android.adbd
Change-Id: I6a0a89438a46d8252c3e0c24319038b0cf2dbd59
This commit is contained in:
Joe Onorato
2022-10-24 06:38:11 -07:00
parent 3b13b61d9d
commit ba29f380d3
6 changed files with 7 additions and 8 deletions

View File

@@ -572,7 +572,7 @@ func (r *builtinBazelRunner) createBazelCommand(paths *bazelPaths, runName bazel
"HOME=" + paths.homeDir, "HOME=" + paths.homeDir,
pwdPrefix(), pwdPrefix(),
"BUILD_DIR=" + absolutePath(paths.soongOutDir), "BUILD_DIR=" + absolutePath(paths.soongOutDir),
// Make OUT_DIR absolute here so tools/bazel.sh uses the correct // Make OUT_DIR absolute here so build/bazel/bin/bazel uses the correct
// OUT_DIR at <root>/out, instead of <root>/out/soong/workspace/out. // OUT_DIR at <root>/out, instead of <root>/out/soong/workspace/out.
"OUT_DIR=" + absolutePath(paths.outDir()), "OUT_DIR=" + absolutePath(paths.outDir()),
// Disables local host detection of gcc; toolchain information is defined // Disables local host detection of gcc; toolchain information is defined

View File

@@ -62,7 +62,7 @@ df -h || true
echo echo
echo "Running Bazel smoke test..." echo "Running Bazel smoke test..."
STANDALONE_BAZEL=true "${TOP}/tools/bazel" --batch --max_idle_secs=1 help STANDALONE_BAZEL=true "${TOP}/build/bazel/bin/bazel" --batch --max_idle_secs=1 help
echo echo
echo "Running Soong test..." echo "Running Soong test..."

View File

@@ -34,7 +34,7 @@ SOONG_OUTPUT_DIR="$OUTPUT_DIR/soong"
BAZEL_OUTPUT_DIR="$OUTPUT_DIR/bazel" BAZEL_OUTPUT_DIR="$OUTPUT_DIR/bazel"
function call_bazel() { function call_bazel() {
tools/bazel --output_base="$BAZEL_OUTPUT_DIR" $@ build/bazel/bin/bazel --output_base="$BAZEL_OUTPUT_DIR" $@
} }
function cleanup { function cleanup {

View File

@@ -128,7 +128,6 @@ function create_mock_bazel {
symlink_file WORKSPACE symlink_file WORKSPACE
symlink_file BUILD symlink_file BUILD
symlink_file tools/bazel
} }
function run_bazel { function run_bazel {
@@ -136,7 +135,7 @@ function run_bazel {
# output should not be parsed as such. # output should not be parsed as such.
rm -rf out/ninja_build rm -rf out/ninja_build
tools/bazel "$@" build/bazel/bin/bazel "$@"
} }
function run_ninja { function run_ninja {

View File

@@ -85,9 +85,9 @@ func runBazel(ctx Context, config Config) {
bazelEnv["SHELL"] = "/bin/bash" bazelEnv["SHELL"] = "/bin/bash"
// `tools/bazel` is the default entry point for executing Bazel in the AOSP // `build/bazel/bin/bazel` is the default entry point for executing Bazel in the AOSP
// source tree. // source tree.
bazelExecutable := filepath.Join("tools", "bazel") bazelExecutable := filepath.Join("build", "bazel", "bin", "bazel")
cmd := Command(ctx, config, "bazel", bazelExecutable) cmd := Command(ctx, config, "bazel", bazelExecutable)
// Append custom startup flags to the Bazel command. Startup flags affect // Append custom startup flags to the Bazel command. Startup flags affect

View File

@@ -396,7 +396,7 @@ func runSoong(ctx Context, config Config) {
soongBuildEnv := config.Environment().Copy() soongBuildEnv := config.Environment().Copy()
soongBuildEnv.Set("TOP", os.Getenv("TOP")) soongBuildEnv.Set("TOP", os.Getenv("TOP"))
// For Bazel mixed builds. // For Bazel mixed builds.
soongBuildEnv.Set("BAZEL_PATH", "./tools/bazel") soongBuildEnv.Set("BAZEL_PATH", "./build/bazel/bin/bazel")
// Bazel's HOME var is set to an output subdirectory which doesn't exist. This // Bazel's HOME var is set to an output subdirectory which doesn't exist. This
// prevents Bazel from file I/O in the actual user HOME directory. // prevents Bazel from file I/O in the actual user HOME directory.
soongBuildEnv.Set("BAZEL_HOME", absPath(ctx, filepath.Join(config.BazelOutDir(), "bazelhome"))) soongBuildEnv.Set("BAZEL_HOME", absPath(ctx, filepath.Join(config.BazelOutDir(), "bazelhome")))