• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2019 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
16load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
17
18# This file must be kept in sync with tools/install-build-deps.
19
20def perfetto_deps():
21    # Note: this is more recent than the version of protobuf we use in the
22    # GN and Android builds. This is because older versions of protobuf don't
23    # support Bazel.
24    _add_repo_if_not_existing(
25        http_archive,
26        name = "com_google_protobuf",
27        strip_prefix = "protobuf-3.9.0",
28        url = "https://github.com/google/protobuf/archive/v3.9.0.tar.gz",
29        sha256 = "2ee9dcec820352671eb83e081295ba43f7a4157181dad549024d7070d079cf65",
30    )
31
32    _add_repo_if_not_existing(
33        http_archive,
34        name = "perfetto_dep_sqlite",
35        url = "https://storage.googleapis.com/perfetto/sqlite-amalgamation-3250300.zip",
36        sha256 = "2ad5379f3b665b60599492cc8a13ac480ea6d819f91b1ef32ed0e1ad152fafef",
37        strip_prefix = "sqlite-amalgamation-3250300",
38        build_file = "//bazel:sqlite.BUILD",
39    )
40
41    _add_repo_if_not_existing(
42        http_archive,
43        name = "perfetto_dep_sqlite_src",
44        url = "https://storage.googleapis.com/perfetto/sqlite-src-3250300.zip",
45        sha256 = "c7922bc840a799481050ee9a76e679462da131adba1814687f05aa5c93766421",
46        strip_prefix = "sqlite-src-3250300",
47        build_file = "//bazel:sqlite.BUILD",
48    )
49
50    _add_repo_if_not_existing(
51        new_git_repository,
52        name = "perfetto_dep_linenoise",
53        remote = "https://fuchsia.googlesource.com/third_party/linenoise.git",
54        commit = "c894b9e59f02203dbe4e2be657572cf88c4230c3",
55        build_file = "//bazel:linenoise.BUILD",
56        shallow_since = "1469784335 +0200",
57    )
58
59    _add_repo_if_not_existing(
60        new_git_repository,
61        name = "perfetto_dep_jsoncpp",
62        remote = "https://github.com/open-source-parsers/jsoncpp",
63        commit = "6aba23f4a8628d599a9ef7fa4811c4ff6e4070e2",  # v1.9.3
64        build_file = "//bazel:jsoncpp.BUILD",
65        shallow_since = "1590760226 +0800",
66    )
67
68    _add_repo_if_not_existing(
69        new_git_repository,
70        name = "perfetto_dep_zlib",
71        remote = "https://android.googlesource.com/platform/external/zlib.git",
72        commit = "dfa0646a03b4e1707469e04dc931b09774968fe6",
73        build_file = "//bazel:zlib.BUILD",
74        shallow_since = "1557160162 -0700",
75    )
76
77    # Without this protobuf.bzl fails. This seems a bug in protobuf_deps().
78    _add_repo_if_not_existing(
79        http_archive,
80        name = "bazel_skylib",
81        sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
82        strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
83        url = "https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz",
84    )
85
86def _add_repo_if_not_existing(repo_rule, name, **kwargs):
87    if name not in native.existing_rules():
88        repo_rule(name = name, **kwargs)
89