diff options
-rw-r--r-- | doc/PROTOCOL-HTTP2.md | 2 | ||||
-rw-r--r-- | src/compiler/php_generator.cc | 14 | ||||
-rw-r--r-- | src/core/lib/gpr/cpu_posix.cc | 2 | ||||
-rw-r--r-- | src/core/lib/gprpp/memory.h | 6 | ||||
-rw-r--r-- | src/csharp/experimental/README.md | 16 | ||||
-rwxr-xr-x | src/csharp/experimental/build_native_ext_for_android.sh | 37 | ||||
-rw-r--r-- | test/core/client_channel/resolvers/fake_resolver_test.cc | 5 | ||||
-rw-r--r-- | test/cpp/util/grpc_tool.cc | 2 | ||||
-rw-r--r-- | tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile | 12 | ||||
-rw-r--r-- | tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile | 12 |
10 files changed, 74 insertions, 34 deletions
diff --git a/doc/PROTOCOL-HTTP2.md b/doc/PROTOCOL-HTTP2.md index 107a8e8824..bdd00ca363 100644 --- a/doc/PROTOCOL-HTTP2.md +++ b/doc/PROTOCOL-HTTP2.md @@ -191,7 +191,7 @@ grpc-java-android/0.9.1 (gingerbread/1.2.4; nexus5; tmobile) Unless explicitly defined to be, gRPC Calls are not assumed to be idempotent. Specifically: * Calls that cannot be proven to have started will not be retried. -* There is no mechanisim for duplicate suppression as it is not necessary. +* There is no mechanism for duplicate suppression as it is not necessary. * Calls that are marked as idempotent may be sent multiple times. diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc index d9705e8077..ca084cccbd 100644 --- a/src/compiler/php_generator.cc +++ b/src/compiler/php_generator.cc @@ -18,10 +18,12 @@ #include <map> +#include <google/protobuf/compiler/php/php_generator.h> #include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" #include "src/compiler/php_generator_helpers.h" +using google::protobuf::compiler::php::GeneratedClassName; using grpc::protobuf::Descriptor; using grpc::protobuf::FileDescriptor; using grpc::protobuf::MethodDescriptor; @@ -55,8 +57,10 @@ grpc::string MessageIdentifierName(const grpc::string& name, const FileDescriptor* file) { std::vector<grpc::string> tokens = grpc_generator::tokenize(name, "."); std::ostringstream oss; - oss << PackageName(file) << "\\" - << grpc_generator::CapitalizeFirstLetter(tokens[tokens.size() - 1]); + if (PackageName(file) != "") { + oss << PackageName(file) << "\\"; + } + oss << grpc_generator::CapitalizeFirstLetter(tokens[tokens.size() - 1]); return oss.str(); } @@ -67,9 +71,9 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) { vars["service_name"] = method->service()->full_name(); vars["name"] = method->name(); vars["input_type_id"] = - MessageIdentifierName(input_type->full_name(), input_type->file()); - vars["output_type_id"] = - MessageIdentifierName(output_type->full_name(), output_type->file()); + MessageIdentifierName(GeneratedClassName(input_type), input_type->file()); + vars["output_type_id"] = MessageIdentifierName( + GeneratedClassName(output_type), output_type->file()); out->Print("/**\n"); out->Print(GetPHPComments(method, " *").c_str()); diff --git a/src/core/lib/gpr/cpu_posix.cc b/src/core/lib/gpr/cpu_posix.cc index 7a77f7ab64..915fd4976c 100644 --- a/src/core/lib/gpr/cpu_posix.cc +++ b/src/core/lib/gpr/cpu_posix.cc @@ -37,7 +37,7 @@ static long ncpus = 0; static pthread_key_t thread_id_key; static void init_ncpus() { - ncpus = sysconf(_SC_NPROCESSORS_ONLN); + ncpus = sysconf(_SC_NPROCESSORS_CONF); if (ncpus < 1 || ncpus > INT32_MAX) { gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1"); ncpus = 1; diff --git a/src/core/lib/gprpp/memory.h b/src/core/lib/gprpp/memory.h index f84e20eeea..ba2f546675 100644 --- a/src/core/lib/gprpp/memory.h +++ b/src/core/lib/gprpp/memory.h @@ -30,12 +30,12 @@ namespace grpc_core { // The alignment of memory returned by gpr_malloc(). -constexpr size_t kAllignmentForDefaultAllocationInBytes = 8; +constexpr size_t kAlignmentForDefaultAllocationInBytes = 8; // Alternative to new, since we cannot use it (for fear of libstdc++) template <typename T, typename... Args> inline T* New(Args&&... args) { - void* p = alignof(T) > kAllignmentForDefaultAllocationInBytes + void* p = alignof(T) > kAlignmentForDefaultAllocationInBytes ? gpr_malloc_aligned(sizeof(T), alignof(T)) : gpr_malloc(sizeof(T)); return new (p) T(std::forward<Args>(args)...); @@ -45,7 +45,7 @@ inline T* New(Args&&... args) { template <typename T> inline void Delete(T* p) { p->~T(); - if (alignof(T) > kAllignmentForDefaultAllocationInBytes) { + if (alignof(T) > kAlignmentForDefaultAllocationInBytes) { gpr_free_aligned(p); } else { gpr_free(p); diff --git a/src/csharp/experimental/README.md b/src/csharp/experimental/README.md new file mode 100644 index 0000000000..f892a2ee95 --- /dev/null +++ b/src/csharp/experimental/README.md @@ -0,0 +1,16 @@ +This directory contains useful resources for getting gRPC C# to work on +not-yet-supported platforms. + +# Unity & Xamarin +gRPC C# currently doesn't support Unity or Xamarin, but some proof-of-concept +work has been done. Some of the resources are shared in this directory to +ease community work on Unity & Xamarin support. + +## Crosscompiling `grpc_csharp_ext` for Android + +* Install [Android NDK](https://developer.android.com/ndk/index.html) +* Run `./build_native_ext_for_android.sh` to crosscompile using cmake. + +## Crosscompiling `grpc_csharp_ext` for iOS + +TBD diff --git a/src/csharp/experimental/build_native_ext_for_android.sh b/src/csharp/experimental/build_native_ext_for_android.sh new file mode 100755 index 0000000000..3063d78efa --- /dev/null +++ b/src/csharp/experimental/build_native_ext_for_android.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Helper script to crosscompile grpc_csharp_ext native extension for Android. + +cd "$(dirname "$0")/../../../cmake" + +mkdir -p build +cd build + +# set to the location where Android SDK is installed +ANDROID_NDK_PATH="$HOME/android-ndk-r16b" + +cmake ../.. \ + -DCMAKE_SYSTEM_NAME=Android \ + -DCMAKE_SYSTEM_VERSION=15 \ + -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \ + -DCMAKE_ANDROID_NDK="${ANDROID_NDK_PATH}" \ + -DCMAKE_ANDROID_STL_TYPE=c++_static \ + -DRUN_HAVE_POSIX_REGEX=0 \ + -DRUN_HAVE_STD_REGEX=0 \ + -DRUN_HAVE_STEADY_CLOCK=0 \ + -DCMAKE_BUILD_TYPE=Release + +make grpc_csharp_ext diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index 03af8954e1..14caa3ea5d 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -234,6 +234,11 @@ static void test_fake_resolver() { grpc_timeout_milliseconds_to_deadline(100)) == nullptr); // Clean up. + // Note: Need to explicitly unref the resolver and flush the exec_ctx + // to make sure that the final resolver callback (with error set to + // "Resolver Shutdown") is invoked before on_res_arg goes out of scope. + resolver.reset(); + grpc_core::ExecCtx::Get()->Flush(); GRPC_COMBINER_UNREF(combiner, "test_fake_resolver"); } diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index 30c43b206f..e9dd7512c4 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -747,6 +747,8 @@ bool GrpcTool::CallMethod(int argc, const char** argv, } } Status status = call.Finish(&server_trailing_metadata); + PrintMetadata(server_trailing_metadata, + "Received trailing metadata from server:"); if (status.ok()) { fprintf(stderr, "Rpc succeeded with OK status\n"); return true; diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile index 6f61e17b4a..07604c7c42 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile @@ -18,19 +18,7 @@ FROM quay.io/pypa/manylinux1_x86_64 # Update the package manager RUN yum update -y - -############################################################# -# Update Git to allow cloning submodules with --reference arg -RUN yum remove -y git RUN yum install -y curl-devel expat-devel gettext-devel linux-headers openssl-devel zlib-devel gcc -RUN cd /usr/src && \ - curl -O -L https://kernel.org/pub/software/scm/git/git-2.0.5.tar.gz && \ - tar xzf git-2.0.5.tar.gz -RUN cd /usr/src/git-2.0.5 && \ - make prefix=/usr/local/git all && \ - make prefix=/usr/local/git install -ENV PATH /usr/local/git/bin:$PATH -RUN source /etc/bashrc ################################### # Install Python build requirements diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile index 5c3c35188f..96ab515efe 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile @@ -18,19 +18,7 @@ FROM quay.io/pypa/manylinux1_i686 # Update the package manager RUN yum update -y - -############################################################# -# Update Git to allow cloning submodules with --reference arg -RUN yum remove -y git RUN yum install -y curl-devel expat-devel gettext-devel linux-headers openssl-devel zlib-devel gcc -RUN cd /usr/src && \ - curl -O -L https://kernel.org/pub/software/scm/git/git-2.0.5.tar.gz && \ - tar xzf git-2.0.5.tar.gz -RUN cd /usr/src/git-2.0.5 && \ - make prefix=/usr/local/git all && \ - make prefix=/usr/local/git install -ENV PATH /usr/local/git/bin:$PATH -RUN source /etc/bashrc ################################### # Install Python build requirements |