grpc 1.23.1-x86-mingw32 → 1.24.0.pre1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e81eecd71d217ca049b2b6fccdd309c88d73cfadb206ac1b5c67fb6d6cb14870
4
- data.tar.gz: 9bbb90e4a1b8a53ef98cb4bc62ee952927e88c1e0d27f7db5ebbbfb4b3c3860a
3
+ metadata.gz: 1fa0484f84313e3fba60e3f34b34559cce23ffb34747d0f6168c74665939efc2
4
+ data.tar.gz: acf44b075e307dc8b4702531e4a9ec757c2ca17e25010d5593a5ae1f9f7b0880
5
5
  SHA512:
6
- metadata.gz: ae6f899974d05d1539993de090dc191815a8c8ea6f8425c10a65eb92eac95d533801a706612815d137b5b5a084b3653f02c71fc253363ed8cd76e43b0794d5b0
7
- data.tar.gz: 5fd65889209c22edb789babdb4265dd9da6c5f6f62e1e5215d8b028d707aab10546d40aed7d600f23aaeff391cc79db41cd7a9f4150b7e1586cea84a426fd14b
6
+ metadata.gz: 6aecee2f01edee19a0560de61f401cfa4d0a0488fe45851a74854a45f6581219dc70e3ffcfdb3c17b33a5971d3b81abb28c276d2288ff4318d33f3bba60345ea
7
+ data.tar.gz: 5e2d87bdec2852386af33f484fb73f7175119800c81c38550b84d57be5c4ca92d2dabbb23f3f2d38509fbac684958810dd5d37e12f7a6153edc3e407cf1e2637
data/grpc_c.32.ruby CHANGED
Binary file
data/grpc_c.64.ruby CHANGED
Binary file
@@ -0,0 +1 @@
1
+ _Init_grpc_c
@@ -0,0 +1,6 @@
1
+ grpc_1.0 {
2
+ global:
3
+ Init_grpc_c;
4
+ local:
5
+ *;
6
+ };
@@ -60,6 +60,11 @@ unless windows
60
60
  end
61
61
 
62
62
  $CFLAGS << ' -I' + File.join(grpc_root, 'include')
63
+
64
+ ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', 'ext-export')
65
+ $LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if RUBY_PLATFORM =~ /linux/
66
+ $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if RUBY_PLATFORM =~ /darwin/
67
+
63
68
  $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows
64
69
  if grpc_config == 'gcov'
65
70
  $CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage'
