diff --git a/.gitignore b/.gitignore index e2426f86ef1be..f098c7513edec 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ TAGS .vimrc .vs .vscode +*.bzlc diff --git a/api/bazel/BUILD b/api/bazel/BUILD index e69de29bb2d1d..b161aa9aa5f91 100644 --- a/api/bazel/BUILD +++ b/api/bazel/BUILD @@ -0,0 +1 @@ +exports_files(["repository_locations.bzl"]) diff --git a/api/bazel/envoy_http_archive.bzl b/api/bazel/envoy_http_archive.bzl new file mode 100644 index 0000000000000..d794a3cabf4d4 --- /dev/null +++ b/api/bazel/envoy_http_archive.bzl @@ -0,0 +1,33 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") + +def envoy_http_archive(name, repository_locations = REPOSITORY_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 = 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", ""), + **kwargs + ) diff --git a/api/bazel/repositories.bzl b/api/bazel/repositories.bzl index 0d2caea5b0ae3..93bf5b6da4e6c 100644 --- a/api/bazel/repositories.bzl +++ b/api/bazel/repositories.bzl @@ -1,43 +1,47 @@ -BAZEL_SKYLIB_RELEASE = "0.5.0" -BAZEL_SKYLIB_SHA256 = "b5f6abe419da897b7901f90cbab08af958b97a8f3575b0d3dd062ac7ce78541f" +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load(":envoy_http_archive.bzl", "envoy_http_archive") -GOGOPROTO_RELEASE = "1.1.1" -GOGOPROTO_SHA256 = "9f8c2ad49849ab063cd9fef67e77d49606640044227ecf7f3617ea2c92ef147c" +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") -PGV_RELEASE = "0.0.11" -PGV_SHA256 = "d92c7f22929f495cf9f7d825c44f9190eda1d8256af321e3e8692570181b28a6" +api_proto_library( + name = "client_model", + srcs = [ + "metrics.proto", + ], + visibility = ["//visibility:public"], +) -GOOGLEAPIS_GIT_SHA = "d642131a6e6582fc226caf9893cb7fe7885b3411" # May 23, 2018 -GOOGLEAPIS_SHA = "16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f63" +go_proto_library( + name = "client_model_go_proto", + importpath = "client_model", + proto = ":client_model", + visibility = ["//visibility:public"], +) +""" -PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017 -PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b" +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") -OPENCENSUS_GIT_SHA = "ab82e5fdec8267dc2a726544b10af97675970847" # May 23, 2018 -OPENCENSUS_SHA = "1950f844d9f338ba731897a9bb526f9074c0487b3f274ce2ec3b4feaf0bef7e2" +api_proto_library( + name = "trace_model", + srcs = [ + "trace.proto", + ], + visibility = ["//visibility:public"], +) -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +go_proto_library( + name = "trace_model_go_proto", + importpath = "trace_model", + proto = ":trace_model", + visibility = ["//visibility:public"], +) +""" -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", - ) - 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", - ) - 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 = """ +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") @@ -52,8 +56,8 @@ filegroup( proto_library( name = "api_httpbody_protos_proto", srcs = [":api_httpbody_protos_src"], - deps = ["@com_google_protobuf//:descriptor_proto"], visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:descriptor_proto"], ) cc_proto_library( @@ -63,8 +67,8 @@ cc_proto_library( ], default_runtime = "@com_google_protobuf//:protobuf", protoc = "@com_google_protobuf//:protoc", - deps = ["@com_google_protobuf//:cc_wkt_protos"], visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:cc_wkt_protos"], ) py_proto_library( @@ -85,7 +89,7 @@ go_proto_library( proto = ":api_httpbody_protos_proto", visibility = ["//visibility:public"], deps = [ - ":descriptor_go_proto", + ":descriptor_go_proto", ], ) @@ -108,8 +112,8 @@ go_proto_library( proto_library( name = "http_api_protos_proto", srcs = [":http_api_protos_src"], - deps = ["@com_google_protobuf//:descriptor_proto"], visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:descriptor_proto"], ) cc_proto_library( @@ -120,8 +124,8 @@ cc_proto_library( ], default_runtime = "@com_google_protobuf//:protobuf", protoc = "@com_google_protobuf//:protoc", - deps = ["@com_google_protobuf//:cc_wkt_protos"], visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:cc_wkt_protos"], ) py_proto_library( @@ -143,34 +147,34 @@ go_proto_library( proto = ":http_api_protos_proto", visibility = ["//visibility:public"], deps = [ - ":descriptor_go_proto", + ":descriptor_go_proto", ], ) filegroup( - name = "rpc_status_protos_src", - srcs = [ - "google/rpc/status.proto", - ], - visibility = ["//visibility:public"], + name = "rpc_status_protos_src", + srcs = [ + "google/rpc/status.proto", + ], + visibility = ["//visibility:public"], ) proto_library( - name = "rpc_status_protos_lib", - srcs = [":rpc_status_protos_src"], - deps = ["@com_google_protobuf//:any_proto"], - visibility = ["//visibility:public"], + name = "rpc_status_protos_lib", + srcs = [":rpc_status_protos_src"], + visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:any_proto"], ) cc_proto_library( - name = "rpc_status_protos", - srcs = ["google/rpc/status.proto"], - default_runtime = "@com_google_protobuf//:protobuf", - protoc = "@com_google_protobuf//:protoc", - deps = [ - "@com_google_protobuf//:cc_wkt_protos" - ], - visibility = ["//visibility:public"], + name = "rpc_status_protos", + srcs = ["google/rpc/status.proto"], + default_runtime = "@com_google_protobuf//:protobuf", + protoc = "@com_google_protobuf//:protoc", + visibility = ["//visibility:public"], + deps = [ + "@com_google_protobuf//:cc_wkt_protos", + ], ) go_proto_library( @@ -179,30 +183,24 @@ go_proto_library( proto = ":rpc_status_protos_lib", visibility = ["//visibility:public"], deps = [ - "@com_github_golang_protobuf//ptypes/any:go_default_library", + "@com_github_golang_protobuf//ptypes/any:go_default_library", ], ) py_proto_library( - name = "rpc_status_protos_py", - srcs = [ - "google/rpc/status.proto", - ], - include = ".", - default_runtime = "@com_google_protobuf//:protobuf_python", - protoc = "@com_google_protobuf//:protoc", - visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:protobuf_python"], + name = "rpc_status_protos_py", + srcs = [ + "google/rpc/status.proto", + ], + include = ".", + default_runtime = "@com_google_protobuf//:protobuf_python", + protoc = "@com_google_protobuf//:protoc", + 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") @@ -211,10 +209,10 @@ proto_library( srcs = [ "gogoproto/gogo.proto", ], + visibility = ["//visibility:public"], deps = [ "@com_google_protobuf//:descriptor_proto", ], - visibility = ["//visibility:public"], ) go_proto_library( @@ -231,8 +229,8 @@ cc_proto_library( ], default_runtime = "@com_google_protobuf//:protobuf", protoc = "@com_google_protobuf//:protoc", - deps = ["@com_google_protobuf//:cc_wkt_protos"], visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:cc_wkt_protos"], ) go_proto_library( @@ -254,58 +252,24 @@ py_proto_library( protoc = "@com_google_protobuf//:protoc", visibility = ["//visibility:public"], deps = ["@com_google_protobuf//:protobuf_python"], -) - """, - ) +)""" - http_archive( +def api_dependencies(): + envoy_http_archive("bazel_skylib") + envoy_http_archive("com_lyft_protoc_gen_validate") + envoy_http_archive( + name = "googleapis", + build_file_content = GOOGLEAPIS_BUILD_CONTENT, + ) + envoy_http_archive( + name = "com_github_gogo_protobuf", + build_file_content = GOGOPROTO_BUILD_CONTENT, + ) + envoy_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 = """ -load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -api_proto_library( - name = "client_model", - srcs = [ - "metrics.proto", - ], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "client_model_go_proto", - importpath = "client_model", - proto = ":client_model", - visibility = ["//visibility:public"], -) - """, + build_file_content = PROMETHEUSMETRICS_BUILD_CONTENT, ) - - http_archive( + envoy_http_archive( name = "io_opencensus_trace", - strip_prefix = "opencensus-proto-" + OPENCENSUS_GIT_SHA + "/opencensus/proto/trace", - url = "https://github.com/census-instrumentation/opencensus-proto/archive/" + OPENCENSUS_GIT_SHA + ".tar.gz", - sha256 = OPENCENSUS_SHA, - build_file_content = """ -load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -api_proto_library( - name = "trace_model", - srcs = [ - "trace.proto", - ], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "trace_model_go_proto", - importpath = "trace_model", - proto = ":trace_model", - visibility = ["//visibility:public"], -) - """, + build_file_content = OPENCENSUSTRACE_BUILD_CONTENT, ) diff --git a/api/bazel/repository_locations.bzl b/api/bazel/repository_locations.bzl new file mode 100644 index 0000000000000..34ece44df51f6 --- /dev/null +++ b/api/bazel/repository_locations.bzl @@ -0,0 +1,36 @@ +REPOSITORY_LOCATIONS = dict( + bazel_skylib = dict( + sha256 = "b5f6abe419da897b7901f90cbab08af958b97a8f3575b0d3dd062ac7ce78541f", + strip_prefix = "bazel-skylib-0.5.0", + urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.5.0.tar.gz"], + ), + com_lyft_protoc_gen_validate = dict( + sha256 = "d92c7f22929f495cf9f7d825c44f9190eda1d8256af321e3e8692570181b28a6", + strip_prefix = "protoc-gen-validate-0.0.11", + urls = ["https://github.com/lyft/protoc-gen-validate/archive/v0.0.11.tar.gz"], + ), + googleapis = dict( + # May 23, 2018 + sha256 = "16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f63", + strip_prefix = "googleapis-d642131a6e6582fc226caf9893cb7fe7885b3411", + urls = ["https://github.com/googleapis/googleapis/archive/d642131a6e6582fc226caf9893cb7fe7885b3411.tar.gz"], + # TODO(dio): Consider writing a Skylark macro for importing Google API proto. + ), + com_github_gogo_protobuf = dict( + sha256 = "9f8c2ad49849ab063cd9fef67e77d49606640044227ecf7f3617ea2c92ef147c", + strip_prefix = "protobuf-1.1.1", + urls = ["https://github.com/gogo/protobuf/archive/v1.1.1.tar.gz"], + ), + prometheus_metrics_model = dict( + # Nov 17, 2017 + sha256 = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b", + strip_prefix = "client_model-99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c", + urls = ["https://github.com/prometheus/client_model/archive/99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c.tar.gz"], + ), + io_opencensus_trace = dict( + # May 23, 2018 + sha256 = "1950f844d9f338ba731897a9bb526f9074c0487b3f274ce2ec3b4feaf0bef7e2", + strip_prefix = "opencensus-proto-ab82e5fdec8267dc2a726544b10af97675970847/opencensus/proto/trace", + urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/ab82e5fdec8267dc2a726544b10af97675970847.tar.gz"], + ), +) diff --git a/bazel/BUILD b/bazel/BUILD index ce66abe17466a..628286d66b29d 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -128,3 +128,15 @@ config_setting( name = "force_libcpp", values = {"define": "force_libcpp=enabled"}, ) + +py_binary( + name = "print_dependencies", + srcs = ["print_dependencies.py"], + data = [ + ":repository_locations.bzl", + ":target_recipes.bzl", + "//api/bazel:repository_locations.bzl", + "//ci/build_container/build_recipes:versions.sh", + ], + main = "print_dependencies.py", +) diff --git a/bazel/git_repository_info.py b/bazel/git_repository_info.py deleted file mode 100755 index e8ffa485976fd..0000000000000 --- a/bazel/git_repository_info.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -# Quick-and-dirty Python to fetch git repository info in bazel/repository_locations.bzl. - -import imp -import sys -import subprocess as sp - -repolocs = imp.load_source('replocs', 'bazel/repository_locations.bzl') - -if __name__ == '__main__': - if len(sys.argv) != 2: - print 'Usage: %s ' % sys.argv[0] - sys.exit(1) - repo = sys.argv[1] - if repo not in repolocs.REPOSITORY_LOCATIONS: - print 'Unknown repository: %s' % repo - sys.exit(1) - repoloc = repolocs.REPOSITORY_LOCATIONS[repo] - print '%s %s' % (repoloc['remote'], repoloc['commit']) diff --git a/bazel/print_dependencies.py b/bazel/print_dependencies.py new file mode 100755 index 0000000000000..e2b4daaaf249e --- /dev/null +++ b/bazel/print_dependencies.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +# Quick-and-dirty python to fetch dependency information + +import imp +import json +import os.path +import re + +API_DEPS = imp.load_source('api', 'api/bazel/repository_locations.bzl') +DEPS = imp.load_source('deps', 'bazel/repository_locations.bzl') +RECIPES = imp.load_source('recipies', 'bazel/target_recipes.bzl') +RECIPE_VERSIONS_FILE = 'ci/build_container/build_recipes/versions.sh' + + +# parseRecipeDetails will extact a build_recipe version +# information from the given text. The text typically +# being the build_recipes/version.sh file +def parseRecipeDetails(name, text): + info = {} + + # Remove dashes + prefix = name.upper().translate(None, '-') + scans = { + prefix + '_FILE_SHA256': 'file-sha256', + prefix + '_FILE_URL': 'file-url', + prefix + '_FILE_PREFIX': 'file-prefix', + } + + for env_var, json_key in scans.items(): + match = re.search(env_var + '=(.*)', text) + if match: + info[json_key] = expandVars(match.group(1)) + + return info + + +# expandVars will replace references to environment +# variables in the given 'value' string +def expandVars(value): + return os.path.expandvars(value) + + +if __name__ == '__main__': + deps = [] + + with open(RECIPE_VERSIONS_FILE, 'r') as raw: + recipe_versions = raw.read() + + # Populate the environment so we may resolve + # environment variables + for match in re.finditer('(.*)=(.*)', recipe_versions): + os.environ[match.group(1)] = expandVars(match.group(2)) + + DEPS.REPOSITORY_LOCATIONS.update(API_DEPS.REPOSITORY_LOCATIONS) + for key, loc in DEPS.REPOSITORY_LOCATIONS.items(): + deps.append({ + 'identifier': key, + 'file-sha256': loc.get('sha256'), + 'file-url': loc.get('urls')[0], + 'file-prefix' : loc.get('strip_prefix', ''), + }) + + for key, name in RECIPES.TARGET_RECIPES.items(): + info = parseRecipeDetails(name, recipe_versions) + info['identifier'] = key + deps.append(info) + + deps = sorted(deps, key=lambda k: k['identifier']) + print json.dumps(deps, sort_keys=True, indent=2) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 4c32dab853eac..4e95b1d244695 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -1,4 +1,3 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load(":genrule_repository.bzl", "genrule_repository") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") load(":target_recipes.bzl", "TARGET_RECIPES") @@ -8,6 +7,7 @@ load( "setup_vc_env_vars", ) load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var") +load("//api/bazel:envoy_http_archive.bzl", "envoy_http_archive") # dict of {build recipe name: longform extension name,} PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"} @@ -16,35 +16,7 @@ PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"} GO_VERSION = "1.10.4" 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", ""), - **kwargs - ) + envoy_http_archive(name, repository_locations = REPOSITORY_LOCATIONS, **kwargs) def _build_recipe_repository_impl(ctxt): # modify the recipes list based on the build context diff --git a/ci/build_container/build_recipes/benchmark.sh b/ci/build_container/build_recipes/benchmark.sh index 19a1f7ce02c5f..cfaf921b01ed0 100644 --- a/ci/build_container/build_recipes/benchmark.sh +++ b/ci/build_container/build_recipes/benchmark.sh @@ -2,19 +2,21 @@ set -e -# use commit where cmake 3.6 feature removed. Unblocks Ubuntu 16.xx or below builds -# TODO (moderation) change back to tarball method on next benchmark release -export COMMIT="505be96ab23056580a3a2315abba048f4428b04e" +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" -git clone https://github.com/google/benchmark.git -(cd benchmark; git reset --hard "$COMMIT") -mkdir build +curl "$BENCHMARK_FILE_URL" -sLo benchmark-"$BENCHMARK_GIT_SHA".tar.gz \ + && echo "$BENCHMARK_FILE_SHA256" benchmark-"$BENCHMARK_GIT_SHA".tar.gz | sha256sum --check +tar xf benchmark-"$BENCHMARK_GIT_SHA".tar.gz +cd "$BENCHMARK_FILE_PREFIX" +mkdir build cd build -cmake -G "Ninja" ../benchmark \ +cmake -G "Ninja" \ -DCMAKE_BUILD_TYPE=RELEASE \ - -DBENCHMARK_ENABLE_GTEST_TESTS=OFF + -DBENCHMARK_ENABLE_GTEST_TESTS=OFF \ + .. ninja benchmark_lib="libbenchmark.a" @@ -23,7 +25,7 @@ if [[ "${OS}" == "Windows_NT" ]]; then fi cp "src/$benchmark_lib" "$THIRDPARTY_BUILD"/lib -cd ../benchmark +cd .. INCLUDE_DIR="$THIRDPARTY_BUILD/include/testing/base/public" mkdir -p "$INCLUDE_DIR" diff --git a/ci/build_container/build_recipes/cares.sh b/ci/build_container/build_recipes/cares.sh index 6a0f905252dc6..d58d1da4e2cdb 100755 --- a/ci/build_container/build_recipes/cares.sh +++ b/ci/build_container/build_recipes/cares.sh @@ -2,9 +2,8 @@ set -e -TAG=cares-1_15_0 -VERSION=c-ares-1.15.0 -SHA256=6cdb97871f2930530c97deb7cf5c8fa4be5a0b02c7cea6e7c7667672a39d6852 +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" # cares is fussy over whether -D appears inside CFLAGS vs. CPPFLAGS, oss-fuzz # sets CFLAGS with -D, so we need to impedance match here. In turn, OS X automake @@ -12,10 +11,10 @@ SHA256=6cdb97871f2930530c97deb7cf5c8fa4be5a0b02c7cea6e7c7667672a39d6852 CPPFLAGS="$(for f in $CXXFLAGS; do if [[ $f =~ -D.* ]]; then echo $f; fi; done | tr '\n' ' ')" CFLAGS="$(for f in $CXXFLAGS; do if [[ ! $f =~ -D.* ]]; then echo $f; fi; done | tr '\n' ' ')" -curl https://github.com/c-ares/c-ares/releases/download/"$TAG"/"$VERSION".tar.gz -sLo "$VERSION".tar.gz \ - && echo "$SHA256" "$VERSION".tar.gz | sha256sum --check -tar xf "$VERSION".tar.gz -cd "$VERSION" +curl "$CARES_FILE_URL" -sLo c-ares-"$CARES_VERSION".tar.gz \ + && echo "$CARES_FILE_SHA256" c-ares-"$CARES_VERSION".tar.gz | sha256sum --check +tar xf c-ares-"$CARES_VERSION".tar.gz +cd "$CARES_FILE_PREFIX" mkdir build cd build diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index 416297ed6a6b3..972eb852f3777 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -6,13 +6,13 @@ if [[ "${OS}" == "Windows_NT" ]]; then exit 0 fi -VERSION=2.7 -SHA256=1ee8c8699a0eff6b6a203e59b43330536b22bbcbe6448f54c7091e5efb0763c9 +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" -curl https://github.com/gperftools/gperftools/releases/download/gperftools-"$VERSION"/gperftools-"$VERSION".tar.gz -sLo gperftools-"$VERSION".tar.gz \ - && echo "$SHA256" gperftools-"$VERSION".tar.gz | sha256sum --check -tar xf gperftools-"$VERSION".tar.gz -cd gperftools-"$VERSION" +curl "$GPERFTOOLS_FILE_URL" -sLo gperftools-"$GPERFTOOLS_VERSION".tar.gz \ + && echo "$GPERFTOOLS_FILE_SHA256" gperftools-"$GPERFTOOLS_VERSION".tar.gz | sha256sum --check +tar xf gperftools-"$GPERFTOOLS_VERSION".tar.gz +cd "$GPERFTOOLS_FILE_PREFIX" LDFLAGS="-lpthread" ./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --enable-frame-pointers --disable-libunwind make V=1 install diff --git a/ci/build_container/build_recipes/libevent.sh b/ci/build_container/build_recipes/libevent.sh index 7ae3f2b4c09b9..ce663bf2e1023 100755 --- a/ci/build_container/build_recipes/libevent.sh +++ b/ci/build_container/build_recipes/libevent.sh @@ -2,14 +2,15 @@ set -e -VERSION=2.1.8-stable -SHA256=316ddb401745ac5d222d7c529ef1eada12f58f6376a66c1118eee803cb70f83d +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" # Maintainer provided source tarball does not contain cmake content so using Github tarball. -curl https://github.com/libevent/libevent/archive/release-"$VERSION".tar.gz -sLo libevent-release-"$VERSION".tar.gz \ - && echo "$SHA256" libevent-release-"$VERSION".tar.gz | sha256sum --check -tar xf libevent-release-"$VERSION".tar.gz -cd libevent-release-"$VERSION" +curl "$LIBEVENT_FILE_URL" -sLo libevent-"$LIBEVENT_TAG".tar.gz \ + && echo "$LIBEVENT_FILE_SHA256" libevent-"$LIBEVENT_TAG".tar.gz | sha256sum --check +tar xf libevent-"$LIBEVENT_TAG".tar.gz +cd "$LIBEVENT_FILE_PREFIX" + mkdir build cd build diff --git a/ci/build_container/build_recipes/luajit.sh b/ci/build_container/build_recipes/luajit.sh index e05d6c8880f59..fbdebe3857725 100644 --- a/ci/build_container/build_recipes/luajit.sh +++ b/ci/build_container/build_recipes/luajit.sh @@ -2,13 +2,13 @@ set -e -VERSION=2.0.5 -SHA256=8bb29d84f06eb23c7ea4aa4794dbb248ede9fcb23b6989cbef81dc79352afc97 +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" -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 -cd LuaJIT-"$VERSION" +curl "$LUAJIT_FILE_URL" -sLo LuaJIT-"$LUAJIT_VERSION".tar.gz \ + && echo "$LUAJIT_FILE_SHA256" LuaJIT-"$LUAJIT_VERSION".tar.gz | sha256sum --check +tar xf LuaJIT-"$LUAJIT_VERSION".tar.gz +cd "$LUAJIT_FILE_PREFIX" # Fixup Makefile with things that cannot be set via env var. diff --git a/ci/build_container/build_recipes/nghttp2.sh b/ci/build_container/build_recipes/nghttp2.sh index dea7cd7493123..e63432a0d9c74 100755 --- a/ci/build_container/build_recipes/nghttp2.sh +++ b/ci/build_container/build_recipes/nghttp2.sh @@ -2,13 +2,13 @@ set -e -VERSION=1.34.0 -SHA256=8889399ddd38aa0405f6e84f1c050a292286089441686b8a9c5e937de4f5b61d +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" -curl https://github.com/nghttp2/nghttp2/releases/download/v"$VERSION"/nghttp2-"$VERSION".tar.gz -sLo nghttp2-"$VERSION".tar.gz \ - && echo "$SHA256" nghttp2-"$VERSION".tar.gz | sha256sum --check -tar xf nghttp2-"$VERSION".tar.gz -cd nghttp2-"$VERSION" +curl "$NGHTTP2_FILE_URL" -sLo nghttp2-"$NGHTTP2_VERSION".tar.gz \ + && echo "$NGHTTP2_FILE_SHA256" nghttp2-"$NGHTTP2_VERSION".tar.gz | sha256sum --check +tar xf nghttp2-"$NGHTTP2_VERSION".tar.gz +cd "$NGHTTP2_FILE_PREFIX" # Allow nghttp2 to build as static lib on Windows # TODO: remove once https://github.com/nghttp2/nghttp2/pull/1198 is merged diff --git a/ci/build_container/build_recipes/versions.sh b/ci/build_container/build_recipes/versions.sh new file mode 100755 index 0000000000000..45d33a769a1b3 --- /dev/null +++ b/ci/build_container/build_recipes/versions.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Please ensure edits to this file don't break the python script 'get_repository_info.py' +# ie. from root of the project run +# +# python bazel/print_dependencies.py +# +# and the bazel run rule +# +# bazel run //bazel:print_dependencies +# +# Since the script use's python's os.path.expandvars we do not quote variables +# in this file. + +# use commit where cmake 3.6 feature removed. Unblocks Ubuntu 16.xx or below builds +# TODO (moderation) change back to tarball method on next benchmark release +BENCHMARK_GIT_SHA=505be96ab23056580a3a2315abba048f4428b04e +BENCHMARK_FILE_URL=https://github.com/google/benchmark/archive/$BENCHMARK_GIT_SHA.tar.gz +BENCHMARK_FILE_SHA256=0de43b6eaddd356f1d6cd164f73f37faf2f6c96fd684e1f7ea543ce49c1d144e +BENCHMARK_FILE_PREFIX=benchmark-$BENCHMARK_GIT_SHA + +CARES_VERSION=1.15.0 +CARES_TAG=cares-1_15_0 +CARES_FILE_URL=https://github.com/c-ares/c-ares/releases/download/$CARES_TAG/c-ares-$CARES_VERSION.tar.gz +CARES_FILE_SHA256=6cdb97871f2930530c97deb7cf5c8fa4be5a0b02c7cea6e7c7667672a39d6852 +CARES_FILE_PREFIX=c-ares-$CARES_VERSION + +GPERFTOOLS_VERSION=2.7 +GPERFTOOLS_TAG=gperftools-$GPERFTOOLS_VERSION +GPERFTOOLS_FILE_URL=https://github.com/gperftools/gperftools/releases/download/$GPERFTOOLS_TAG/$GPERFTOOLS_TAG.tar.gz +GPERFTOOLS_FILE_SHA256=1ee8c8699a0eff6b6a203e59b43330536b22bbcbe6448f54c7091e5efb0763c9 +GPERFTOOLS_FILE_PREFIX=gperftools-$GPERFTOOLS_VERSION + +# Maintainer provided source tarball does not contain cmake content so using Github tarball. +LIBEVENT_VERSION=2.1.8-stable +LIBEVENT_TAG=release-$LIBEVENT_VERSION +LIBEVENT_FILE_URL=https://github.com/libevent/libevent/archive/$LIBEVENT_TAG.tar.gz +LIBEVENT_FILE_SHA256=316ddb401745ac5d222d7c529ef1eada12f58f6376a66c1118eee803cb70f83d +LIBEVENT_FILE_PREFIX=libevent-$LIBEVENT_TAG + +LUAJIT_VERSION=2.0.5 +LUAJIT_FILE_URL=https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.tar.gz +LUAJIT_FILE_SHA256=8bb29d84f06eb23c7ea4aa4794dbb248ede9fcb23b6989cbef81dc79352afc97 +LUAJIT_FILE_PREFIX=LuaJIT-$LUAJIT_VERSION + +NGHTTP2_VERSION=1.34.0 +NGHTTP2_FILE_URL=https://github.com/nghttp2/nghttp2/releases/download/v$NGHTTP2_VERSION/nghttp2-$NGHTTP2_VERSION.tar.gz +NGHTTP2_FILE_SHA256=8889399ddd38aa0405f6e84f1c050a292286089441686b8a9c5e937de4f5b61d +NGHTTP2_FILE_PREFIX=nghttp2-$NGHTTP2_VERSION + +# Pin to this commit to pick up fix for building on Visual Studio 15.8 +YAMLCPP_GIT_SHA=0f9a586ca1dc29c2ecb8dd715a315b93e3f40f79 +YAMLCPP_FILE_URL=https://github.com/jbeder/yaml-cpp/archive/$YAMLCPP_GIT_SHA.tar.gz +YAMLCPP_FILE_SHA256=53dcffd55f3433b379fcc694f45c54898711c0e29159a7bd02e82a3e0253bac3 +YAMLCPP_FILE_PREFIX=yaml-cpp-$YAMLCPP_GIT_SHA + +ZLIB_VERSION=1.2.11 +ZLIB_FILE_URL=https://github.com/madler/zlib/archive/v$ZLIB_VERSION.tar.gz +ZLIB_FILE_SHA256=629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff +ZLIB_FILE_PREFIX=zlib-$ZLIB_VERSION diff --git a/ci/build_container/build_recipes/yaml-cpp.sh b/ci/build_container/build_recipes/yaml-cpp.sh index 59253e93798ff..51baaf4017365 100755 --- a/ci/build_container/build_recipes/yaml-cpp.sh +++ b/ci/build_container/build_recipes/yaml-cpp.sh @@ -2,14 +2,13 @@ set -e -# Pin to this commit to pick up fix for building on Visual Studio 15.8 -COMMIT=0f9a586ca1dc29c2ecb8dd715a315b93e3f40f79 # 2018-06-30 -SHA256=53dcffd55f3433b379fcc694f45c54898711c0e29159a7bd02e82a3e0253bac3 +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" -curl https://github.com/jbeder/yaml-cpp/archive/"$COMMIT".tar.gz -sLo yaml-cpp-"$COMMIT".tar.gz \ - && echo "$SHA256" yaml-cpp-"$COMMIT".tar.gz | sha256sum --check -tar xf yaml-cpp-"$COMMIT".tar.gz -cd yaml-cpp-"$COMMIT" +curl "$YAMLCPP_FILE_URL" -sLo yaml-cpp-"$YAMLCPP_GIT_SHA".tar.gz \ + && echo "$YAMLCPP_FILE_SHA256" yaml-cpp-"$YAMLCPP_GIT_SHA".tar.gz | sha256sum --check +tar xf yaml-cpp-"$YAMLCPP_GIT_SHA".tar.gz +cd "$YAMLCPP_FILE_PREFIX" mkdir build cd build diff --git a/ci/build_container/build_recipes/zlib.sh b/ci/build_container/build_recipes/zlib.sh index c29aeee7dea81..7c796fe5de860 100644 --- a/ci/build_container/build_recipes/zlib.sh +++ b/ci/build_container/build_recipes/zlib.sh @@ -2,13 +2,14 @@ set -e -VERSION=1.2.11 -SHA256=629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "${SCRIPT_DIR}/versions.sh" + +curl "$ZLIB_FILE_URL" -sLo zlib-"$ZLIB_VERSION".tar.gz \ + && echo "$ZLIB_FILE_SHA256" zlib-"$ZLIB_VERSION".tar.gz | sha256sum --check +tar xf zlib-"$ZLIB_VERSION".tar.gz +cd "$ZLIB_FILE_PREFIX" -curl https://github.com/madler/zlib/archive/v"$VERSION".tar.gz -sLo zlib-"$VERSION".tar.gz \ - && echo "$SHA256" zlib-"$VERSION".tar.gz | sha256sum --check -tar xf zlib-"$VERSION".tar.gz -cd zlib-"$VERSION" mkdir build cd build