commit
3740e6fa68
208 changed files with 5663 additions and 2588 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,159 @@ |
||||
# Internal Starlark definitions for Protobuf. |
||||
|
||||
load("@rules_cc//cc:defs.bzl", starlark_cc_proto_library = "cc_proto_library") |
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") |
||||
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test") |
||||
load(":compiler_config_setting.bzl", "create_compiler_config_setting") |
||||
|
||||
package( |
||||
default_visibility = [ |
||||
# Public, but Protobuf only visibility. |
||||
"//:__subpackages__", |
||||
], |
||||
) |
||||
|
||||
create_compiler_config_setting( |
||||
name = "config_msvc", |
||||
value = "msvc-cl", |
||||
) |
||||
|
||||
# Android NDK builds can specify different crosstool_top flags to choose which |
||||
# STL they use for C++. We need these multiple variants to catch all of those |
||||
# versions of crosstool_top and reliably detect Android. |
||||
# |
||||
# For more info on the various crosstool_tops used by NDK Bazel builds, see: |
||||
# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl |
||||
|
||||
config_setting( |
||||
name = "config_android", |
||||
values = { |
||||
"crosstool_top": "//external:android/crosstool", |
||||
}, |
||||
) |
||||
|
||||
config_setting( |
||||
name = "config_android-stlport", |
||||
values = { |
||||
"crosstool_top": "@androidndk//:toolchain-stlport", |
||||
}, |
||||
) |
||||
|
||||
config_setting( |
||||
name = "config_android-libcpp", |
||||
values = { |
||||
"crosstool_top": "@androidndk//:toolchain-libcpp", |
||||
}, |
||||
) |
||||
|
||||
config_setting( |
||||
name = "config_android-gnu-libstdcpp", |
||||
values = { |
||||
"crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp", |
||||
}, |
||||
) |
||||
|
||||
config_setting( |
||||
name = "config_android-default", |
||||
values = { |
||||
"crosstool_top": "@androidndk//:default_crosstool", |
||||
}, |
||||
) |
||||
|
||||
# Internal testing: |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "any_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:any_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "api_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:api_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "compiler_plugin_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:compiler_plugin_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "descriptor_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:descriptor_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "duration_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:duration_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "empty_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:empty_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "field_mask_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:field_mask_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "source_context_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:source_context_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "struct_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:struct_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "timestamp_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:timestamp_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "type_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:type_proto"], |
||||
) |
||||
|
||||
starlark_cc_proto_library( |
||||
name = "wrappers_cc_proto", |
||||
visibility = ["//visibility:private"], |
||||
deps = ["//:wrappers_proto"], |
||||
) |
||||
|
||||
cc_proto_blacklist_test( |
||||
name = "cc_proto_blacklist_test", |
||||
deps = [ |
||||
":any_cc_proto", |
||||
":api_cc_proto", |
||||
":compiler_plugin_cc_proto", |
||||
":descriptor_cc_proto", |
||||
":duration_cc_proto", |
||||
":empty_cc_proto", |
||||
":field_mask_cc_proto", |
||||
":source_context_cc_proto", |
||||
":struct_cc_proto", |
||||
":timestamp_cc_proto", |
||||
":type_cc_proto", |
||||
":wrappers_cc_proto", |
||||
], |
||||
) |
||||
|
||||
pkg_files( |
||||
name = "dist_files", |
||||
srcs = glob(["*"]), |
||||
strip_prefix = strip_prefix.from_root(""), |
||||
visibility = ["//pkg:__pkg__"], |
||||
) |
@ -0,0 +1,40 @@ |
||||
# C++ compile/link options for Protobuf. |
||||
|
||||
COPTS = select({ |
||||
"//build_defs:config_msvc": [ |
||||
"/wd4065", # switch statement contains 'default' but no 'case' labels |
||||
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data |
||||
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' |
||||
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data |
||||
"/wd4305", # 'identifier' : truncation from 'type1' to 'type2' |
||||
"/wd4307", # 'operator' : integral constant overflow |
||||
"/wd4309", # 'conversion' : truncation of constant value |
||||
"/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) |
||||
"/wd4355", # 'this' : used in base member initializer list |
||||
"/wd4506", # no definition for inline function 'function' |
||||
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) |
||||
"/wd4996", # The compiler encountered a deprecated declaration. |
||||
], |
||||
"//conditions:default": [ |
||||
"-DHAVE_ZLIB", |
||||
"-Woverloaded-virtual", |
||||
"-Wno-sign-compare", |
||||
], |
||||
}) |
||||
|
||||
# Android and MSVC builds do not need to link in a separate pthread library. |
||||
LINK_OPTS = select({ |
||||
"//build_defs:config_android": [], |
||||
"//build_defs:config_android-stlport": [], |
||||
"//build_defs:config_android-libcpp": [], |
||||
"//build_defs:config_android-gnu-libstdcpp": [], |
||||
"//build_defs:config_android-default": [], |
||||
"//build_defs:config_msvc": [ |
||||
# Suppress linker warnings about files with no symbols defined. |
||||
"-ignore:4221", |
||||
], |
||||
"//conditions:default": [ |
||||
"-lpthread", |
||||
"-lm", |
||||
], |
||||
}) |
@ -0,0 +1,183 @@ |
||||
# Conformance testing for Protobuf. |
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library") |
||||
load( |
||||
"@rules_pkg//:mappings.bzl", |
||||
"pkg_attributes", |
||||
"pkg_filegroup", |
||||
"pkg_files", |
||||
"strip_prefix", |
||||
) |
||||
|
||||
exports_files([ |
||||
"conformance_test_runner.sh", |
||||
"failure_list_java.txt", |
||||
"failure_list_java_lite.txt", |
||||
"text_format_failure_list_java.txt", |
||||
"text_format_failure_list_java_lite.txt", |
||||
]) |
||||
|
||||
cc_proto_library( |
||||
name = "test_messages_proto2_proto_cc", |
||||
deps = ["//:test_messages_proto2_proto"], |
||||
) |
||||
|
||||
cc_proto_library( |
||||
name = "test_messages_proto3_proto_cc", |
||||
deps = ["//:test_messages_proto3_proto"], |
||||
) |
||||
|
||||
proto_library( |
||||
name = "conformance_proto", |
||||
srcs = ["conformance.proto"], |
||||
visibility = ["//visibility:public"], |
||||
) |
||||
|
||||
cc_proto_library( |
||||
name = "conformance_proto_cc", |
||||
deps = [":conformance_proto"], |
||||
) |
||||
|
||||
java_proto_library( |
||||
name = "conformance_java_proto", |
||||
visibility = [ |
||||
"//java:__subpackages__", |
||||
], |
||||
deps = [":conformance_proto"], |
||||
) |
||||
|
||||
java_lite_proto_library( |
||||
name = "conformance_java_proto_lite", |
||||
visibility = [ |
||||
"//java:__subpackages__", |
||||
], |
||||
deps = [":conformance_proto"], |
||||
) |
||||
|
||||
cc_library( |
||||
name = "jsoncpp", |
||||
srcs = ["third_party/jsoncpp/jsoncpp.cpp"], |
||||
hdrs = ["third_party/jsoncpp/json.h"], |
||||
includes = ["."], |
||||
) |
||||
|
||||
cc_library( |
||||
name = "conformance_test", |
||||
srcs = [ |
||||
"conformance_test.cc", |
||||
"conformance_test_runner.cc", |
||||
], |
||||
hdrs = [ |
||||
"conformance_test.h", |
||||
], |
||||
includes = ["."], |
||||
deps = [":conformance_proto_cc"], |
||||
) |
||||
|
||||
cc_library( |
||||
name = "binary_json_conformance_suite", |
||||
srcs = ["binary_json_conformance_suite.cc"], |
||||
hdrs = ["binary_json_conformance_suite.h"], |
||||
deps = [ |
||||
":conformance_test", |
||||
":jsoncpp", |
||||
":test_messages_proto2_proto_cc", |
||||
":test_messages_proto3_proto_cc", |
||||
], |
||||
) |
||||
|
||||
cc_library( |
||||
name = "text_format_conformance_suite", |
||||
srcs = ["text_format_conformance_suite.cc"], |
||||
hdrs = ["text_format_conformance_suite.h"], |
||||
deps = [ |
||||
":conformance_test", |
||||
":test_messages_proto2_proto_cc", |
||||
":test_messages_proto3_proto_cc", |
||||
], |
||||
) |
||||
|
||||
cc_binary( |
||||
name = "conformance_test_runner", |
||||
srcs = ["conformance_test_main.cc"], |
||||
visibility = ["//visibility:public"], |
||||
deps = [ |
||||
":binary_json_conformance_suite", |
||||
":conformance_test", |
||||
":text_format_conformance_suite", |
||||
], |
||||
) |
||||
|
||||
java_binary( |
||||
name = "conformance_java", |
||||
srcs = ["ConformanceJava.java"], |
||||
main_class = "ConformanceJava", |
||||
visibility = [ |
||||
"//java:__subpackages__", |
||||
], |
||||
deps = [ |
||||
":conformance_java_proto", |
||||
"//:protobuf_java", |
||||
"//:protobuf_java_util", |
||||
"//:test_messages_proto2_java_proto", |
||||
"//:test_messages_proto3_java_proto", |
||||
], |
||||
) |
||||
|
||||
java_binary( |
||||
name = "conformance_java_lite", |
||||
srcs = ["ConformanceJavaLite.java"], |
||||
main_class = "ConformanceJavaLite", |
||||
visibility = [ |
||||
"//java:__subpackages__", |
||||
], |
||||
deps = [ |
||||
":conformance_java_proto_lite", |
||||
"//:protobuf_java_util", |
||||
"//:protobuf_javalite", |
||||
"//:test_messages_proto2_java_proto_lite", |
||||
"//:test_messages_proto3_java_proto_lite", |
||||
], |
||||
) |
||||
|
||||
filegroup( |
||||
name = "all_files", |
||||
srcs = glob(["**/*"]), |
||||
visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"], |
||||
) |
||||
|
||||
pkg_files( |
||||
name = "dist_files", |
||||
srcs = glob( |
||||
["**/*"], |
||||
exclude = [ |
||||
# Handled by dist_scripts: |
||||
"conformance_test_runner.sh", |
||||
|
||||
# The following are not in autotools dist: |
||||
"autoload.php", |
||||
"conformance_nodejs.js", |
||||
"failure_list_jruby.txt", |
||||
"update_failure_list.py", |
||||
], |
||||
), |
||||
strip_prefix = strip_prefix.from_root(""), |
||||
visibility = ["//pkg:__pkg__"], |
||||
) |
||||
|
||||
pkg_files( |
||||
name = "dist_scripts", |
||||
srcs = ["conformance_test_runner.sh"], |
||||
attributes = pkg_attributes(mode = "0555"), |
||||
strip_prefix = strip_prefix.from_root(""), |
||||
visibility = ["//pkg:__pkg__"], |
||||
) |
||||
|
||||
pkg_filegroup( |
||||
name = "all_dist_files", |
||||
srcs = [ |
||||
":dist_files", |
||||
":dist_scripts", |
||||
], |
||||
visibility = ["//pkg:__pkg__"], |
||||
) |
@ -0,0 +1,55 @@ |
||||
#!/bin/bash |
||||
# |
||||
# Script to compare a distribution archive for expected files based on git. |
||||
# |
||||
# Usage: |
||||
# check_missing_dist_files.sh path/to/dist_archive.tar.gz |
||||
|
||||
set -eux |
||||
set -o pipefail |
||||
|
||||
# By default, look for a git repo based on this script's path. |
||||
: ${SOURCE_DIR:=$(cd $(dirname $0)/../.. ; pwd)} |
||||
|
||||
# Use a temporary directory for intermediate files. |
||||
# Note that pipelines below use subshells to avoid multiple trap executions. |
||||
_workdir=$(mktemp -d) |
||||
function cleanup_workdir() { rm -r ${_workdir}; } |
||||
trap cleanup_workdir EXIT |
||||
|
||||
# List all the files in the archive. |
||||
( |
||||
tar -atf $1 | \ |
||||
cut -d/ -f2- | \ |
||||
sort |
||||
) > ${_workdir}/archive.lst |
||||
|
||||
# List all files in the git repo that should be in the archive. |
||||
( |
||||
git -C ${SOURCE_DIR} ls-files | \ |
||||
grep "^\(java\|python\|objectivec\|csharp\|ruby\|php\|cmake\|examples\|src/google/protobuf/.*\.proto\)" |\ |
||||
grep -v ".gitignore" | \ |
||||
grep -v "java/lite/proguard.pgcfg" | \ |
||||
grep -v "python/compatibility_tests" | \ |
||||
grep -v "python/docs" | \ |
||||
grep -v "python/.repo-metadata.json" | \ |
||||
grep -v "python/protobuf_distutils" | \ |
||||
grep -v "csharp/compatibility_tests" | \ |
||||
sort |
||||
) > ${_workdir}/expected.lst |
||||
|
||||
# Check for missing files. |
||||
MISSING_FILES=( $(cd ${_workdir} && comm -13 archive.lst expected.lst) ) |
||||
if (( ${#MISSING_FILES[@]} == 0 )); then |
||||
exit 0 |
||||
fi |
||||
|
||||
( |
||||
set +x |
||||
echo -e "\n\nMissing files from archive:" |
||||
for (( i=0 ; i < ${#MISSING_FILES[@]} ; i++ )); do |
||||
echo " ${MISSING_FILES[i]}" |
||||
done |
||||
echo -e "\nAdd them to the 'pkg_files' rule in corresponding BUILD.bazel.\n" |
||||
) >&2 |
||||
exit 1 |
@ -0,0 +1,84 @@ |
||||
#!/bin/bash |
||||
# |
||||
# Build tests under CMake. |
||||
# |
||||
# This script is used from macos and linux builds. It runs cmake and ctest in |
||||
# the current directory. Any additional setup should be done before running this |
||||
# script. |
||||
# |
||||
# This script uses `caplog` to save logfiles. See caplog.sh for details. |
||||
|
||||
set -eu -o pipefail |
||||
: ${SCRIPT_ROOT:=$(cd $(dirname $0)/../..; pwd)} |
||||
|
||||
################################################################################ |
||||
# If you are using this script to run tests, you can set some environment |
||||
# variables to control behavior: |
||||
# |
||||
# By default, find the sources based on this script's path. |
||||
: ${SOURCE_DIR:=${SCRIPT_ROOT}} |
||||
# |
||||
# By default, put outputs under <git root>/cmake/build. |
||||
: ${BUILD_DIR:=${SOURCE_DIR}/cmake/build} |
||||
# |
||||
# CMAKE_BUILD_TYPE is supported in cmake 3.22+. If set, we pass the value of this |
||||
# variable explicitly for compatibility with older versions of cmake. See: |
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html |
||||
# (N.B.: not to be confused with CMAKE_CONFIG_TYPE.) |
||||
if [[ -n ${CMAKE_BUILD_TYPE:-} ]]; then |
||||
CMAKE_BUILD_TYPE_FLAG="-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" |
||||
else |
||||
CMAKE_BUILD_TYPE_FLAG= |
||||
fi |
||||
# |
||||
# For several other CMake options, see docs here: |
||||
# https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html |
||||
# |
||||
# Some variables you may want to override (see cmake docs for details): |
||||
# CMAKE_BUILD_PARALLEL_LEVEL |
||||
# CMAKE_CONFIG_TYPE (N.B.: not to be confused with CMAKE_BUILD_TYPE) |
||||
# CMAKE_GENERATOR |
||||
# CTEST_PARALLEL_LEVEL |
||||
################################################################################ |
||||
|
||||
echo "Building using..." |
||||
echo " Sources: ${SOURCE_DIR}" |
||||
echo " Build output: ${BUILD_DIR}" |
||||
if [[ ${SOURCE_DIR} != ${SCRIPT_ROOT} ]]; then |
||||
echo " Build scripts: ${SCRIPT_ROOT}" |
||||
fi |
||||
set -x |
||||
source ${SCRIPT_ROOT}/kokoro/common/caplog.sh |
||||
|
||||
# |
||||
# Configure under $BUILD_DIR: |
||||
# |
||||
mkdir -p "${BUILD_DIR}" |
||||
|
||||
( |
||||
cd "${BUILD_DIR}" |
||||
caplog 01_configure \ |
||||
cmake -S "${SOURCE_DIR}" \ |
||||
${CMAKE_BUILD_TYPE_FLAG} \ |
||||
${CAPLOG_CMAKE_ARGS:-} |
||||
) |
||||
if [[ -n ${CAPLOG_DIR:-} ]]; then |
||||
# Save configuration logs. |
||||
mkdir -p "${CAPLOG_DIR}/CMakeFiles" |
||||
cp "${BUILD_DIR}"/CMakeFiles/CMake*.log "${CAPLOG_DIR}/CMakeFiles" |
||||
fi |
||||
|
||||
# |
||||
# Build: |
||||
# |
||||
caplog 02_build \ |
||||
cmake --build "${BUILD_DIR}" |
||||
|
||||
# |
||||
# Run tests |
||||
# |
||||
( |
||||
cd "${BUILD_DIR}" |
||||
caplog 03_combined_testlog \ |
||||
ctest ${CAPLOG_CTEST_ARGS:-} |
||||
) |
@ -0,0 +1,89 @@ |
||||
#!/bin/bash |
||||
# |
||||
# Build file to set up and run tests using bazel-build dist archive |
||||
# |
||||
# Note that the builds use WORKSPACE to fetch external sources, not |
||||
# git submodules. |
||||
|
||||
set -eux |
||||
|
||||
BUILD_ONLY_TARGETS=( |
||||
//pkg:all |
||||
//:protoc |
||||
//:protobuf |
||||
//:protobuf_python |
||||
) |
||||
|
||||
TEST_TARGETS=( |
||||
//build_defs:all |
||||
//conformance:all |
||||
//java:tests |
||||
//python:all |
||||
//src/... |
||||
@com_google_protobuf_examples//... |
||||
) |
||||
|
||||
CONTAINER_NAME=gcr.io/protobuf-build/bazel/linux |
||||
CONTAINER_VERSION=5.1.1-e41ccfa1648716433276ebe077c665796550fcbb |
||||
|
||||
use_bazel.sh 5.0.0 || true |
||||
bazel version |
||||
|
||||
# Change to repo root |
||||
cd $(dirname $0)/../../.. |
||||
|
||||
# Construct temp directory for running the dist build. |
||||
# If you want to run locally and keep the build dir, create a directory |
||||
# and pass it in the DIST_WORK_ROOT env var. |
||||
if [[ -z ${DIST_WORK_ROOT:-} ]]; then |
||||
: ${DIST_WORK_ROOT:=$(mktemp -d)} |
||||
function dist_cleanup() { |
||||
rm -rf ${DIST_WORK_ROOT} |
||||
} |
||||
trap dist_cleanup EXIT |
||||
fi |
||||
|
||||
# Let Bazel share the distdir. |
||||
TMP_DISTDIR=${DIST_WORK_ROOT}/bazel-distdir |
||||
mkdir -p ${TMP_DISTDIR} |
||||
|
||||
# Build distribution archive |
||||
date |
||||
bazel fetch --distdir=${TMP_DISTDIR} //pkg:dist_all_tar |
||||
bazel build --distdir=${TMP_DISTDIR} //pkg:dist_all_tar |
||||
DIST_ARCHIVE=$(readlink $(bazel info bazel-bin)/pkg/dist_all_tar.tar.gz) |
||||
bazel shutdown |
||||
|
||||
# The `pkg_tar` rule emits a symlink based on the rule name. The actual |
||||
# file is named with the current version. |
||||
date |
||||
echo "Resolved archive path: ${DIST_ARCHIVE}" |
||||
|
||||
# Extract the dist archive. |
||||
date |
||||
DIST_WORKSPACE=${DIST_WORK_ROOT}/protobuf |
||||
mkdir -p ${DIST_WORKSPACE} |
||||
tar -C ${DIST_WORKSPACE} --strip-components=1 -axf ${DIST_ARCHIVE} |
||||
|
||||
# Perform build steps in the extracted dist sources. |
||||
|
||||
cd ${DIST_WORKSPACE} |
||||
FAILED=false |
||||
|
||||
until docker pull gcr.io/protobuf-build/bazel/linux:${CONTAINER_VERSION}; do |
||||
sleep 10 |
||||
done |
||||
|
||||
date |
||||
docker run --rm \ |
||||
-v ${DIST_WORKSPACE}:/workspace \ |
||||
-v ${TMP_DISTDIR}:${TMP_DISTDIR} \ |
||||
${CONTAINER_NAME}:${CONTAINER_VERSION} \ |
||||
test --distdir=${TMP_DISTDIR} --test_output=errors -k \ |
||||
"${BUILD_ONLY_TARGETS[@]}" "${TEST_TARGETS[@]}" || FAILED=true |
||||
|
||||
if ${FAILED}; then |
||||
echo FAILED |
||||
exit 1 |
||||
fi |
||||
echo PASS |
@ -0,0 +1,5 @@ |
||||
# Config file for running tests in Kokoro |
||||
|
||||
# Location of the build script in repository |
||||
build_file: "protobuf/kokoro/linux/bazel_distcheck/build.sh" |
||||
timeout_mins: 15 |
@ -0,0 +1,5 @@ |
||||
# Config file for running tests in Kokoro |
||||
|
||||
# Location of the build script in repository |
||||
build_file: "protobuf/kokoro/linux/bazel_distcheck/build.sh" |
||||
timeout_mins: 15 |
@ -0,0 +1,66 @@ |
||||
#!/bin/bash |
||||
# |
||||
# Build file to set up and run tests based on distribution archive |
||||
|
||||
set -eux |
||||
|
||||
# Change to repo root |
||||
cd $(dirname $0)/../../.. |
||||
|
||||
# |
||||
# Update git submodules |
||||
# |
||||
git submodule update --init --recursive |
||||
|
||||
# |
||||
# Build distribution archive |
||||
# |
||||
# TODO: this should use Bazel-built dist archives. |
||||
date ; ./autogen.sh |
||||
date ; ./configure |
||||
date ; make dist |
||||
date |
||||
|
||||
DIST_ARCHIVE=( $(ls protobuf-*.tar.gz) ) |
||||
if (( ${#DIST_ARCHIVE[@]} != 1 )); then |
||||
echo >&2 "Distribution archive not found. ${#DIST_ARCHIVE[@]} matches:" |
||||
echo >&2 "${DIST_ARCHIVE[@]}" |
||||
exit 1 |
||||
fi |
||||
|
||||
# |
||||
# Check for all expected files |
||||
# |
||||
kokoro/common/check_missing_dist_files.sh ${DIST_ARCHIVE} |
||||
|
||||
# |
||||
# Extract to a temporary directory |
||||
# |
||||
if [[ -z ${DIST_WORK_ROOT:-} ]]; then |
||||
# If you want to preserve the extracted sources, set the DIST_WORK_ROOT |
||||
# environment variable to an existing directory that should be used. |
||||
DIST_WORK_ROOT=$(mktemp -d) |
||||
function cleanup_work_root() { |
||||
echo "Cleaning up temporary directory ${DIST_WORK_ROOT}..." |
||||
rm -rf ${DIST_WORK_ROOT} |
||||
} |
||||
trap cleanup_work_root EXIT |
||||
fi |
||||
|
||||
tar -C ${DIST_WORK_ROOT} --strip-components=1 -axf ${DIST_ARCHIVE} |
||||
|
||||
# |
||||
# Run tests using extracted sources |
||||
# |
||||
if SOURCE_DIR=${DIST_WORK_ROOT} \ |
||||
CMAKE_GENERATOR=Ninja \ |
||||
CTEST_PARALLEL_LEVEL=$(nproc) \ |
||||
kokoro/common/cmake.sh; then |
||||
# TODO: remove this conditional. |
||||
# The cmake build is expected to fail due to missing abseil sources. |
||||
echo "$0: Expected failure, but build passed." >&2 |
||||
echo "Please update $(basename $0) to remove failure expectation." >&2 |
||||
echo "FAIL" >&2 |
||||
exit 1 |
||||
fi |
||||
echo "PASS" |
@ -0,0 +1,5 @@ |
||||
# Config file for running tests in Kokoro |
||||
|
||||
# Location of the build script in repository |
||||
build_file: "protobuf/kokoro/linux/cmake_distcheck/build.sh" |
||||
timeout_mins: 1440 |
@ -0,0 +1,5 @@ |
||||
# Config file for running tests in Kokoro |
||||
|
||||
# Location of the build script in repository |
||||
build_file: "protobuf/kokoro/linux/cmake_distcheck/build.sh" |
||||
timeout_mins: 1440 |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue