Merge "Allow extra startup and build args to be passed to Bazel." am: ccd3f1d66f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1493517 Change-Id: I2c79e37b6e7a63468e318652a8737d791e0adf6d
This commit is contained in:
@@ -34,13 +34,24 @@ func runBazel(ctx Context, config Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bazelExecutable := filepath.Join("tools", "bazel")
|
bazelExecutable := filepath.Join("tools", "bazel")
|
||||||
args := []string{
|
cmd := Command(ctx, config, "bazel", bazelExecutable)
|
||||||
"build",
|
|
||||||
"--output_groups=" + outputGroups,
|
if extra_startup_args, ok := cmd.Environment.Get("BAZEL_STARTUP_ARGS"); ok {
|
||||||
"//:" + config.TargetProduct() + "-" + config.TargetBuildVariant(),
|
cmd.Args = append(cmd.Args, strings.Fields(extra_startup_args)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := Command(ctx, config, "bazel", bazelExecutable, args...)
|
cmd.Args = append(cmd.Args,
|
||||||
|
"build",
|
||||||
|
"--output_groups="+outputGroups,
|
||||||
|
)
|
||||||
|
|
||||||
|
if extra_build_args, ok := cmd.Environment.Get("BAZEL_BUILD_ARGS"); ok {
|
||||||
|
cmd.Args = append(cmd.Args, strings.Fields(extra_build_args)...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.Args = append(cmd.Args,
|
||||||
|
"//:"+config.TargetProduct()+"-"+config.TargetBuildVariant(),
|
||||||
|
)
|
||||||
|
|
||||||
cmd.Environment.Set("DIST_DIR", config.DistDir())
|
cmd.Environment.Set("DIST_DIR", config.DistDir())
|
||||||
cmd.Environment.Set("SHELL", "/bin/bash")
|
cmd.Environment.Set("SHELL", "/bin/bash")
|
||||||
@@ -51,12 +62,16 @@ func runBazel(ctx Context, config Config) {
|
|||||||
cmd.RunAndStreamOrFatal()
|
cmd.RunAndStreamOrFatal()
|
||||||
|
|
||||||
// Obtain the Bazel output directory for ninja_build.
|
// Obtain the Bazel output directory for ninja_build.
|
||||||
infoArgs := []string{
|
infoCmd := Command(ctx, config, "bazel", bazelExecutable)
|
||||||
"info",
|
|
||||||
"output_path",
|
if extra_startup_args, ok := infoCmd.Environment.Get("BAZEL_STARTUP_ARGS"); ok {
|
||||||
|
infoCmd.Args = append(infoCmd.Args, strings.Fields(extra_startup_args)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
infoCmd := Command(ctx, config, "bazel", bazelExecutable, infoArgs...)
|
infoCmd.Args = append(infoCmd.Args,
|
||||||
|
"info",
|
||||||
|
"output_path",
|
||||||
|
)
|
||||||
|
|
||||||
infoCmd.Environment.Set("DIST_DIR", config.DistDir())
|
infoCmd.Environment.Set("DIST_DIR", config.DistDir())
|
||||||
infoCmd.Environment.Set("SHELL", "/bin/bash")
|
infoCmd.Environment.Set("SHELL", "/bin/bash")
|
||||||
|
Reference in New Issue
Block a user