From 450b648f288f9a6def073f08e3300233bb46c5dd Mon Sep 17 00:00:00 2001 From: Mike Kruskal <62662355+mkruskal-google@users.noreply.github.com> Date: Fri, 26 Aug 2022 20:06:39 -0700 Subject: [PATCH] Cherrypick ruby fixes for monterey --- benchmarks/Makefile.am | 4 +-- .../objectivec_cocoapods_integration/build.sh | 3 +++ kokoro/macos/prepare_build_macos_rc | 26 ++++++++++--------- kokoro/release/ruby/macos/build_artifacts.sh | 3 --- .../ruby/macos/ruby/ruby_build_environment.sh | 4 +++ objectivec/DevTools/full_mac_build.sh | 12 ++++++--- objectivec/Tests/CocoaPods/run_tests.sh | 2 +- tests.sh | 11 -------- 8 files changed, 33 insertions(+), 32 deletions(-) diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 2b2204d08235..9b6374e7d15f 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -91,8 +91,8 @@ $(benchmarks_protoc_outputs_proto2_header): protoc_middleman2 initialize_submodule: oldpwd=`pwd` - cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && \ - cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make + cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && cd third_party/benchmark \ + && cmake -DCMAKE_BUILD_TYPE=Release && make cd $$oldpwd touch initialize_submodule diff --git a/kokoro/macos/objectivec_cocoapods_integration/build.sh b/kokoro/macos/objectivec_cocoapods_integration/build.sh index 8f3c9b4c15d6..caf1cc87cbc5 100755 --- a/kokoro/macos/objectivec_cocoapods_integration/build.sh +++ b/kokoro/macos/objectivec_cocoapods_integration/build.sh @@ -5,6 +5,9 @@ # Change to repo root cd $(dirname $0)/../../.. +# Fix locale issues in Monterey. +export LC_ALL=en_US.UTF-8 + # Prepare worker environment to run tests KOKORO_INSTALL_COCOAPODS=yes source kokoro/macos/prepare_build_macos_rc diff --git a/kokoro/macos/prepare_build_macos_rc b/kokoro/macos/prepare_build_macos_rc index d94dd543fd5b..34b642a1adc5 100755 --- a/kokoro/macos/prepare_build_macos_rc +++ b/kokoro/macos/prepare_build_macos_rc @@ -4,14 +4,15 @@ set -eux +export HOMEBREW_PREFIX=$(brew --prefix) + ## # Select Xcode version -# Remember to update the Xcode version when Xcode_11.3.app is not available. -# If xcode is not available, it will probably encounter the failure for -# "autom4te: need GNU m4 1.4 or later: /usr/bin/m4" -# go/kokoro/userdocs/macos/selecting_xcode.md for more information. -export DEVELOPER_DIR=/Applications/Xcode_11.3.app/Contents/Developer +## +# Select Xcode version +export DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer +sudo xcode-select -s "${DEVELOPER_DIR}" ## # Select C/C++ compilers @@ -70,15 +71,16 @@ fi # Install Tox if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then - sudo python3 -m pip install --upgrade pip tox + pyenv install -v -s 3.7.13 + pyenv global 3.7.13 + sudo python -m pip install --upgrade pip tox tox-pyenv fi ## -# Install RVM - +# Setup RVM if [[ "${KOKORO_INSTALL_RVM:-}" == "yes" ]] ; then - curl -sSL https://rvm.io/mpapis.asc | gpg --import - - curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - - - curl -sSL https://get.rvm.io | bash -s master --ruby + git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-cask + git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-core + git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-services + sudo chown -R $(whoami) $HOME/.rvm/ fi diff --git a/kokoro/release/ruby/macos/build_artifacts.sh b/kokoro/release/ruby/macos/build_artifacts.sh index c68b63cc43d7..a109d45b6166 100755 --- a/kokoro/release/ruby/macos/build_artifacts.sh +++ b/kokoro/release/ruby/macos/build_artifacts.sh @@ -12,8 +12,5 @@ export ARTIFACT_DIR=$(pwd)/artifacts # ruby environment bash kokoro/release/ruby/macos/ruby/ruby_build_environment.sh -gem install rubygems-update -update_rubygems - # build artifacts bash kokoro/release/ruby/macos/ruby/ruby_build.sh diff --git a/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh b/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh index 046b604b40e1..a399049fed44 100755 --- a/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh +++ b/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh @@ -2,6 +2,10 @@ set -ex +# Fix permissions +sudo chown -R $(whoami) $HOME/.rvm/ +sudo chown -R $(whoami) /Library/Ruby/ + set +ex # rvm script is very verbose and exits with errorcode source $HOME/.rvm/scripts/rvm set -e # rvm commands are very verbose diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh index 9319b5587176..9ed5b15b2357 100755 --- a/objectivec/DevTools/full_mac_build.sh +++ b/objectivec/DevTools/full_mac_build.sh @@ -234,8 +234,9 @@ fi objectivec/generate_well_known_types.sh --check-only -j "${NUM_MAKE_JOBS}" header "Checking on the ObjC Runtime Code" -objectivec/DevTools/pddm_tests.py -if ! objectivec/DevTools/pddm.py --dry-run objectivec/*.[hm] objectivec/Tests/*.[hm] ; then +LOCAL_PYTHON=python +"${LOCAL_PYTHON}" objectivec/DevTools/pddm_tests.py +if ! "${LOCAL_PYTHON}" objectivec/DevTools/pddm.py --dry-run objectivec/*.[hm] objectivec/Tests/*.[hm] ; then echo "" echo "Update by running:" echo " objectivec/DevTools/pddm.py objectivec/*.[hm] objectivec/Tests/*.[hm]" @@ -289,7 +290,7 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then -disable-concurrent-destination-testing ) ;; - 11.* | 12.*) + 11.* | 12.* | 13.*) # 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 @@ -357,6 +358,11 @@ if [[ "${DO_XCODE_TVOS_TESTS}" == "yes" ]] ; then -destination "platform=tvOS Simulator,name=Apple TV 4K,OS=latest" ) ;; + 13.*) + XCODEBUILD_TEST_BASE_TVOS+=( + -destination "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=latest" + ) + ;; * ) echo "" echo "ATTENTION: Time to update the simulator targets for Xcode ${XCODE_VERSION}" diff --git a/objectivec/Tests/CocoaPods/run_tests.sh b/objectivec/Tests/CocoaPods/run_tests.sh index 35bcc18df7a9..4f65042bca7d 100755 --- a/objectivec/Tests/CocoaPods/run_tests.sh +++ b/objectivec/Tests/CocoaPods/run_tests.sh @@ -128,7 +128,7 @@ do_test() { # errors. xcodebuild_args+=( -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO - -destination "platform=iOS Simulator,name=iPad 2,OS=9.3" + -destination "platform=iOS Simulator,name=iPad Air (5th generation),OS=15.4" ) fi diff --git a/tests.sh b/tests.sh index 1135f95ca8c9..e124a74c5bad 100755 --- a/tests.sh +++ b/tests.sh @@ -27,17 +27,6 @@ build_cpp() { internal_build_cpp make check -j$(nproc) || (cat src/test-suite.log; false) cd conformance && make test_cpp && cd .. - - # The benchmark code depends on cmake, so test if it is installed before - # trying to do the build. - if [[ $(type cmake 2>/dev/null) ]]; then - # Verify benchmarking code can build successfully. - cd benchmarks && make cpp-benchmark && cd .. - else - echo "" - echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed." - echo "" - fi } build_cpp_tcmalloc() {