Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
BROWSE
/build
/build_*
*.bzlc
.cache
/ci/bazel-*
/ci/prebuilt/thirdparty
Expand Down
24 changes: 24 additions & 0 deletions api/bazel/envoy_http_archive.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def envoy_http_archive(name, locations, **kwargs):
# `existing_rule_keys` contains the names of repositories that have already
# been defined in the Bazel workspace. By skipping repos with existing keys,
# users can override dependency versions by using standard Bazel repository
# rules in their WORKSPACE files.
existing_rule_keys = native.existing_rules().keys()
if name in existing_rule_keys:
# This repository has already been defined, probably because the user
# wants to override the version. Do nothing.
return

loc_key = kwargs.pop("repository_key", name)
location = locations[loc_key]

# HTTP tarball at a given URL. Add a BUILD file if requested.
http_archive(
name = name,
urls = location["urls"],
sha256 = location["sha256"],
strip_prefix = location.get("strip_prefix", ""),
**kwargs
)
96 changes: 36 additions & 60 deletions api/bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
BAZEL_SKYLIB_RELEASE = "0.6.0"
BAZEL_SKYLIB_SHA256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867"

GOGOPROTO_RELEASE = "1.2.0"
GOGOPROTO_SHA256 = "957c8f03cf595525d2a667035d9865a0930b3d446be0ab6eb76972934f925b00"

OPENCENSUS_RELEASE = "0.1.0"
OPENCENSUS_SHA256 = "4fd21cc6de63d7cb979fd749d8101ff425905aa0826fed26019d1c311fcf19a7"

PGV_RELEASE = "0.0.13"
PGV_SHA256 = "dce6c8a43849d2abe4d5e40f16e9a476bca6b7a47e128db4458a52d748f4a5eb"

GOOGLEAPIS_GIT_SHA = "d642131a6e6582fc226caf9893cb7fe7885b3411" # May 23, 2018
GOOGLEAPIS_SHA = "16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f63"

PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017
PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b"

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(":envoy_http_archive.bzl", "envoy_http_archive")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS")