@@ -0,0 +1,22 @@
1
+ /*
2
+ *
3
+ * Copyright 2019 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #include <ruby/ruby.h>
20
+
21
+ // This is a dummy C++ source file to trigger ruby extension builder to
22
+ // pick C++ rather than C linker to link with c++ library properly.
@@ -155,45 +155,6 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) {
155
155
  return t;
156
156
  }
157
157
 
158
- static void Init_grpc_status_codes() {
159
- /* Constants representing the status codes or grpc_status_code in status.h */
160
- VALUE grpc_rb_mStatusCodes =
161
- rb_define_module_under(grpc_rb_mGrpcCore, "StatusCodes");
162
- rb_define_const(grpc_rb_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK));
163
- rb_define_const(grpc_rb_mStatusCodes, "CANCELLED",
164
- INT2NUM(GRPC_STATUS_CANCELLED));
165
- rb_define_const(grpc_rb_mStatusCodes, "UNKNOWN",
166
- INT2NUM(GRPC_STATUS_UNKNOWN));
167
- rb_define_const(grpc_rb_mStatusCodes, "INVALID_ARGUMENT",
168
- INT2NUM(GRPC_STATUS_INVALID_ARGUMENT));
169
- rb_define_const(grpc_rb_mStatusCodes, "DEADLINE_EXCEEDED",
170
- INT2NUM(GRPC_STATUS_DEADLINE_EXCEEDED));
171
- rb_define_const(grpc_rb_mStatusCodes, "NOT_FOUND",
172
- INT2NUM(GRPC_STATUS_NOT_FOUND));
173
- rb_define_const(grpc_rb_mStatusCodes, "ALREADY_EXISTS",
174
- INT2NUM(GRPC_STATUS_ALREADY_EXISTS));
175
- rb_define_const(grpc_rb_mStatusCodes, "PERMISSION_DENIED",
176
- INT2NUM(GRPC_STATUS_PERMISSION_DENIED));
177
- rb_define_const(grpc_rb_mStatusCodes, "UNAUTHENTICATED",
178
- INT2NUM(GRPC_STATUS_UNAUTHENTICATED));
179
- rb_define_const(grpc_rb_mStatusCodes, "RESOURCE_EXHAUSTED",
180
- INT2NUM(GRPC_STATUS_RESOURCE_EXHAUSTED));
181
- rb_define_const(grpc_rb_mStatusCodes, "FAILED_PRECONDITION",
182
- INT2NUM(GRPC_STATUS_FAILED_PRECONDITION));
183
- rb_define_const(grpc_rb_mStatusCodes, "ABORTED",
184
- INT2NUM(GRPC_STATUS_ABORTED));
185
- rb_define_const(grpc_rb_mStatusCodes, "OUT_OF_RANGE",
186
- INT2NUM(GRPC_STATUS_OUT_OF_RANGE));
187
- rb_define_const(grpc_rb_mStatusCodes, "UNIMPLEMENTED",
188
- INT2NUM(GRPC_STATUS_UNIMPLEMENTED));
189
- rb_define_const(grpc_rb_mStatusCodes, "INTERNAL",
190
- INT2NUM(GRPC_STATUS_INTERNAL));
191
- rb_define_const(grpc_rb_mStatusCodes, "UNAVAILABLE",
192
- INT2NUM(GRPC_STATUS_UNAVAILABLE));
193
- rb_define_const(grpc_rb_mStatusCodes, "DATA_LOSS",
194
- INT2NUM(GRPC_STATUS_DATA_LOSS));
195
- }
196
-
197
158
  /* id_at is the constructor method of the ruby standard Time class. */
198
159
  static ID id_at;
199
160
 
