Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: external dependency dashboard. #12639

Merged
merged 6 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,48 @@ WINDOWS_SKIP_TARGETS = [
# archives, e.g. cares.
BUILD_ALL_CONTENT = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""

def _fail_missing_attribute(attr, key):
fail("The '%s' attribute must be defined for external dependecy " % attr + key)

# Method for verifying content of the DEPENDENCY_REPOSITORIES defined in bazel/repository_locations.bzl
# Verification is here so that bazel/repository_locations.bzl can be loaded into other tools written in Python,
# and as such needs to be free of bazel specific constructs.
#
# We also remove the attributes for further consumption in this file, since rules such as http_archive
# don't recognize them.
def _repository_locations():
locations = dict(DEPENDENCY_REPOSITORIES)
for key, location in locations.items():
locations = {}
for key, location in DEPENDENCY_REPOSITORIES.items():
mutable_location = dict(location)
locations[key] = mutable_location

if "sha256" not in location or len(location["sha256"]) == 0:
fail("SHA256 missing for external dependency " + str(location["urls"]))
_fail_missing_attribute("sha256", key)

if "project_name" not in location:
_fail_missing_attribute("project_name", key)
mutable_location.pop("project_name")

if "project_url" not in location:
_fail_missing_attribute("project_url", key)
mutable_location.pop("project_url")

if "version" not in location:
_fail_missing_attribute("version", key)
mutable_location.pop("version")

if "use_category" not in location:
fail("The 'use_category' attribute must be defined for external dependecy " + str(location["urls"]))
_fail_missing_attribute("use_category", key)
mutable_location.pop("use_category")

if "cpe" not in location and not [category for category in USE_CATEGORIES_WITH_CPE_OPTIONAL if category in location["use_category"]]:
fail("The 'cpe' attribute must be defined for external dependecy " + str(location["urls"]))
if "cpe" in location:
mutable_location.pop("cpe")
elif not [category for category in USE_CATEGORIES_WITH_CPE_OPTIONAL if category in location["use_category"]]:
_fail_missing_attribute("cpe", key)

for category in location["use_category"]:
if category not in USE_CATEGORIES:
fail("Unknown use_category value '" + category + "' for dependecy " + str(location["urls"]))
fail("Unknown use_category value '" + category + "' for dependecy " + key)

return locations

Expand Down
Loading