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 new_git_repository, 71 name = "perfetto_dep_expat", 72 remote = "https://github.com/libexpat/libexpat", 73 commit = "fa75b96546c069d17b8f80d91e0f4ef0cde3790d", # R_2_6_2 74 build_file = "//bazel:expat.BUILD", 75 ) 76 77 _add_repo_if_not_existing( 78 http_archive, 79 name = "perfetto_dep_zlib", 80 url = "https://storage.googleapis.com/perfetto/zlib-6d3f6aa0f87c9791ca7724c279ef61384f331dfd.tar.gz", 81 sha256 = "e9a1d6e8c936de68628ffb83a13d28a40cd6b2def2ad9378e8b951d4b8f4df18", 82 build_file = "//bazel:zlib.BUILD", 83 ) 84 85 _add_repo_if_not_existing( 86 http_archive, 87 name = "perfetto_dep_llvm_demangle", 88 url = "https://storage.googleapis.com/perfetto/llvm-project-3b4c59c156919902c785ce3cbae0eee2ee53064d.tgz", 89 sha256 = "f4a52e7f36edd7cacc844d5ae0e5f60b6f57c5afc40683e99f295886c9ce8ff4", 90 strip_prefix = "llvm-project", 91 build_file = "//bazel:llvm_demangle.BUILD", 92 ) 93 94 # Without this protobuf.bzl fails. This seems a bug in protobuf_deps(). 95 _add_repo_if_not_existing( 96 http_archive, 97 name = "bazel_skylib", 98 sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", 99 urls = [ 100 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", 101 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", 102 ] 103 ) 104 105 _add_repo_if_not_existing( 106 new_git_repository, 107 name = "perfetto_dep_open_csd", 108 remote = "https://android.googlesource.com/platform/external/OpenCSD.git", 109 commit = "0ce01e934f95efb6a216a6efa35af1245151c779", 110 build_file = "//bazel:open_csd.BUILD", 111 ) 112 113def _add_repo_if_not_existing(repo_rule, name, **kwargs): 114 if name not in native.existing_rules(): 115 repo_rule(name = name, **kwargs) 116 117