Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 186c7779 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Direct Bazel builds from m."

parents 3b528144 bfa114d0
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -1700,19 +1700,27 @@ function _trigger_build()
function b()
function b()
(
(
    # Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
    # Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
    m nothing GENERATE_BAZEL_FILES=true || return 1
    _trigger_build "all-modules" nothing GENERATE_BAZEL_FILES=true USE_BAZEL_ANALYSIS= || return 1
    # Then, run Bazel using the synthetic workspace as the --package_path.
    # Then, run Bazel using the synthetic workspace as the --package_path.
    if [[ -z "$@" ]]; then
    if [[ -z "$@" ]]; then
        # If there are no args, show help.
        # If there are no args, show help.
        "$(gettop)/tools/bazel" help
        bazel help
    else
    else
        # Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace.
        # Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace.
        "$(gettop)/tools/bazel" "$@" --config=bp2build
        bazel "$@" --config=bp2build
    fi
    fi
)
)


function m()
function m()
(
(
    if [[ "${USE_BAZEL_ANALYSIS}" =~ ^(true|1)$ ]]; then
        # This only short-circuits to Bazel for a single module target now.
        b cquery "@soong_injection//module_name_to_label:$@" 2>/dev/null
        if [[ $? == 0 ]]; then
            bazel build "@soong_injection//module_name_to_label:$@" --config=bp2build
            return $?
        fi
    fi
    _trigger_build "all-modules" "$@"
    _trigger_build "all-modules" "$@"
)
)