Skip to content

Commit

Permalink
Dependencies: build updates. (#12786)
Browse files Browse the repository at this point in the history
- Update language from Skylark to Starlark
- Comment sorting of `bazel/repository_locations.bzl`
- build dependency updates
- formatting consistency

Risk Level: Low
Testing: `bazel --nohome_rc build @envoy_api//envoy/...`, `bazel --nohome_rc test //test/...`
Docs Changes: none required
Release Notes: none required

Signed-off-by: Michael Payne <[email protected]>
  • Loading branch information
moderation authored Aug 23, 2020
1 parent a944559 commit 933e67a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion bazel/envoy_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def tcmalloc_external_deps(repository):

# Envoy C++ library targets that need no transformations or additional dependencies before being
# passed to cc_library should be specified with this function. Note: this exists to ensure that
# all envoy targets pass through an envoy-declared starlark function where they can be modified
# all envoy targets pass through an envoy-declared Starlark function where they can be modified
# before being passed to a native bazel function.
def envoy_basic_cc_library(name, deps = [], external_deps = [], **kargs):
cc_library(
Expand Down
32 changes: 16 additions & 16 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ DEPENDENCY_ANNOTATIONS = [
# NOTE: If a dependency use case is either dataplane or controlplane, the other uses are not needed
# to be declared.
USE_CATEGORIES = [
# This dependency is used in build process.
"build",
# This dependency is used for unit tests.
"test",
# This dependency is used in API protos.
"api",
# This dependency is used in processing downstream or upstream requests.
"dataplane",
# This dependency is used in build process.
"build",
# This dependency is used to process xDS requests.
"controlplane",
# This dependency is used in processing downstream or upstream requests.
"dataplane",
# This dependecy is used for logging, metrics or tracing. It may process unstrusted input.
"observability",
# This dependency does not handle untrusted data and is used for various utility purposes.
"other",
# This dependency is used for unit tests.
"test",
]

# Components with these use categories are not required to specify the 'cpe' annotation.
USE_CATEGORIES_WITH_CPE_OPTIONAL = ["build", "test", "other"]
USE_CATEGORIES_WITH_CPE_OPTIONAL = ["build", "other", "test"]

DEPENDENCY_REPOSITORIES_SPEC = dict(
bazel_compdb = dict(
Expand All @@ -53,16 +53,16 @@ DEPENDENCY_REPOSITORIES_SPEC = dict(
bazel_gazelle = dict(
project_name = "Gazelle",
project_url = "https://github.com/bazelbuild/bazel-gazelle",
version = "0.19.1",
sha256 = "86c6d481b3f7aedc1d60c1c211c6f76da282ae197c3b3160f54bd3a8f847896f",
version = "0.21.1",
sha256 = "cdb02a887a7187ea4d5a27452311a75ed8637379a1287d8eeb952138ea485f7d",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v{version}/bazel-gazelle-v{version}.tar.gz"],
use_category = ["build"],
),
bazel_toolchains = dict(
project_name = "bazel-toolchains",
project_url = "https://github.com/bazelbuild/bazel-toolchains",
version = "3.4.0",
sha256 = "882fecfc88d3dc528f5c5681d95d730e213e39099abff2e637688a91a9619395",
version = "3.4.1",
sha256 = "7ebb200ed3ca3d1f7505659c7dfed01c4b5cb04c3a6f34140726fe22f5d35e86",
strip_prefix = "bazel-toolchains-{version}",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/releases/download/{version}/bazel-toolchains-{version}.tar.gz",
Expand Down Expand Up @@ -398,8 +398,8 @@ DEPENDENCY_REPOSITORIES_SPEC = dict(
com_github_pallets_markupsafe = dict(
project_name = "MarkupSafe",
project_url = "https://github.com/pallets/markupsafe",
version = "1.1.1",
sha256 = "222a10e3237d92a9cd45ed5ea882626bc72bc5e0264d3ed0f2c9129fa69fc167",
version = "2.0.0a1",
sha256 = "2b0c5c2a067d9268813d55523bc513a12181cffb23b2f3d5618eb5d93776bad8",
strip_prefix = "markupsafe-{version}/src",
urls = ["https://github.com/pallets/markupsafe/archive/{version}.tar.gz"],
use_category = ["build"],
Expand Down Expand Up @@ -497,9 +497,9 @@ DEPENDENCY_REPOSITORIES_SPEC = dict(
rules_foreign_cc = dict(
project_name = "Rules for using foreign build systems in Bazel",
project_url = "https://github.com/bazelbuild/rules_foreign_cc",
# 2020-06-09
version = "f54b7ae56dcf1b81bcafed3a08d58fc08ac095a7",
sha256 = "7ca49ac5b0bc8f5a2c9a7e87b7f86aca604bda197259c9b96f8b7f0a4f38b57b",
# 2020-08-21
version = "594bf4d7731e606a705f3ad787dd0a70c5a28b30",
sha256 = "2b1cf88de0b6e0195f6571cfde3a5bd406d11b42117d6adef2395c9525a1902e",
strip_prefix = "rules_foreign_cc-{version}",
urls = ["https://github.com/bazelbuild/rules_foreign_cc/archive/{version}.tar.gz"],
use_category = ["build"],
Expand Down
8 changes: 5 additions & 3 deletions source/extensions/extensions_build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ EXTENSIONS = {
"envoy.internal_redirect_predicates.previous_routes": "//source/extensions/internal_redirect/previous_routes:config",
"envoy.internal_redirect_predicates.safe_cross_scheme": "//source/extensions/internal_redirect/safe_cross_scheme:config",

#
# Http Upstreams (excepting envoy.upstreams.http.generic which is hard-coded into the build so not registered here)
"envoy.upstreams.http.http": "//source/extensions/upstreams/http/http:config",
"envoy.upstreams.http.tcp": "//source/extensions/upstreams/http/tcp:config",
#

"envoy.upstreams.http.http": "//source/extensions/upstreams/http/http:config",
"envoy.upstreams.http.tcp": "//source/extensions/upstreams/http/tcp:config",

}

# This can be used to extend the visibility rules for Envoy extensions
# (//:extension_config and //:extension_library in //BUILD)
# if downstream Envoy builds need to directly reference envoy extensions.
ADDITIONAL_VISIBILITY = [
]
]
22 changes: 11 additions & 11 deletions tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def isExternalBuildFile(file_path):
file_path.startswith("./tools/clang_tools"))


def isSkylarkFile(file_path):
def isStarlarkFile(file_path):
return file_path.endswith(".bzl")


Expand Down Expand Up @@ -774,20 +774,20 @@ def checkSourceLine(line, file_path, reportError):


def checkBuildLine(line, file_path, reportError):
if "@bazel_tools" in line and not (isSkylarkFile(file_path) or file_path.startswith("./bazel/") or
"python/runfiles" in line):
if "@bazel_tools" in line and not (isStarlarkFile(file_path) or
file_path.startswith("./bazel/") or "python/runfiles" in line):
reportError("unexpected @bazel_tools reference, please indirect via a definition in //bazel")
if not allowlistedForProtobufDeps(file_path) and '"protobuf"' in line:
reportError("unexpected direct external dependency on protobuf, use "
"//source/common/protobuf instead.")
if (envoy_build_rule_check and not isSkylarkFile(file_path) and not isWorkspaceFile(file_path) and
not isExternalBuildFile(file_path) and "@envoy//" in line):
if (envoy_build_rule_check and not isStarlarkFile(file_path) and
not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path) and "@envoy//" in line):
reportError("Superfluous '@envoy//' prefix")


def fixBuildLine(file_path, line, line_number):
if (envoy_build_rule_check and not isSkylarkFile(file_path) and not isWorkspaceFile(file_path) and
not isExternalBuildFile(file_path)):
if (envoy_build_rule_check and not isStarlarkFile(file_path) and
not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path)):
line = line.replace("@envoy//", "//")
return line

Expand All @@ -798,7 +798,7 @@ def fixBuildPath(file_path):
error_messages = []

# TODO(htuch): Add API specific BUILD fixer script.
if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isSkylarkFile(
if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isStarlarkFile(
file_path) and not isWorkspaceFile(file_path):
if os.system("%s %s %s" % (ENVOY_BUILD_FIXER_PATH, file_path, file_path)) != 0:
error_messages += ["envoy_build_fixer rewrite failed for file: %s" % file_path]
Expand All @@ -811,7 +811,7 @@ def fixBuildPath(file_path):
def checkBuildPath(file_path):
error_messages = []

if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isSkylarkFile(
if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isStarlarkFile(
file_path) and not isWorkspaceFile(file_path):
command = "%s %s | diff %s -" % (ENVOY_BUILD_FIXER_PATH, file_path, file_path)
error_messages += executeCommand(command, "envoy_build_fixer check failed", file_path)
Expand Down Expand Up @@ -917,7 +917,7 @@ def checkFormat(file_path):
# Apply fixes first, if asked, and then run checks. If we wind up attempting to fix
# an issue, but there's still an error, that's a problem.
try_to_fix = operation_type == "fix"
if isBuildFile(file_path) or isSkylarkFile(file_path) or isWorkspaceFile(file_path):
if isBuildFile(file_path) or isStarlarkFile(file_path) or isWorkspaceFile(file_path):
if try_to_fix:
error_messages += fixBuildPath(file_path)
error_messages += checkBuildPath(file_path)
Expand Down Expand Up @@ -999,7 +999,7 @@ def checkFormatVisitor(arg, dir_name, names):
checkOwners(dir_name[len(source_prefix):], owned_directories, error_messages)

for file_name in names:
if dir_name.startswith("./api") and isSkylarkFile(file_name):
if dir_name.startswith("./api") and isStarlarkFile(file_name):
result = pool.apply_async(checkApiShadowStarlarkFiles,
args=(api_shadow_root, dir_name + "/" + file_name, error_messages))
result_list.append(result)
Expand Down

0 comments on commit 933e67a

Please sign in to comment.