ADD: added new version of protobuf
This commit is contained in:
@@ -8,11 +8,6 @@ set -eu
|
||||
# Some base locations.
|
||||
readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
|
||||
readonly ProtoRootDir="${ScriptDir}/../.."
|
||||
readonly BazelFlags="--announce_rc --macos_minimum_os=10.9 \
|
||||
$(${ScriptDir}/../../kokoro/common/bazel_flags.sh)"
|
||||
|
||||
# Invoke with BAZEL=bazelisk to use that instead.
|
||||
readonly BazelBin="${BAZEL:=bazel}"
|
||||
|
||||
printUsage() {
|
||||
NAME=$(basename "${0}")
|
||||
@@ -29,9 +24,13 @@ OPTIONS:
|
||||
Show this message
|
||||
-c, --clean
|
||||
Issue a clean before the normal build.
|
||||
-a, --autogen
|
||||
Start by rerunning autogen & configure.
|
||||
-r, --regenerate-descriptors
|
||||
Run generate_descriptor_proto.sh to regenerate all the checked in
|
||||
proto sources.
|
||||
-j #, --jobs #
|
||||
Force the number of parallel jobs (useful for debugging build issues).
|
||||
--core-only
|
||||
Skip some of the core protobuf build/checks to shorten the build time.
|
||||
--skip-xcode
|
||||
@@ -61,7 +60,25 @@ header() {
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
BAZEL=bazel
|
||||
# Thanks to libtool, builds can fail in odd ways and since it eats some output
|
||||
# it can be hard to spot, so force error output if make exits with a non zero.
|
||||
wrapped_make() {
|
||||
set +e # Don't stop if the command fails.
|
||||
make $*
|
||||
MAKE_EXIT_STATUS=$?
|
||||
if [ ${MAKE_EXIT_STATUS} -ne 0 ]; then
|
||||
echo "Error: 'make $*' exited with status ${MAKE_EXIT_STATUS}"
|
||||
exit ${MAKE_EXIT_STATUS}
|
||||
fi
|
||||
set -e
|
||||
}
|
||||
|
||||
NUM_MAKE_JOBS=$(/usr/sbin/sysctl -n hw.ncpu)
|
||||
if [[ "${NUM_MAKE_JOBS}" -lt 2 ]] ; then
|
||||
NUM_MAKE_JOBS=2
|
||||
fi
|
||||
|
||||
DO_AUTOGEN=no
|
||||
DO_CLEAN=no
|
||||
REGEN_DESCRIPTORS=no
|
||||
CORE_ONLY=no
|
||||
@@ -81,9 +98,16 @@ while [[ $# != 0 ]]; do
|
||||
-c | --clean )
|
||||
DO_CLEAN=yes
|
||||
;;
|
||||
-a | --autogen )
|
||||
DO_AUTOGEN=yes
|
||||
;;
|
||||
-r | --regenerate-descriptors )
|
||||
REGEN_DESCRIPTORS=yes
|
||||
;;
|
||||
-j | --jobs )
|
||||
shift
|
||||
NUM_MAKE_JOBS="${1}"
|
||||
;;
|
||||
--core-only )
|
||||
CORE_ONLY=yes
|
||||
;;
|
||||
@@ -130,9 +154,21 @@ done
|
||||
# Into the proto dir.
|
||||
cd "${ProtoRootDir}"
|
||||
|
||||
# if no Makefile, force the autogen.
|
||||
if [[ ! -f Makefile ]] ; then
|
||||
DO_AUTOGEN=yes
|
||||
fi
|
||||
|
||||
if [[ "${DO_AUTOGEN}" == "yes" ]] ; then
|
||||
header "Running autogen & configure"
|
||||
./autogen.sh
|
||||
./configure \
|
||||
CPPFLAGS="-mmacosx-version-min=10.9 -Wunused-const-variable -Wunused-function"
|
||||
fi
|
||||
|
||||
if [[ "${DO_CLEAN}" == "yes" ]] ; then
|
||||
header "Cleaning"
|
||||
"${BazelBin}" clean
|
||||
wrapped_make clean
|
||||
if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
|
||||
XCODEBUILD_CLEAN_BASE_IOS=(
|
||||
xcodebuild
|
||||
@@ -176,23 +212,26 @@ fi
|
||||
|
||||
if [[ "${REGEN_DESCRIPTORS}" == "yes" ]] ; then
|
||||
header "Regenerating the descriptor sources."
|
||||
./generate_descriptor_proto.sh
|
||||
./generate_descriptor_proto.sh -j "${NUM_MAKE_JOBS}"
|
||||
fi
|
||||
|
||||
if [[ "${CORE_ONLY}" == "yes" ]] ; then
|
||||
header "Building core Only"
|
||||
"${BazelBin}" build //:protoc //:protobuf //:protobuf_lite $BazelFlags
|
||||
wrapped_make -j "${NUM_MAKE_JOBS}"
|
||||
else
|
||||
header "Building"
|
||||
# Can't issue these together, when fully parallel, something sometimes chokes
|
||||
# at random.
|
||||
"${BazelBin}" test //src/... $BazelFlags
|
||||
wrapped_make -j "${NUM_MAKE_JOBS}" all
|
||||
wrapped_make -j "${NUM_MAKE_JOBS}" check
|
||||
# Fire off the conformance tests also.
|
||||
"${BazelBin}" test //objectivec:conformance_test $BazelFlags
|
||||
cd conformance
|
||||
wrapped_make -j "${NUM_MAKE_JOBS}" test_cpp
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# Ensure the WKT sources checked in are current.
|
||||
BAZEL="${BazelBin}" objectivec/generate_well_known_types.sh --check-only $BazelFlags
|
||||
objectivec/generate_well_known_types.sh --check-only -j "${NUM_MAKE_JOBS}"
|
||||
|
||||
header "Checking on the ObjC Runtime Code"
|
||||
# Some of the kokoro machines don't have python3 yet, so fall back to python if need be.
|
||||
@@ -225,11 +264,38 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
|
||||
# just pick a mix of OS Versions and 32/64 bit.
|
||||
# NOTE: Different Xcode have different simulated hardware/os support.
|
||||
case "${XCODE_VERSION}" in
|
||||
[6-9].* | 1[0-2].* )
|
||||
echo "ERROR: Xcode 13.3.1 or higher is required." 1>&2
|
||||
[6-8].* )
|
||||
echo "ERROR: The unittests include Swift code that is now Swift 4.0." 1>&2
|
||||
echo "ERROR: Xcode 9.0 or higher is required to build the test suite, but the library works with Xcode 7.x." 1>&2
|
||||
exit 11
|
||||
;;
|
||||
13.* | 14.*)
|
||||
9.[0-2]* )
|
||||
XCODEBUILD_TEST_BASE_IOS+=(
|
||||
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
|
||||
-destination "platform=iOS Simulator,name=iPhone 7,OS=latest" # 64bit
|
||||
# 9.0-9.2 all seem to often fail running destinations in parallel
|
||||
-disable-concurrent-testing
|
||||
)
|
||||
;;
|
||||
9.[3-4]* )
|
||||
XCODEBUILD_TEST_BASE_IOS+=(
|
||||
# Xcode 9.3 chokes targeting iOS 8.x - http://www.openradar.me/39335367
|
||||
-destination "platform=iOS Simulator,name=iPhone 4s,OS=9.0" # 32bit
|
||||
-destination "platform=iOS Simulator,name=iPhone 7,OS=latest" # 64bit
|
||||
# 9.3 also seems to often fail running destinations in parallel
|
||||
-disable-concurrent-testing
|
||||
)
|
||||
;;
|
||||
10.*)
|
||||
XCODEBUILD_TEST_BASE_IOS+=(
|
||||
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
|
||||
-destination "platform=iOS Simulator,name=iPhone 7,OS=latest" # 64bit
|
||||
# 10.x also seems to often fail running destinations in parallel (with
|
||||
# 32bit one include at least)
|
||||
-disable-concurrent-destination-testing
|
||||
)
|
||||
;;
|
||||
11.* | 12.* | 13.* | 14.*)
|
||||
# Dropped 32bit as Apple doesn't seem support the simulators either.
|
||||
XCODEBUILD_TEST_BASE_IOS+=(
|
||||
-destination "platform=iOS Simulator,name=iPhone 8,OS=latest" # 64bit
|
||||
@@ -266,8 +332,9 @@ if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
|
||||
XCODEBUILD_TEST_BASE_OSX+=( -quiet )
|
||||
fi
|
||||
case "${XCODE_VERSION}" in
|
||||
[6-9].* | 1[0-2].* )
|
||||
echo "ERROR: Xcode 13.3.1 or higher is required." 1>&2
|
||||
[6-8].* )
|
||||
echo "ERROR: The unittests include Swift code that is now Swift 4.0." 1>&2
|
||||
echo "ERROR: Xcode 9.0 or higher is required to build the test suite, but the library works with Xcode 7.x." 1>&2
|
||||
exit 11
|
||||
;;
|
||||
esac
|
||||
@@ -287,10 +354,15 @@ if [[ "${DO_XCODE_TVOS_TESTS}" == "yes" ]] ; then
|
||||
-scheme ProtocolBuffers
|
||||
)
|
||||
case "${XCODE_VERSION}" in
|
||||
[6-9].* | 1[0-2].* )
|
||||
echo "ERROR: Xcode 13.3.1 or higher is required." 1>&2
|
||||
[6-9].* )
|
||||
echo "ERROR: Xcode 10.0 or higher is required to build the test suite." 1>&2
|
||||
exit 11
|
||||
;;
|
||||
10.* | 11.* | 12.*)
|
||||
XCODEBUILD_TEST_BASE_TVOS+=(
|
||||
-destination "platform=tvOS Simulator,name=Apple TV 4K,OS=latest"
|
||||
)
|
||||
;;
|
||||
13.* | 14.*)
|
||||
XCODEBUILD_TEST_BASE_TVOS+=(
|
||||
-destination "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=latest"
|
||||
@@ -319,7 +391,9 @@ fi
|
||||
|
||||
if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then
|
||||
header "Running ObjC Conformance Tests"
|
||||
"${BazelBin}" test //objectivec:conformance_test $BazelFlags
|
||||
cd conformance
|
||||
wrapped_make -j "${NUM_MAKE_JOBS}" test_objc
|
||||
cd ..
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user