@@ -351,8 +312,7 @@ void Init_grpc_c() {
351
312
  grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core");
352
313
  grpc_rb_sNewServerRpc = rb_struct_define(
353
314
  "NewServerRpc", "method", "host", "deadline", "metadata", "call", NULL);
354
- grpc_rb_sStatus =
355
- rb_struct_define("Status", "code", "details", "metadata", NULL);
315
+ grpc_rb_sStatus = rb_const_get(rb_cStruct, rb_intern("Status"));
356
316
  sym_code = ID2SYM(rb_intern("code"));
357
317
  sym_details = ID2SYM(rb_intern("details"));
358
318
  sym_metadata = ID2SYM(rb_intern("metadata"));
@@ -363,7 +323,6 @@ void Init_grpc_c() {
363
323
  Init_grpc_channel_credentials();
364
324
  Init_grpc_server();
365
325
  Init_grpc_server_credentials();
366
- Init_grpc_status_codes();
367
326
  Init_grpc_time_consts();
368
327
  Init_grpc_compression_options();
369
328
  }
@@ -164,6 +164,8 @@ grpc_tls_credentials_options_set_credential_reload_config_type grpc_tls_credenti
164
164
  grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls_credentials_options_set_server_authorization_check_config_import;
165
165
  grpc_tls_key_materials_config_create_type grpc_tls_key_materials_config_create_import;
166
166
  grpc_tls_key_materials_config_set_key_materials_type grpc_tls_key_materials_config_set_key_materials_import;
167
+ grpc_tls_key_materials_config_set_version_type grpc_tls_key_materials_config_set_version_import;
168
+ grpc_tls_key_materials_config_get_version_type grpc_tls_key_materials_config_get_version_import;
167
169
  grpc_tls_credential_reload_config_create_type grpc_tls_credential_reload_config_create_import;
168
170
  grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import;
169
171
  grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
@@ -435,6 +437,8 @@ void grpc_rb_load_imports(HMODULE library) {
435
437
  grpc_tls_credentials_options_set_server_authorization_check_config_import = (grpc_tls_credentials_options_set_server_authorization_check_config_type) GetProcAddress(library, "grpc_tls_credentials_options_set_server_authorization_check_config");
436
438
  grpc_tls_key_materials_config_create_import = (grpc_tls_key_materials_config_create_type) GetProcAddress(library, "grpc_tls_key_materials_config_create");
437
439
  grpc_tls_key_materials_config_set_key_materials_import = (grpc_tls_key_materials_config_set_key_materials_type) GetProcAddress(library, "grpc_tls_key_materials_config_set_key_materials");
440
+ grpc_tls_key_materials_config_set_version_import = (grpc_tls_key_materials_config_set_version_type) GetProcAddress(library, "grpc_tls_key_materials_config_set_version");
441
+ grpc_tls_key_materials_config_get_version_import = (grpc_tls_key_materials_config_get_version_type) GetProcAddress(library, "grpc_tls_key_materials_config_get_version");
438
442
  grpc_tls_credential_reload_config_create_import = (grpc_tls_credential_reload_config_create_type) GetProcAddress(library, "grpc_tls_credential_reload_config_create");
439
443
  grpc_tls_server_authorization_check_config_create_import = (grpc_tls_server_authorization_check_config_create_type) GetProcAddress(library, "grpc_tls_server_authorization_check_config_create");
440
444
  grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
@@ -467,6 +467,12 @@ extern grpc_tls_key_materials_config_create_type grpc_tls_key_materials_config_c
467
467
  typedef int(*grpc_tls_key_materials_config_set_key_materials_type)(grpc_tls_key_materials_config* config, const char* pem_root_certs, const grpc_ssl_pem_key_cert_pair** pem_key_cert_pairs, size_t num_key_cert_pairs);
468
468
  extern grpc_tls_key_materials_config_set_key_materials_type grpc_tls_key_materials_config_set_key_materials_import;
469
469
  #define grpc_tls_key_materials_config_set_key_materials grpc_tls_key_materials_config_set_key_materials_import
470
+ typedef int(*grpc_tls_key_materials_config_set_version_type)(grpc_tls_key_materials_config* config, int version);
471
+ extern grpc_tls_key_materials_config_set_version_type grpc_tls_key_materials_config_set_version_import;
472
+ #define grpc_tls_key_materials_config_set_version grpc_tls_key_materials_config_set_version_import
473
+ typedef int(*grpc_tls_key_materials_config_get_version_type)(grpc_tls_key_materials_config* config);
474
+ extern grpc_tls_key_materials_config_get_version_type grpc_tls_key_materials_config_get_version_import;
475
+ #define grpc_tls_key_materials_config_get_version grpc_tls_key_materials_config_get_version_import
470
476
  typedef grpc_tls_credential_reload_config*(*grpc_tls_credential_reload_config_create_type)(const void* config_user_data, int (*schedule)(void* config_user_data, grpc_tls_credential_reload_arg* arg), void (*cancel)(void* config_user_data, grpc_tls_credential_reload_arg* arg), void (*destruct)(void* config_user_data));
471
477
  extern grpc_tls_credential_reload_config_create_type grpc_tls_credential_reload_config_create_import;
472
478
  #define grpc_tls_credential_reload_config_create grpc_tls_credential_reload_config_create_import
data/src/ruby/lib/grpc.rb CHANGED
@@ -15,10 +15,12 @@
15
15
  ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)
16
16
 
17
17
  require_relative 'grpc/errors'
18
+ require_relative 'grpc/structs'
18
19
  require_relative 'grpc/grpc'
19
20
  require_relative 'grpc/logconfig'
20
21
  require_relative 'grpc/notifier'
21
22
  require_relative 'grpc/version'
23
+ require_relative 'grpc/core/status_codes'
22
24
  require_relative 'grpc/core/time_consts'
23
25
  require_relative 'grpc/generic/active_call'
24
26
  require_relative 'grpc/generic/client_stub'
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,135 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # GRPC contains the General RPC module.
16
+ module GRPC
17
+ module Core
18
+ # StatusCodes defines the canonical error codes used by gRPC for the RPC
19
+ # API.
20
+ module StatusCodes
21
+ # OK is returned on success.
22
+ OK = 0
23
+
24
+ # Canceled indicates the operation was canceled (typically by the caller).
25
+ CANCELLED = 1
26
+
27
+ # Unknown error. An example of where this error may be returned is if a
28
+ # Status value received from another address space belongs to an
29
+ # error-space that is not known in this address space. Also errors raised
30
+ # by APIs that do not return enough error information may be converted to
31
+ # this error.
32
+ UNKNOWN = 2
33
+
34
+ # InvalidArgument indicates client specified an invalid argument. Note
35
+ # that this differs from FailedPrecondition. It indicates arguments that
36
+ # are problematic regardless of the state of the system (e.g., a malformed
37
+ # file name).
38
+ INVALID_ARGUMENT = 3
39
+
40
+ # DeadlineExceeded means operation expired before completion. For
41
+ # operations that change the state of the system, this error may be
42
+ # returned even if the operation has completed successfully. For example,
43
+ # a successful response from a server could have been delayed long enough
44
+ # for the deadline to expire.
45
+ DEADLINE_EXCEEDED = 4
46
+
47
+ # NotFound means some requested entity (e.g., file or directory) was not
48
+ # found.
49
+ NOT_FOUND = 5
50
+
51
+ # AlreadyExists means an attempt to create an entity failed because one
52
+ # already exists.
53
+ ALREADY_EXISTS = 6
54
+
55
+ # PermissionDenied indicates the caller does not have permission to
56
+ # execute the specified operation. It must not be used for rejections
57
+ # caused by exhausting some resource (use ResourceExhausted instead for
58
+ # those errors). It must not be used if the caller cannot be identified
59
+ # (use Unauthenticated instead for those errors).
60
+ PERMISSION_DENIED = 7
61
+
62
+ # ResourceExhausted indicates some resource has been exhausted, perhaps a
63
+ # per-user quota, or perhaps the entire file system is out of space.
64
+ RESOURCE_EXHAUSTED = 8
65
+
66
+ # FailedPrecondition indicates operation was rejected because the system
67
+ # is not in a state required for the operation's execution. For example,
68
+ # directory to be deleted may be non-empty, an rmdir operation is applied
69
+ # to a non-directory, etc.
70
+ #
71
+ # A litmus test that may help a service implementor in deciding between
72
+ # FailedPrecondition, Aborted, and Unavailable:
73
+ # (a) Use Unavailable if the client can retry just the failing call.
74
+ # (b) Use Aborted if the client should retry at a higher-level (e.g.,
75
+ # restarting a read-modify-write sequence).
76
+ # (c) Use FailedPrecondition if the client should not retry until the
77
+ # system state has been explicitly fixed. E.g., if an "rmdir" fails
78
+ # because the directory is non-empty, FailedPrecondition should be
79
+ # returned since the client should not retry unless they have first
80
+ # fixed up the directory by deleting files from it.
81
+ # (d) Use FailedPrecondition if the client performs conditional REST
82
+ # Get/Update/Delete on a resource and the resource on the server does
83
+ # not match the condition. E.g., conflicting read-modify-write on the
84
+ # same resource.
85
+ FAILED_PRECONDITION = 9
86
+
87
+ # Aborted indicates the operation was aborted, typically due to a
88
+ # concurrency issue like sequencer check failures, transaction aborts,
89
+ # etc.
90
+ #
91
+ # See litmus test above for deciding between FailedPrecondition, Aborted,
92
+ # and Unavailable.
93
+ ABORTED = 10
94
+
95
+ # OutOfRange means operation was attempted past the valid range. E.g.,
96
+ # seeking or reading past end of file.
97
+ #
98
+ # Unlike InvalidArgument, this error indicates a problem that may be fixed
99
+ # if the system state changes. For example, a 32-bit file system will
100
+ # generate InvalidArgument if asked to read at an offset that is not in
101
+ # the range [0,2^32-1], but it will generate OutOfRange if asked to read
102
+ # from an offset past the current file size.
103
+ #
104
+ # There is a fair bit of overlap between FailedPrecondition and
105
+ # OutOfRange. We recommend using OutOfRange (the more specific error) when
106
+ # it applies so that callers who are iterating through a space can easily
107
+ # look for an OutOfRange error to detect when they are done.
108
+ OUT_OF_RANGE = 11
109
+
110
+ # Unimplemented indicates operation is not implemented or not
111
+ # supported/enabled in this service.
112
+ UNIMPLEMENTED = 12
113
+
114
+ # Internal errors. Means some invariants expected by underlying system has
115
+ # been broken. If you see one of these errors, something is very broken.
116
+ INTERNAL = 13
117
+
118
+ # Unavailable indicates the service is currently unavailable. This is a
119
+ # most likely a transient condition and may be corrected by retrying with
120
+ # a backoff. Note that it is not always safe to retry non-idempotent
121
+ # operations.
122
+ #
123
+ # See litmus test above for deciding between FailedPrecondition, Aborted,
124
+ # and Unavailable.
125
+ UNAVAILABLE = 14
126
+
127
+ # DataLoss indicates unrecoverable data loss or corruption.
128
+ DATA_LOSS = 15
129
+
130
+ # Unauthenticated indicates the request does not have valid authentication
131
+ # credentials for the operation.
132
+ UNAUTHENTICATED = 16
133
+ end
134
+ end
135
+ end
@@ -12,7 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require_relative './grpc'
15
+ require_relative './structs'
16
+ require_relative './core/status_codes'
17
+ require_relative './google_rpc_status_utils'
16
18
 
17
19
  # GRPC contains the General RPC module.
18
20
  module GRPC
@@ -57,12 +59,7 @@ module GRPC
57
59
  #
58
60
  # @return [Google::Rpc::Status, nil]
59
61
  def to_rpc_status
60
- # Lazily require google_rpc_status_utils to scope
61
- # loading protobuf_c.so to the users of this method.
62
- require_relative './google_rpc_status_utils'
63
- status = to_status
64
- return if status.nil?
65
- GoogleRpcStatusUtils.extract_google_rpc_status(status)
62
+ GoogleRpcStatusUtils.extract_google_rpc_status(to_status)
66
63
  rescue Google::Protobuf::ParseError => parse_error
67
64
  GRPC.logger.warn('parse error: to_rpc_status failed')
68
65
  GRPC.logger.warn(parse_error)
@@ -12,8 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require_relative './grpc'
16
- require 'google/rpc/status_pb'
15
+ require_relative './structs'
17
16
 
18
17
  # GRPC contains the General RPC module.
19
18
  module GRPC
@@ -28,8 +27,14 @@ module GRPC
28
27
  def self.extract_google_rpc_status(status)
29
28
  fail ArgumentError, 'bad type' unless status.is_a? Struct::Status
30
29
  grpc_status_details_bin_trailer = 'grpc-status-details-bin'
31
- return nil if status.metadata[grpc_status_details_bin_trailer].nil?
32
- Google::Rpc::Status.decode(status.metadata[grpc_status_details_bin_trailer])
30
+ binstatus = status.metadata[grpc_status_details_bin_trailer]
31
+ return nil if binstatus.nil?
32
+
33
+ # Lazily load grpc_c and protobuf_c.so for users of this method.
34
+ require_relative './grpc'
35
+ require 'google/rpc/status_pb'
36
+
37
+ Google::Rpc::Status.decode(binstatus)
33
38
  end
34
39
  end
35
40
  end
@@ -0,0 +1,15 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ Struct.new('Status', :code, :details, :metadata)
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.23.1'
17
+ VERSION = '1.24.0.pre1'
18
18
  end
@@ -14,6 +14,7 @@
14
14
 
15
15
  require 'spec_helper'
16
16
  require 'google/protobuf/well_known_types'
17
+ require 'google/rpc/status_pb'
17
18
  require_relative '../pb/src/proto/grpc/testing/messages_pb'
18
19
 
19
20
  describe GRPC::BadStatus do
@@ -0,0 +1,22 @@
1
+ // Copyright 2019 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package grpc.testing;
18
+
19
+ // For sanity checking package definitions
20
+ option ruby_package = "A::Other";
21
+
22
+ message Thing { }
@@ -0,0 +1,34 @@
1
+ // Copyright 2019 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package grpc.testing;
18
+
19
+ import "grpc/testing/package_options_import.proto";
20
+
21
+ // For sanity checking package definitions
22
+ option ruby_package = "RPC::Test::New::Package::Options";
23
+
24
+ message AnotherTestRequest { }
25
+
26
+ message AnotherTestResponse { }
27
+
28
+ message Foo { }
29
+
30
+ service AnotherTestService {
31
+ rpc GetTest(AnotherTestRequest) returns (AnotherTestResponse) { }
32
+ rpc OtherTest(Thing) returns (Thing) { }
33
+ rpc FooTest(Foo) returns (Foo) { }
34
+ }
@@ -18,35 +18,59 @@ require 'tmpdir'
18
18
 
19
19
  describe 'Code Generation Options' do
20
20
  it 'should generate and respect package options' do
21
- fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG']
22
- bins_sub_dir = ENV['CONFIG']
23
-
24
- pb_dir = File.dirname(__FILE__)
25
- bins_dir = File.join('..', '..', '..', '..', '..', 'bins', bins_sub_dir)
26
-
27
- plugin = File.join(bins_dir, 'grpc_ruby_plugin')
28
- protoc = File.join(bins_dir, 'protobuf', 'protoc')
29
-
30
- # Generate the service from the proto
31
- Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir|
32
- gen_file = system(protoc,
33
- '-I.',
34
- 'grpc/testing/package_options.proto',
35
- "--grpc_out=#{tmp_dir}", # generate the service
36
- "--ruby_out=#{tmp_dir}", # generate the definitions
37
- "--plugin=protoc-gen-grpc=#{plugin}",
38
- chdir: pb_dir,
39
- out: File::NULL)
40
-
41
- expect(gen_file).to be_truthy
42
- begin
43
- $LOAD_PATH.push(tmp_dir)
44
- expect { Grpc::Testing::Package::Options::TestService::Service }.to raise_error(NameError)
45
- expect(require('grpc/testing/package_options_services_pb')).to be_truthy
46
- expect { Grpc::Testing::Package::Options::TestService::Service }.to_not raise_error
47
- ensure
48
- $LOAD_PATH.delete(tmp_dir)
49
- end
21
+ with_protos(%w[grpc/testing/package_options.proto]) do
22
+ expect { Grpc::Testing::Package::Options::TestService::Service }.to raise_error(NameError)
23
+ expect(require('grpc/testing/package_options_services_pb')).to be_truthy
24
+ expect { Grpc::Testing::Package::Options::TestService::Service }.to_not raise_error
25
+ expect { Grpc::Testing::TestService::Service }.to raise_error(NameError)
26
+ end
27
+ end
28
+
29
+ it 'should generate and respect Ruby style package options' do
30
+ with_protos(%w[grpc/testing/package_options_ruby_style.proto grpc/testing/package_options_import.proto]) do
31
+ expect { RPC::Test::New::Package::Options::AnotherTestService::Service }.to raise_error(NameError)
32
+ expect(require('grpc/testing/package_options_ruby_style_services_pb')).to be_truthy
33
+ expect { RPC::Test::New::Package::Options::AnotherTestService::Service }.to_not raise_error
34
+ expect { Grpc::Testing::AnotherTestService::Service }.to raise_error(NameError)
35
+
36
+ services = RPC::Test::New::Package::Options::AnotherTestService::Service.rpc_descs
37
+ expect(services[:GetTest].input).to eq(RPC::Test::New::Package::Options::AnotherTestRequest)
38
+ expect(services[:GetTest].output).to eq(RPC::Test::New::Package::Options::AnotherTestResponse)
39
+ expect(services[:OtherTest].input).to eq(A::Other::Thing)
40
+ expect(services[:OtherTest].output).to eq(A::Other::Thing)
41
+ expect(services[:FooTest].input).to eq(RPC::Test::New::Package::Options::Foo)
42
+ expect(services[:FooTest].output).to eq(RPC::Test::New::Package::Options::Foo)
43
+ end
44
+ end
45
+ end
46
+
47
+ def with_protos(file_paths)
48
+ fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG']
49
+ bins_sub_dir = ENV['CONFIG']
50
+
51
+ pb_dir = File.dirname(__FILE__)
52
+ bins_dir = File.join('..', '..', '..', '..', '..', 'bins', bins_sub_dir)
53
+
54
+ plugin = File.join(bins_dir, 'grpc_ruby_plugin')
55
+ protoc = File.join(bins_dir, 'protobuf', 'protoc')
56
+
57
+ # Generate the service from the proto
58
+ Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir|
59
+ gen_file = system(protoc,
60
+ '-I.',
61
+ *file_paths,
62
+ "--grpc_out=#{tmp_dir}", # generate the service
63
+ "--ruby_out=#{tmp_dir}", # generate the definitions
64
+ "--plugin=protoc-gen-grpc=#{plugin}",
65
+ chdir: pb_dir,
66
+ out: File::NULL)
67
+
68
+ expect(gen_file).to be_truthy
69
+ begin
70
+ $LOAD_PATH.push(tmp_dir)
71
+ yield
72
+ ensure
73
+ $LOAD_PATH.delete(tmp_dir)
50
74
  end
51
75
  end
52
76
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.1
4
+ version: 1.24.0.pre1
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2019-09-27 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -213,6 +213,8 @@ files:
213
213
  - src/ruby/bin/math_services_pb.rb
214
214
  - src/ruby/bin/noproto_client.rb
215
215
  - src/ruby/bin/noproto_server.rb
216
+ - src/ruby/ext/grpc/ext-export.clang
217
+ - src/ruby/ext/grpc/ext-export.gcc
216
218
  - src/ruby/ext/grpc/extconf.rb
217
219
  - src/ruby/ext/grpc/rb_byte_buffer.c
218
220
  - src/ruby/ext/grpc/rb_byte_buffer.h
@@ -230,6 +232,7 @@ files:
230
232
  - src/ruby/ext/grpc/rb_completion_queue.h
231
233
  - src/ruby/ext/grpc/rb_compression_options.c
232
234
  - src/ruby/ext/grpc/rb_compression_options.h
235
+ - src/ruby/ext/grpc/rb_enable_cpp.cc
233
236
  - src/ruby/ext/grpc/rb_event_thread.c
234
237
  - src/ruby/ext/grpc/rb_event_thread.h
235
238
  - src/ruby/ext/grpc/rb_grpc.c
@@ -247,6 +250,7 @@ files:
247
250
  - src/ruby/lib/grpc/2.4/grpc_c.so
248
251
  - src/ruby/lib/grpc/2.5/grpc_c.so
249
252
  - src/ruby/lib/grpc/2.6/grpc_c.so
253
+ - src/ruby/lib/grpc/core/status_codes.rb
250
254
  - src/ruby/lib/grpc/core/time_consts.rb
251
255
  - src/ruby/lib/grpc/errors.rb
252
256
  - src/ruby/lib/grpc/generic/active_call.rb
@@ -261,6 +265,7 @@ files:
261
265
  - src/ruby/lib/grpc/grpc.rb
262
266
  - src/ruby/lib/grpc/logconfig.rb
263
267
  - src/ruby/lib/grpc/notifier.rb
268
+ - src/ruby/lib/grpc/structs.rb
264
269
  - src/ruby/lib/grpc/version.rb
265
270
  - src/ruby/pb/README.md
266
271
  - src/ruby/pb/generate_proto_ruby.sh
@@ -297,6 +302,8 @@ files:
297
302
  - src/ruby/spec/generic/service_spec.rb
298
303
  - src/ruby/spec/google_rpc_status_utils_spec.rb
299
304
  - src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
305
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
306
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
300
307
  - src/ruby/spec/pb/codegen/package_option_spec.rb
301
308
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
302
309
  - src/ruby/spec/pb/health/checker_spec.rb
@@ -332,48 +339,50 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
339
  version: 2.7.dev
333
340
  required_rubygems_version: !ruby/object:Gem::Requirement
334
341
  requirements:
335
- - - ">="
342
+ - - ">"
336
343
  - !ruby/object:Gem::Version
337
- version: '0'
344
+ version: 1.3.1
338
345
  requirements: []
339
346
  rubygems_version: 3.0.6
340
347
  signing_key:
341
348
  specification_version: 4
342
349
  summary: GRPC system in Ruby
343
350
  test_files:
351
+ - src/ruby/spec/call_credentials_spec.rb
352
+ - src/ruby/spec/channel_credentials_spec.rb
353
+ - src/ruby/spec/client_auth_spec.rb
354
+ - src/ruby/spec/errors_spec.rb
344
355
  - src/ruby/spec/client_server_spec.rb
345
- - src/ruby/spec/server_credentials_spec.rb
346
- - src/ruby/spec/generic/rpc_desc_spec.rb
347
- - src/ruby/spec/generic/client_stub_spec.rb
348
- - src/ruby/spec/generic/active_call_spec.rb
349
- - src/ruby/spec/generic/interceptor_registry_spec.rb
356
+ - src/ruby/spec/server_spec.rb
357
+ - src/ruby/spec/compression_options_spec.rb
358
+ - src/ruby/spec/time_consts_spec.rb
359
+ - src/ruby/spec/channel_connection_spec.rb
360
+ - src/ruby/spec/spec_helper.rb
361
+ - src/ruby/spec/error_sanity_spec.rb
350
362
  - src/ruby/spec/generic/rpc_server_pool_spec.rb
351
- - src/ruby/spec/generic/rpc_server_spec.rb
352
- - src/ruby/spec/generic/server_interceptors_spec.rb
353
363
  - src/ruby/spec/generic/client_interceptors_spec.rb
364
+ - src/ruby/spec/generic/rpc_server_spec.rb
365
+ - src/ruby/spec/generic/client_stub_spec.rb
366
+ - src/ruby/spec/generic/interceptor_registry_spec.rb
354
367
  - src/ruby/spec/generic/service_spec.rb
355
- - src/ruby/spec/google_rpc_status_utils_spec.rb
356
- - src/ruby/spec/client_auth_spec.rb
357
- - src/ruby/spec/call_credentials_spec.rb
368
+ - src/ruby/spec/generic/server_interceptors_spec.rb
369
+ - src/ruby/spec/generic/rpc_desc_spec.rb
370
+ - src/ruby/spec/generic/active_call_spec.rb
371
+ - src/ruby/spec/support/helpers.rb
372
+ - src/ruby/spec/support/services.rb
373
+ - src/ruby/spec/channel_spec.rb
358
374
  - src/ruby/spec/pb/health/checker_spec.rb
359
375
  - src/ruby/spec/pb/codegen/package_option_spec.rb
360
376
  - src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
377
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
378
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
361
379
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
362
- - src/ruby/spec/server_spec.rb
363
- - src/ruby/spec/channel_connection_spec.rb
364
- - src/ruby/spec/time_consts_spec.rb
365
- - src/ruby/spec/errors_spec.rb
366
- - src/ruby/spec/spec_helper.rb
367
- - src/ruby/spec/support/helpers.rb
368
- - src/ruby/spec/support/services.rb
369
- - src/ruby/spec/error_sanity_spec.rb
370
- - src/ruby/spec/testdata/client.key
371
- - src/ruby/spec/testdata/README
372
- - src/ruby/spec/testdata/server1.key
380
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
381
+ - src/ruby/spec/call_spec.rb
373
382
  - src/ruby/spec/testdata/client.pem
374
- - src/ruby/spec/testdata/server1.pem
383
+ - src/ruby/spec/testdata/README
375
384
  - src/ruby/spec/testdata/ca.pem
376
- - src/ruby/spec/compression_options_spec.rb
377
- - src/ruby/spec/call_spec.rb
378
- - src/ruby/spec/channel_credentials_spec.rb
379
- - src/ruby/spec/channel_spec.rb
385
+ - src/ruby/spec/testdata/server1.pem
386
+ - src/ruby/spec/testdata/client.key
387
+ - src/ruby/spec/testdata/server1.key
388
+ - src/ruby/spec/server_credentials_spec.rb