grpc 1.42.0.pre1-x86_64-darwin

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.

Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/etc/roots.pem +4337 -0
  3. data/grpc_c.32.ruby +0 -0
  4. data/grpc_c.64.ruby +0 -0
  5. data/src/ruby/bin/math_client.rb +140 -0
  6. data/src/ruby/bin/math_pb.rb +34 -0
  7. data/src/ruby/bin/math_server.rb +191 -0
  8. data/src/ruby/bin/math_services_pb.rb +51 -0
  9. data/src/ruby/bin/noproto_client.rb +93 -0
  10. data/src/ruby/bin/noproto_server.rb +97 -0
  11. data/src/ruby/ext/grpc/ext-export.clang +1 -0
  12. data/src/ruby/ext/grpc/ext-export.gcc +6 -0
  13. data/src/ruby/ext/grpc/extconf.rb +123 -0
  14. data/src/ruby/ext/grpc/rb_byte_buffer.c +65 -0
  15. data/src/ruby/ext/grpc/rb_byte_buffer.h +35 -0
  16. data/src/ruby/ext/grpc/rb_call.c +1051 -0
  17. data/src/ruby/ext/grpc/rb_call.h +57 -0
  18. data/src/ruby/ext/grpc/rb_call_credentials.c +341 -0
  19. data/src/ruby/ext/grpc/rb_call_credentials.h +31 -0
  20. data/src/ruby/ext/grpc/rb_channel.c +846 -0
  21. data/src/ruby/ext/grpc/rb_channel.h +34 -0
  22. data/src/ruby/ext/grpc/rb_channel_args.c +155 -0
  23. data/src/ruby/ext/grpc/rb_channel_args.h +38 -0
  24. data/src/ruby/ext/grpc/rb_channel_credentials.c +286 -0
  25. data/src/ruby/ext/grpc/rb_channel_credentials.h +37 -0
  26. data/src/ruby/ext/grpc/rb_completion_queue.c +101 -0
  27. data/src/ruby/ext/grpc/rb_completion_queue.h +36 -0
  28. data/src/ruby/ext/grpc/rb_compression_options.c +471 -0
  29. data/src/ruby/ext/grpc/rb_compression_options.h +29 -0
  30. data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
  31. data/src/ruby/ext/grpc/rb_event_thread.c +145 -0
  32. data/src/ruby/ext/grpc/rb_event_thread.h +21 -0
  33. data/src/ruby/ext/grpc/rb_grpc.c +333 -0
  34. data/src/ruby/ext/grpc/rb_grpc.h +77 -0
  35. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +605 -0
  36. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +913 -0
  37. data/src/ruby/ext/grpc/rb_loader.c +57 -0
  38. data/src/ruby/ext/grpc/rb_loader.h +25 -0
  39. data/src/ruby/ext/grpc/rb_server.c +385 -0
  40. data/src/ruby/ext/grpc/rb_server.h +32 -0
  41. data/src/ruby/ext/grpc/rb_server_credentials.c +259 -0
  42. data/src/ruby/ext/grpc/rb_server_credentials.h +37 -0
  43. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +218 -0
  44. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +37 -0
  45. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +170 -0
  46. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +37 -0
  47. data/src/ruby/lib/grpc/2.4/grpc_c.bundle +0 -0
  48. data/src/ruby/lib/grpc/2.5/grpc_c.bundle +0 -0
  49. data/src/ruby/lib/grpc/2.6/grpc_c.bundle +0 -0
  50. data/src/ruby/lib/grpc/2.7/grpc_c.bundle +0 -0
  51. data/src/ruby/lib/grpc/3.0/grpc_c.bundle +0 -0
  52. data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
  53. data/src/ruby/lib/grpc/core/time_consts.rb +56 -0
  54. data/src/ruby/lib/grpc/errors.rb +277 -0
  55. data/src/ruby/lib/grpc/generic/active_call.rb +669 -0
  56. data/src/ruby/lib/grpc/generic/bidi_call.rb +233 -0
  57. data/src/ruby/lib/grpc/generic/client_stub.rb +503 -0
  58. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  59. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  60. data/src/ruby/lib/grpc/generic/rpc_desc.rb +204 -0
  61. data/src/ruby/lib/grpc/generic/rpc_server.rb +551 -0
  62. data/src/ruby/lib/grpc/generic/service.rb +211 -0
  63. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +40 -0
  64. data/src/ruby/lib/grpc/grpc.rb +24 -0
  65. data/src/ruby/lib/grpc/logconfig.rb +44 -0
  66. data/src/ruby/lib/grpc/notifier.rb +45 -0
  67. data/src/ruby/lib/grpc/structs.rb +15 -0
  68. data/src/ruby/lib/grpc/version.rb +18 -0
  69. data/src/ruby/lib/grpc.rb +37 -0
  70. data/src/ruby/pb/README.md +42 -0
  71. data/src/ruby/pb/generate_proto_ruby.sh +51 -0
  72. data/src/ruby/pb/grpc/health/checker.rb +75 -0
  73. data/src/ruby/pb/grpc/health/v1/health_pb.rb +31 -0
  74. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +62 -0
  75. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +44 -0
  76. data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
  77. data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +49 -0
  78. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +17 -0
  79. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +145 -0
  80. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +16 -0
  81. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +152 -0
  82. data/src/ruby/pb/test/client.rb +769 -0
  83. data/src/ruby/pb/test/server.rb +252 -0
  84. data/src/ruby/pb/test/xds_client.rb +415 -0
  85. data/src/ruby/spec/call_credentials_spec.rb +42 -0
  86. data/src/ruby/spec/call_spec.rb +180 -0
  87. data/src/ruby/spec/channel_connection_spec.rb +126 -0
  88. data/src/ruby/spec/channel_credentials_spec.rb +124 -0
  89. data/src/ruby/spec/channel_spec.rb +245 -0
  90. data/src/ruby/spec/client_auth_spec.rb +152 -0
  91. data/src/ruby/spec/client_server_spec.rb +664 -0
  92. data/src/ruby/spec/compression_options_spec.rb +149 -0
  93. data/src/ruby/spec/debug_message_spec.rb +134 -0
  94. data/src/ruby/spec/error_sanity_spec.rb +49 -0
  95. data/src/ruby/spec/errors_spec.rb +142 -0
  96. data/src/ruby/spec/generic/active_call_spec.rb +683 -0
  97. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  98. data/src/ruby/spec/generic/client_stub_spec.rb +1083 -0
  99. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  100. data/src/ruby/spec/generic/rpc_desc_spec.rb +374 -0
  101. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +127 -0
  102. data/src/ruby/spec/generic/rpc_server_spec.rb +748 -0
  103. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  104. data/src/ruby/spec/generic/service_spec.rb +263 -0
  105. data/src/ruby/spec/google_rpc_status_utils_spec.rb +282 -0
  106. data/src/ruby/spec/pb/codegen/grpc/testing/package_options.proto +28 -0
  107. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
  108. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
  109. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +41 -0
  110. data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
  111. data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
  112. data/src/ruby/spec/pb/codegen/package_option_spec.rb +98 -0
  113. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +57 -0
  114. data/src/ruby/spec/pb/health/checker_spec.rb +236 -0
  115. data/src/ruby/spec/server_credentials_spec.rb +104 -0
  116. data/src/ruby/spec/server_spec.rb +231 -0
  117. data/src/ruby/spec/spec_helper.rb +61 -0
  118. data/src/ruby/spec/support/helpers.rb +107 -0
  119. data/src/ruby/spec/support/services.rb +160 -0
  120. data/src/ruby/spec/testdata/README +1 -0
  121. data/src/ruby/spec/testdata/ca.pem +20 -0
  122. data/src/ruby/spec/testdata/client.key +28 -0
  123. data/src/ruby/spec/testdata/client.pem +20 -0
  124. data/src/ruby/spec/testdata/server1.key +28 -0
  125. data/src/ruby/spec/testdata/server1.pem +22 -0
  126. data/src/ruby/spec/time_consts_spec.rb +74 -0
  127. data/src/ruby/spec/user_agent_spec.rb +74 -0
  128. metadata +404 -0