def api_dependencies():
http_archive(
name = "bazel_skylib",
sha256 = BAZEL_SKYLIB_SHA256,
strip_prefix = "bazel-skylib-" + BAZEL_SKYLIB_RELEASE,
url = "https://github.com/bazelbuild/bazel-skylib/archive/" + BAZEL_SKYLIB_RELEASE + ".tar.gz",
envoy_http_archive(
"bazel_skylib",
locations = REPOSITORY_LOCATIONS,
)
http_archive(
name = "com_lyft_protoc_gen_validate",
sha256 = PGV_SHA256,
strip_prefix = "protoc-gen-validate-" + PGV_RELEASE,
url = "https://github.com/lyft/protoc-gen-validate/archive/v" + PGV_RELEASE + ".tar.gz",
envoy_http_archive(
"com_lyft_protoc_gen_validate",
locations = REPOSITORY_LOCATIONS,
)
http_archive(
envoy_http_archive(
name = "googleapis",
strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA,
url = "https://github.com/googleapis/googleapis/archive/" + GOOGLEAPIS_GIT_SHA + ".tar.gz",
# TODO(dio): Consider writing a Skylark macro for importing Google API proto.
sha256 = GOOGLEAPIS_SHA,
build_file_content = """
locations = REPOSITORY_LOCATIONS,
build_file_content = GOOGLEAPIS_BUILD_CONTENT,
)
envoy_http_archive(
name = "com_github_gogo_protobuf",
locations = REPOSITORY_LOCATIONS,
build_file_content = GOGOPROTO_BUILD_CONTENT,
)
envoy_http_archive(
name = "prometheus_metrics_model",
locations = REPOSITORY_LOCATIONS,
build_file_content = PROMETHEUSMETRICS_BUILD_CONTENT,
)
envoy_http_archive(
name = "io_opencensus_trace",
locations = REPOSITORY_LOCATIONS,
build_file_content = OPENCENSUSTRACE_BUILD_CONTENT,
)

GOOGLEAPIS_BUILD_CONTENT = """
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library", "py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand Down Expand Up @@ -194,15 +189,9 @@ py_proto_library(
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf_python"],
)
""",
)
"""

http_archive(
name = "com_github_gogo_protobuf",
sha256 = GOGOPROTO_SHA256,
strip_prefix = "protobuf-" + GOGOPROTO_RELEASE,
url = "https://github.com/gogo/protobuf/archive/v" + GOGOPROTO_RELEASE + ".tar.gz",
build_file_content = """
GOGOPROTO_BUILD_CONTENT = """
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library", "py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand Down Expand Up @@ -255,15 +244,9 @@ py_proto_library(
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf_python"],
)
""",
)
"""

http_archive(
name = "prometheus_metrics_model",
strip_prefix = "client_model-" + PROMETHEUS_GIT_SHA,
url = "https://github.com/prometheus/client_model/archive/" + PROMETHEUS_GIT_SHA + ".tar.gz",
sha256 = PROMETHEUS_SHA,
build_file_content = """
PROMETHEUSMETRICS_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand All @@ -281,15 +264,9 @@ go_proto_library(
proto = ":client_model",
visibility = ["//visibility:public"],
)
""",
)
"""

http_archive(
name = "io_opencensus_trace",
sha256 = OPENCENSUS_SHA256,
strip_prefix = "opencensus-proto-" + OPENCENSUS_RELEASE + "/src/opencensus/proto/trace/v1",
url = "https://github.com/census-instrumentation/opencensus-proto/archive/v" + OPENCENSUS_RELEASE + ".tar.gz",
build_file_content = """
OPENCENSUSTRACE_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand All @@ -307,5 +284,4 @@ go_proto_library(
proto = ":trace_model",
visibility = ["//visibility:public"],
)
""",
)
"""
51 changes: 51 additions & 0 deletions api/bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
BAZEL_SKYLIB_RELEASE = "0.6.0"
BAZEL_SKYLIB_SHA256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867"

GOGOPROTO_RELEASE = "1.2.0"
GOGOPROTO_SHA256 = "957c8f03cf595525d2a667035d9865a0930b3d446be0ab6eb76972934f925b00"

OPENCENSUS_RELEASE = "0.1.0"
OPENCENSUS_SHA256 = "4fd21cc6de63d7cb979fd749d8101ff425905aa0826fed26019d1c311fcf19a7"

PGV_RELEASE = "0.0.13"
PGV_SHA256 = "dce6c8a43849d2abe4d5e40f16e9a476bca6b7a47e128db4458a52d748f4a5eb"

GOOGLEAPIS_GIT_SHA = "d642131a6e6582fc226caf9893cb7fe7885b3411" # May 23, 2018
GOOGLEAPIS_SHA = "16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f63"

PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017
PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b"

REPOSITORY_LOCATIONS = dict(
bazel_skylib = dict(
sha256 = BAZEL_SKYLIB_SHA256,
strip_prefix = "bazel-skylib-" + BAZEL_SKYLIB_RELEASE,
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/" + BAZEL_SKYLIB_RELEASE + ".tar.gz"],
),
com_lyft_protoc_gen_validate = dict(
sha256 = PGV_SHA256,
strip_prefix = "protoc-gen-validate-" + PGV_RELEASE,
urls = ["https://github.com/lyft/protoc-gen-validate/archive/v" + PGV_RELEASE + ".tar.gz"],
),
googleapis = dict(
# TODO(dio): Consider writing a Skylark macro for importing Google API proto.
sha256 = GOOGLEAPIS_SHA,
strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA,
urls = ["https://github.com/googleapis/googleapis/archive/" + GOOGLEAPIS_GIT_SHA + ".tar.gz"],
),
com_github_gogo_protobuf = dict(
sha256 = GOGOPROTO_SHA256,
strip_prefix = "protobuf-" + GOGOPROTO_RELEASE,
urls = ["https://github.com/gogo/protobuf/archive/v" + GOGOPROTO_RELEASE + ".tar.gz"],
),
prometheus_metrics_model = dict(
sha256 = PROMETHEUS_SHA,
strip_prefix = "client_model-" + PROMETHEUS_GIT_SHA,
urls = ["https://github.com/prometheus/client_model/archive/" + PROMETHEUS_GIT_SHA + ".tar.gz"],
),
io_opencensus_trace = dict(
sha256 = OPENCENSUS_SHA256,
strip_prefix = "opencensus-proto-" + OPENCENSUS_RELEASE + "/src/opencensus/proto/trace/v1",
urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/v" + OPENCENSUS_RELEASE + ".tar.gz"],
),
)
22 changes: 0 additions & 22 deletions bazel/git_repository_info.py

This file was deleted.

31 changes: 4 additions & 27 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(":genrule_repository.bzl", "genrule_repository")
load("//api/bazel:envoy_http_archive.bzl", "envoy_http_archive")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS")
load(":target_recipes.bzl", "TARGET_RECIPES")
load(
Expand All @@ -20,33 +21,9 @@ GO_VERSION = "1.10.4"
BUILD_ALL_CONTENT = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""

def _repository_impl(name, **kwargs):
# `existing_rule_keys` contains the names of repositories that have already
# been defined in the Bazel workspace. By skipping repos with existing keys,
# users can override dependency versions by using standard Bazel repository
# rules in their WORKSPACE files.
existing_rule_keys = native.existing_rules().keys()
if name in existing_rule_keys:
# This repository has already been defined, probably because the user
# wants to override the version. Do nothing.
return

loc_key = kwargs.pop("repository_key", name)
location = REPOSITORY_LOCATIONS[loc_key]

# Git tags are mutable. We want to depend on commit IDs instead. Give the
# user a useful error if they accidentally specify a tag.
if "tag" in location:
fail(
"Refusing to depend on Git tag %r for external dependency %r: use 'commit' instead." %
(location["tag"], name),
)

# HTTP tarball at a given URL. Add a BUILD file if requested.
http_archive(
name = name,
urls = location["urls"],
sha256 = location["sha256"],
strip_prefix = location.get("strip_prefix", ""),
envoy_http_archive(
name,
locations = REPOSITORY_LOCATIONS,
**kwargs
)

Expand Down
2 changes: 1 addition & 1 deletion ci/build_container/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COPY ./build_and_install_deps.sh ./recipe_wrapper.sh ./Makefile ./build_containe
COPY WORKSPACE /bazel-prebuilt/
COPY ./api /bazel-prebuilt/api
COPY ./bazel /bazel-prebuilt/bazel
COPY ./build_recipes/*.sh /build_recipes/
COPY ./build_recipes /build_recipes

COPY ./build_container_ubuntu.sh /

Expand Down
18 changes: 9 additions & 9 deletions ci/build_container/build_recipes/gperftools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ if [[ "${OS}" == "Windows_NT" ]]; then
exit 0
fi

# TODO(cmluciano): Bump to release 2.8
# This sha is specifically chosen to fix ppc64le builds that require inclusion
# of asm/ptrace.h
VERSION=fc00474ddc21fff618fc3f009b46590e241e425e
SHA256=18574813a062eee487bc1b761e8024a346075a7cb93da19607af362dc09565ef
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"

curl https://github.com/gperftools/gperftools/archive/${VERSION}.tar.gz -sLo gperftools-"$VERSION".tar.gz \
&& echo "$SHA256" gperftools-"$VERSION".tar.gz | sha256sum --check
$($SCRIPT_DIR/versions.py gperftools)

tar xf gperftools-"$VERSION".tar.gz
cd gperftools-"${VERSION}"
FILE_NAME=$(basename "$FILE_URL")

curl "$FILE_URL" -sLo "$FILE_NAME" \
&& echo "$FILE_SHA256" "$FILE_NAME" | sha256sum --check
tar xf "$FILE_NAME"

cd "$FILE_PREFIX"

./autogen.sh

Expand Down
19 changes: 12 additions & 7 deletions ci/build_container/build_recipes/luajit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

set -e

VERSION=2.1.0-beta3
SHA256=409f7fe570d3c16558e594421c47bdd130238323c9d6fd6c83dedd2aaeb082a8
if [[ "${OS}" == "Windows_NT" ]]; then
exit 0
fi

curl https://github.com/LuaJIT/LuaJIT/archive/v"$VERSION".tar.gz -sLo LuaJIT-"$VERSION".tar.gz \
&& echo "$SHA256" LuaJIT-"$VERSION".tar.gz | sha256sum --check
tar xf LuaJIT-"$VERSION".tar.gz
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"

$($SCRIPT_DIR/versions.py luajit)

FILE_NAME=$(basename "$FILE_URL")

curl "$FILE_URL" -sLo "$FILE_NAME" \
&& echo "$FILE_SHA256" "$FILE_NAME" | sha256sum --check
tar xf "$FILE_NAME"

cd "$FILE_PREFIX"

# Fixup Makefile with things that cannot be set via env var.
cat > luajit_make.diff << 'EOF'
Expand Down Expand Up @@ -60,8 +66,7 @@ index f56465d..3f4f2fa 100644
##############################################################################
EOF

cd LuaJIT-"$VERSION"
patch -p1 < ../luajit_make.diff
patch -p1 < luajit_make.diff

# Default MACOSX_DEPLOYMENT_TARGET is 10.4, which will fail the build at link time on macOS 10.14:
# ld: library not found for -lgcc_s.10.4
Expand Down
Loading