• 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
20# To generate shallow_since fields for git repos, use:
21#   git show --date=raw COMMIT
22
23def perfetto_deps():
24    # Note: this is more recent than the version of protobuf we use in the
25    # GN and Android builds. This is because older versions of protobuf don't
26    # support Bazel.
27    _add_repo_if_not_existing(
28        http_archive,
29        name = "com_google_protobuf",
30        strip_prefix = "protobuf-3.10.1",
31        url = "https://github.com/protocolbuffers/protobuf/archive/v3.10.1.tar.gz",
32        sha256 = "6adf73fd7f90409e479d6ac86529ade2d45f50494c5c10f539226693cb8fe4f7",
33    )
34
35    _add_repo_if_not_existing(
36        http_archive,
37        name = "perfetto_dep_sqlite",
38        url = "https://storage.googleapis.com/perfetto/sqlite-amalgamation-3440200.zip",
39        sha256 = "833be89b53b3be8b40a2e3d5fedb635080e3edb204957244f3d6987c2bb2345f",
40        strip_prefix = "sqlite-amalgamation-3440200",
41        build_file = "//bazel:sqlite.BUILD",
42    )
43
44    _add_repo_if_not_existing(
45        http_archive,
46        name = "perfetto_dep_sqlite_src",
47        url = "https://storage.googleapis.com/perfetto/sqlite-src-3440200.zip",
48        sha256 = "73187473feb74509357e8fa6cb9fd67153b2d010d00aeb2fddb6ceeb18abaf27",
49        strip_prefix = "sqlite-src-3440200",
50        build_file = "//bazel:sqlite.BUILD",
51    )
52
53    _add_repo_if_not_existing(
54        new_git_repository,
55        name = "perfetto_dep_linenoise",
56        remote = "https://fuchsia.googlesource.com/third_party/linenoise.git",
57        commit = "c894b9e59f02203dbe4e2be657572cf88c4230c3",
58        build_file = "//bazel:linenoise.BUILD",
59    )
60
61    _add_repo_if_not_existing(
62        new_git_repository,
63        name = "perfetto_dep_jsoncpp",
64        remote = "https://github.com/open-source-parsers/jsoncpp",
65        commit = "6aba23f4a8628d599a9ef7fa4811c4ff6e4070e2",  # v1.9.3
66        build_file = "//bazel:jsoncpp.BUILD",
67    )
68
69    _add_repo_if_not_existing(
70        http_archive,
71        name = "perfetto_dep_zlib",
72        url = "https://storage.googleapis.com/perfetto/zlib-6d3f6aa0f87c9791ca7724c279ef61384f331dfd.tar.gz",
73        sha256 = "e9a1d6e8c936de68628ffb83a13d28a40cd6b2def2ad9378e8b951d4b8f4df18",
74        build_file = "//bazel:zlib.BUILD",
75    )
76
77    _add_repo_if_not_existing(
78        http_archive,
79        name = "perfetto_dep_llvm_demangle",
80        url = "https://storage.googleapis.com/perfetto/llvm-project-3b4c59c156919902c785ce3cbae0eee2ee53064d.tgz",
81        sha256 = "f4a52e7f36edd7cacc844d5ae0e5f60b6f57c5afc40683e99f295886c9ce8ff4",
82        strip_prefix = "llvm-project",
83        build_file = "//bazel:llvm_demangle.BUILD",
84    )
85
86    # Without this protobuf.bzl fails. This seems a bug in protobuf_deps().
87    _add_repo_if_not_existing(
88        http_archive,
89        name = "bazel_skylib",
90        sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
91        strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
92        url = "https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz",
93    )
94
95def _add_repo_if_not_existing(repo_rule, name, **kwargs):
96    if name not in native.existing_rules():
97        repo_rule(name = name, **kwargs)
98