@@ -0,0 +1,123 @@
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
+ require 'etc'
16
+ require 'mkmf'
17
+
18
+ windows = RUBY_PLATFORM =~ /mingw|mswin/
19
+ bsd = RUBY_PLATFORM =~ /bsd/
20
+ darwin = RUBY_PLATFORM =~ /darwin/
21
+ linux = RUBY_PLATFORM =~ /linux/
22
+ cross_compiling = ENV['RCD_HOST_RUBY_VERSION'] # set by rake-compiler-dock in build containers
23
+
24
+ grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
25
+
26
+ grpc_config = ENV['GRPC_CONFIG'] || 'opt'
27
+
28
+ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.10'
29
+
30
+ if ENV['AR'].nil? || ENV['AR'].size == 0
31
+ ENV['AR'] = RbConfig::CONFIG['AR']
32
+ end
33
+ if ENV['CC'].nil? || ENV['CC'].size == 0
34
+ ENV['CC'] = RbConfig::CONFIG['CC']
35
+ end
36
+ if ENV['CXX'].nil? || ENV['CXX'].size == 0
37
+ ENV['CXX'] = RbConfig::CONFIG['CXX']
38
+ end
39
+ if ENV['LD'].nil? || ENV['LD'].size == 0
40
+ ENV['LD'] = ENV['CC']
41
+ end
42
+
43
+ if darwin && !cross_compiling
44
+ ENV['AR'] = 'libtool'
45
+ ENV['ARFLAGS'] = '-o'
46
+ end
47
+
48
+ ENV['EMBED_OPENSSL'] = 'true'
49
+ ENV['EMBED_ZLIB'] = 'true'
50
+ ENV['EMBED_CARES'] = 'true'
51
+
52
+ ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
53
+ if darwin && !cross_compiling
54
+ if RUBY_PLATFORM =~ /arm64/
55
+ ENV['ARCH_FLAGS'] = '-arch arm64'
56
+ else
57
+ ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64'
58
+ end
59
+ end
60
+
61
+ ENV['CPPFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
62
+ ENV['CPPFLAGS'] += ' -DGRPC_XDS_USER_AGENT_NAME_SUFFIX="\"RUBY\"" '
63
+ ENV['CPPFLAGS'] += ' -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\"1.42.0.pre1\"" '
64
+
65
+ output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
66
+ grpc_lib_dir = File.join(output_dir, 'libs', grpc_config)
67
+ ENV['BUILDDIR'] = output_dir
68
+
69
+ unless windows
70
+ puts 'Building internal gRPC into ' + grpc_lib_dir
71
+ nproc = 4
72
+ nproc = Etc.nprocessors * 2 if Etc.respond_to? :nprocessors
73
+ make = bsd ? 'gmake' : 'make'
74
+ system("#{make} -j#{nproc} -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config} Q=")
75
+ exit 1 unless $? == 0
76
+ end
77
+
78
+ $CFLAGS << ' -I' + File.join(grpc_root, 'include')
79
+
80
+ ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', 'ext-export')
81
+ $LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if linux
82
+ $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if darwin
83
+
84
+ $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows
85
+ if grpc_config == 'gcov'
86
+ $CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage'
87
+ $LDFLAGS << ' -fprofile-arcs -ftest-coverage -rdynamic'
88
+ end
89
+
90
+ if grpc_config == 'dbg'
91
+ $CFLAGS << ' -O0 -ggdb3'
92
+ end
93
+
94
+ $LDFLAGS << ' -Wl,-wrap,memcpy' if linux
95
+ $LDFLAGS << ' -static-libgcc -static-libstdc++' if linux
96
+ $LDFLAGS << ' -static' if windows
97
+
98
+ $CFLAGS << ' -std=c99 '
99
+ $CFLAGS << ' -Wall '
100
+ $CFLAGS << ' -Wextra '
101
+ $CFLAGS << ' -pedantic '
102
+
103
+ output = File.join('grpc', 'grpc_c')
104
+ puts 'Generating Makefile for ' + output
105
+ create_makefile(output)
106
+
107
+ strip_tool = RbConfig::CONFIG['STRIP']
108
+ strip_tool += ' -x' if darwin
109
+
110
+ if grpc_config == 'opt'
111
+ File.open('Makefile.new', 'w') do |o|
112
+ o.puts 'hijack: all strip'
113
+ o.puts
114
+ File.foreach('Makefile') do |i|
115
+ o.puts i
116
+ end
117
+ o.puts
118
+ o.puts 'strip: $(DLLIB)'
119
+ o.puts "\t$(ECHO) Stripping $(DLLIB)"
120
+ o.puts "\t$(Q) #{strip_tool} $(DLLIB)"
121
+ end
122
+ File.rename('Makefile.new', 'Makefile')
123
+ end
@@ -0,0 +1,65 @@
1
+ /*
2
+ *
3
+ * Copyright 2015 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
+ #include "rb_byte_buffer.h"
22
+
23
+ #include "rb_grpc.h"
24
+ #include "rb_grpc_imports.generated.h"
25
+
26
+ #include <grpc/byte_buffer_reader.h>
27
+ #include <grpc/grpc.h>
28
+ #include <grpc/slice.h>
29
+
30
+ grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char* string, size_t length) {
31
+ grpc_slice slice = grpc_slice_from_copied_buffer(string, length);
32
+ grpc_byte_buffer* buffer = grpc_raw_byte_buffer_create(&slice, 1);
33
+ grpc_slice_unref(slice);
34
+ return buffer;
35
+ }
36
+
37
+ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer* buffer) {
38
+ VALUE rb_string;
39
+ grpc_byte_buffer_reader reader;
40
+ grpc_slice next;
41
+ if (buffer == NULL) {
42
+ return Qnil;
43
+ }
44
+ rb_string = rb_str_buf_new(grpc_byte_buffer_length(buffer));
45
+ if (!grpc_byte_buffer_reader_init(&reader, buffer)) {
46
+ rb_raise(rb_eRuntimeError, "Error initializing byte buffer reader.");
47
+ return Qnil;
48
+ }
49
+ while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
50
+ rb_str_cat(rb_string, (const char*)GRPC_SLICE_START_PTR(next),
51
+ GRPC_SLICE_LENGTH(next));
52
+ grpc_slice_unref(next);
53
+ }
54
+ grpc_byte_buffer_reader_destroy(&reader);
55
+ return rb_string;
56
+ }
57
+
58
+ VALUE grpc_rb_slice_to_ruby_string(grpc_slice slice) {
59
+ if (GRPC_SLICE_START_PTR(slice) == NULL) {
60
+ rb_raise(rb_eRuntimeError,
61
+ "attempt to convert uninitialized grpc_slice to ruby string");
62
+ }
63
+ return rb_str_new((char*)GRPC_SLICE_START_PTR(slice),
64
+ GRPC_SLICE_LENGTH(slice));
65
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ *
3
+ * Copyright 2015 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
+ #ifndef GRPC_RB_BYTE_BUFFER_H_
20
+ #define GRPC_RB_BYTE_BUFFER_H_
21
+
22
+ #include <ruby/ruby.h>
23
+
24
+ #include <grpc/grpc.h>
25
+
26
+ /* Converts a char* with a length to a grpc_byte_buffer */
27
+ grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char* string, size_t length);
28
+
29
+ /* Converts a grpc_byte_buffer to a ruby string */
30
+ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer* buffer);
31
+
32
+ /* Converts a grpc_slice to a ruby string */
33
+ VALUE grpc_rb_slice_to_ruby_string(grpc_slice slice);
34
+
35
+ #endif /* GRPC_RB_BYTE_BUFFER_H_ */