| # Copyright 2020 Google LLC |
| # |
| # 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 |
| # |
| # https://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. |
| |
| """Contains the external dependencies.""" |
| |
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") |
| load("//fuzzing/private/oss_fuzz:repository.bzl", "oss_fuzz_repository") |
| |
| def rules_fuzzing_dependencies( |
| oss_fuzz = True, |
| honggfuzz = True, |
| centipede = False, |
| jazzer = False): |
| """Instantiates the dependencies of the fuzzing rules. |
| |
| Args: |
| oss_fuzz: Include OSS-Fuzz dependencies. |
| honggfuzz: Include Honggfuzz dependencies. |
| centipede: Include Centipede dependencies. |
| jazzer: Include Jazzer repository. Instantiating all Jazzer dependencies |
| additionally requires invoking jazzer_dependencies() in |
| @jazzer//:repositories.bzl and jazzer_init() in @jazzer//:init.bzl. |
| """ |
| |
| maybe( |
| http_archive, |
| name = "platforms", |
| urls = [ |
| "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.4/platforms-0.0.4.tar.gz", |
| "https://github.com/bazelbuild/platforms/releases/download/0.0.4/platforms-0.0.4.tar.gz", |
| ], |
| sha256 = "079945598e4b6cc075846f7fd6a9d0857c33a7afc0de868c2ccb96405225135d", |
| ) |
| maybe( |
| http_archive, |
| name = "rules_python", |
| sha256 = "c03246c11efd49266e8e41e12931090b613e12a59e6f55ba2efd29a7cb8b4258", |
| strip_prefix = "rules_python-0.11.0", |
| url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.11.0.tar.gz", |
| ) |
| maybe( |
| http_archive, |
| name = "bazel_skylib", |
| urls = [ |
| "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", |
| "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", |
| ], |
| sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", |
| ) |
| maybe( |
| http_archive, |
| name = "com_google_absl", |
| urls = ["https://github.com/abseil/abseil-cpp/archive/f2dbd918d8d08529800eb72f23bd2829f92104a4.zip"], |
| strip_prefix = "abseil-cpp-f2dbd918d8d08529800eb72f23bd2829f92104a4", |
| sha256 = "5e1cbf25bf501f8e37866000a6052d02dbdd7b19a5b592251c59a4c9aa5c71ae", |
| ) |
| |
| if oss_fuzz: |
| maybe( |
| oss_fuzz_repository, |
| name = "rules_fuzzing_oss_fuzz", |
| ) |
| |
| if honggfuzz: |
| maybe( |
| http_archive, |
| name = "honggfuzz", |
| build_file = "@rules_fuzzing//:honggfuzz.BUILD", |
| sha256 = "a6f8040ea62e0f630737f66dce46fb1b86140f118957cb5e3754a764de7a770a", |
| url = "https://github.com/google/honggfuzz/archive/e0670137531242d66c9cf8a6dee677c055a8aacb.zip", |
| strip_prefix = "honggfuzz-e0670137531242d66c9cf8a6dee677c055a8aacb", |
| ) |
| |
| if centipede: |
| maybe( |
| http_archive, |
| name = "centipede", |
| sha256 = "f52b8ae44e183b8f9501e382316de28d4c5b8d333af65d76def2d1b4b0b4a9a5", |
| url = "https://github.com/google/centipede/archive/d98e302e10a21aff0bbfae96b68ff61ab8f9d1ab.zip", |
| strip_prefix = "centipede-d98e302e10a21aff0bbfae96b68ff61ab8f9d1ab", |
| ) |
| |
| # TODO(sbucur): This should be provided by Centipede as an initialization library. |
| boringssl_ver = "18637c5f37b87e57ebde0c40fe19c1560ec88813" |
| maybe( |
| http_archive, |
| name = "boringssl", |
| sha256 = "7514826d98f032c16531de9f4c05e7bd05e07545ca39201d1616fa7ba3deadbc", |
| strip_prefix = "boringssl-%s" % boringssl_ver, |
| url = "https://github.com/google/boringssl/archive/%s.tar.gz" % boringssl_ver, |
| ) |
| |
| if jazzer: |
| maybe( |
| http_archive, |
| name = "jazzer", |
| sha256 = "c55889c235501498ca7436f57974ea59f0dc43e9effd64e13ce0c535265b8224", |
| strip_prefix = "jazzer-4434041f088365acf2a561e678bf9d61a7aa5dff", |
| url = "https://github.com/CodeIntelligenceTesting/jazzer/archive/4434041f088365acf2a561e678bf9d61a7aa5dff.zip", |
| ) |