Merge pull request #14326 from adelez/foundry_integration

Define the tests as grpc_cc_test to automatically test against all po…
diff --git a/Rakefile b/Rakefile
index 1eac37d..74c8b1f 100755
--- a/Rakefile
+++ b/Rakefile
@@ -99,7 +99,7 @@
     env_comp = "CC=#{opt[:cross]}-gcc "
     env_comp += "CXX=#{opt[:cross]}-g++ "
     env_comp += "LD=#{opt[:cross]}-gcc "
-    docker_for_windows "gem update --system --no-ri --no-doc && #{env} #{env_comp} make -j #{out} && #{opt[:cross]}-strip -x -S #{out} && cp #{out} #{opt[:out]}"
+    docker_for_windows "gem update --system && #{env} #{env_comp} make -j #{out} && #{opt[:cross]}-strip -x -S #{out} && cp #{out} #{opt[:out]}"
   end
 
 end
@@ -113,15 +113,10 @@
   if RUBY_PLATFORM =~ /darwin/
     FileUtils.touch 'grpc_c.32.ruby'
     FileUtils.touch 'grpc_c.64.ruby'
-    unless '2.5' == /(\d+\.\d+)/.match(RUBY_VERSION).to_s
-      fail "rake gem:native (the rake task to build the binary packages) is being " \
-        "invoked on macos with ruby #{RUBY_VERSION}. The ruby macos artifact " \
-        "build should be running on ruby 2.5."
-    end
     system "rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
   else
     Rake::Task['dlls'].execute
-    docker_for_windows "gem update --system --no-ri --no-doc && bundle && rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
+    docker_for_windows "gem update --system && bundle && rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
   end
 end
 
diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
index e465312..47d3308 100644
--- a/bazel/grpc_deps.bzl
+++ b/bazel/grpc_deps.bzl
@@ -120,10 +120,10 @@
     if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules():
         native.http_archive(
             name = "com_github_bazelbuild_bazeltoolchains",
-            strip_prefix = "bazel-toolchains-af4681c3d19f063f090222ec3d04108c4e0ca255",
+            strip_prefix = "bazel-toolchains-f3b09700fae5d7b6e659d7cefe0dcc6e8498504c",
             urls = [
-                "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/af4681c3d19f063f090222ec3d04108c4e0ca255.tar.gz",
-                "https://github.com/bazelbuild/bazel-toolchains/archive/af4681c3d19f063f090222ec3d04108c4e0ca255.tar.gz",
+                "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/f3b09700fae5d7b6e659d7cefe0dcc6e8498504c.tar.gz",
+                "https://github.com/bazelbuild/bazel-toolchains/archive/f3b09700fae5d7b6e659d7cefe0dcc6e8498504c.tar.gz",
             ],
-            sha256 = "d58bb2d6c8603f600d522b6104d6192a65339aa26cbba9f11ff5c4b36dedb928",
+            sha256 = "ed829b5eea8af1f405f4cc3d6ecfc3b1365bb7843171036030a31b5127002311",
         )
diff --git a/examples/python/interceptors/headers/generic_client_interceptor.py b/examples/python/interceptors/headers/generic_client_interceptor.py
index 30b0755..d2bb7e5 100644
--- a/examples/python/interceptors/headers/generic_client_interceptor.py
+++ b/examples/python/interceptors/headers/generic_client_interceptor.py
@@ -33,14 +33,14 @@
                                request):
         new_details, new_request_iterator, postprocess = self._fn(
             client_call_details, iter((request,)), False, True)
-        response_it = continuation(new_details, new_request_iterator)
+        response_it = continuation(new_details, next(new_request_iterator))
         return postprocess(response_it) if postprocess else response_it
 
     def intercept_stream_unary(self, continuation, client_call_details,
                                request_iterator):
         new_details, new_request_iterator, postprocess = self._fn(
             client_call_details, request_iterator, True, False)
-        response = continuation(new_details, next(new_request_iterator))
+        response = continuation(new_details, new_request_iterator)
         return postprocess(response) if postprocess else response
 
     def intercept_stream_stream(self, continuation, client_call_details,
diff --git a/src/objective-c/ProtoRPC/ProtoMethod.m b/src/objective-c/ProtoRPC/ProtoMethod.m
index 4bef10a..ed585ac 100644
--- a/src/objective-c/ProtoRPC/ProtoMethod.m
+++ b/src/objective-c/ProtoRPC/ProtoMethod.m
@@ -18,7 +18,10 @@
 
 #import "ProtoMethod.h"
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
 @implementation ProtoMethod
+#pragma clang diagnostic pop
 - (instancetype)initWithPackage:(NSString *)package
                         service:(NSString *)service
                          method:(NSString *)method {
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m
index 1ecfcc5..20b9d04 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.m
+++ b/src/objective-c/ProtoRPC/ProtoRPC.m
@@ -42,7 +42,10 @@
                          userInfo:info];
 }
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
 @implementation ProtoRPC {
+#pragma clang diagnostic pop
   id<GRXWriteable> _responseWriteable;
 }
 
diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m
index be6089f..611cee4 100644
--- a/src/objective-c/ProtoRPC/ProtoService.m
+++ b/src/objective-c/ProtoRPC/ProtoService.m
@@ -24,7 +24,10 @@
 #import "ProtoMethod.h"
 #import "ProtoRPC.h"
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
 @implementation ProtoService {
+#pragma clang diagnostic pop
   NSString *_host;
   NSString *_packageName;
   NSString *_serviceName;
diff --git a/src/objective-c/RxLibrary/GRXConcurrentWriteable.m b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m
index 37bc975..c262313 100644
--- a/src/objective-c/RxLibrary/GRXConcurrentWriteable.m
+++ b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m
@@ -64,21 +64,25 @@
 }
 
 - (void)enqueueSuccessfulCompletion {
+  __weak typeof(self) weakSelf = self;
   dispatch_async(_writeableQueue, ^{
-    BOOL finished = NO;
-    @synchronized (self) {
-      if (!_alreadyFinished) {
-        _alreadyFinished = YES;
-      } else {
-        finished = YES;
+    typeof(self) strongSelf = weakSelf;
+    if (strongSelf) {
+      BOOL finished = NO;
+      @synchronized (self) {
+        if (!strongSelf->_alreadyFinished) {
+          strongSelf->_alreadyFinished = YES;
+        } else {
+          finished = YES;
+        }
       }
-    }
-    if (!finished) {
-      // Cancellation is now impossible. None of the other three blocks can run concurrently with
-      // this one.
-      [self.writeable writesFinishedWithError:nil];
-      // Skip any possible message to the wrapped writeable enqueued after this one.
-      self.writeable = nil;
+      if (!finished) {
+        // Cancellation is now impossible. None of the other three blocks can run concurrently with
+        // this one.
+        [self.writeable writesFinishedWithError:nil];
+        // Skip any possible message to the wrapped writeable enqueued after this one.
+        self.writeable = nil;
+      }
     }
   });
 }
diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc
index 3a09701..bd8c8eb 100644
--- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc
+++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc
@@ -50,11 +50,7 @@
 set +ex  # rvm script is very verbose and exits with errorcode
 source $HOME/.rvm/scripts/rvm
 set -e  # rvm commands are very verbose
-time rvm install 2.5.0
-rvm use 2.5.0 --default
-gem install bundler --no-ri --no-doc
-gem install cocoapods --version 1.3.1 --no-ri --no-doc
-gem install rake-compiler --no-ri --no-doc
+rvm use ruby-2.4
 rvm osx-ssl-certs status all
 rvm osx-ssl-certs update all
 set -ex