Skip to content

Commit

Permalink
Merge "Download Bazel using 'tools/install-build-deps'." into main
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillTim authored and Gerrit Code Review committed Dec 23, 2024
2 parents 77f2753 + 20408f1 commit addf73d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
23 changes: 23 additions & 0 deletions tools/bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
# Copyright (C) 2024 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import sys

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(ROOT_DIR)
__package__ = 'tools'
from .run_buildtools_binary import run_buildtools_binary
run_buildtools_binary(['bazel'] + sys.argv[1:])
35 changes: 33 additions & 2 deletions tools/install-build-deps
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,31 @@ BUILD_DEPS_HOST = [
'0ce01e934f95efb6a216a6efa35af1245151c779', 'all', 'all'),
]

# Dependencies required to build code on the host using Bazel build system.
# Only macOS and Linux.
BUILD_DEPS_BAZEL = [
Dependency(
'buildtools/mac/bazel',
'https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-darwin-x86_64',
'52dd34c17cc97b3aa5bdfe3d45c4e3938226f23dd0bfb47beedd625a953f1f05',
'darwin', 'x64'),
Dependency(
'buildtools/mac/bazel',
'https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-darwin-arm64',
'02b117b97d0921ae4d4f4e11d27e2c0930381df416e373435d5d0419c6a26f24',
'darwin', 'arm64'),
Dependency(
'buildtools/linux64/bazel',
'https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-linux-x86_64',
'c97f02133adce63f0c28678ac1f21d65fa8255c80429b588aeeba8a1fac6202b',
'linux', 'x64'),
Dependency(
'buildtools/linux64/bazel',
'https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-linux-arm64',
'd7aedc8565ed47b6231badb80b09f034e389c5f2b1c2ac2c55406f7c661d8b88',
'linux', 'arm64'),
]

# Dependencies required to build Android code.
# URLs and SHA1s taken from:
# - https://dl.google.com/android/repository/repository-11.xml
Expand Down Expand Up @@ -468,8 +493,8 @@ BUILD_DEPS_LINUX_CROSS_SYSROOTS = [
]

ALL_DEPS = (
BUILD_DEPS_HOST + BUILD_DEPS_ANDROID + BUILD_DEPS_LINUX_CROSS_SYSROOTS +
TEST_DEPS_ANDROID + UI_DEPS)
BUILD_DEPS_HOST + BUILD_DEPS_BAZEL + BUILD_DEPS_ANDROID +
BUILD_DEPS_LINUX_CROSS_SYSROOTS + TEST_DEPS_ANDROID + UI_DEPS)

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
UI_DIR = os.path.join(ROOT_DIR, 'ui')
Expand Down Expand Up @@ -675,6 +700,10 @@ def CheckDepotToolsIsRecent():

def Main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--bazel',
action='store_true',
help='Bazel build tool executable to build the project using Bazel')
parser.add_argument(
'--android',
action='store_true',
Expand Down Expand Up @@ -720,6 +749,8 @@ def Main():
deps = BUILD_DEPS_HOST
if not args.no_toolchain:
deps += BUILD_DEPS_TOOLCHAIN_HOST
if args.bazel:
deps += BUILD_DEPS_BAZEL
if args.android:
deps += BUILD_DEPS_ANDROID + TEST_DEPS_ANDROID
if args.linux_arm:
Expand Down

0 comments on commit addf73d

Please sign in to comment.