diff options
author | 2018-05-11 12:20:11 -0700 | |
---|---|---|
committer | 2018-05-11 12:20:11 -0700 | |
commit | 4fad281ce8affe27fb7428f264d2c3b9dfc45f2f (patch) | |
tree | ca96c9efd69afec56aa2e5fe072a9f758247d0a3 /templates | |
parent | ec445cc2bb270ed4acb1c710c3533fca14a50019 (diff) | |
parent | 61fdb46ac456027c79841949272ec540f66d2317 (diff) |
Merge remote-tracking branch 'upstream/master' into fork_exec_ctx_check
Diffstat (limited to 'templates')
22 files changed, 478 insertions, 168 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index ef4d7d710c..06adb33739 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -46,6 +46,7 @@ if target_dict['name'] in ['grpc', 'grpc_cronet', 'grpc_unsecure']: deps.append("${_gRPC_ZLIB_LIBRARIES}") deps.append("${_gRPC_CARES_LIBRARIES}") + deps.append("${_gRPC_ADDRESS_SORTING_LIBRARIES}") deps.append("${_gRPC_ALLTARGETS_LIBRARIES}") for d in target_dict.get('deps', []): if d == 'benchmark': @@ -81,6 +82,7 @@ set(gRPC_INSTALL_LIBDIR "lib" CACHE STRING "Installation directory for libraries") set(gRPC_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers") set(gRPC_INSTALL_CMAKEDIR "lib/cmake/<%text>${PACKAGE_NAME}</%text>" CACHE STRING "Installation directory for cmake config files") + set(gRPC_INSTALL_SHAREDIR "share/grpc" CACHE STRING "Installation directory for root certificates") # Options option(gRPC_BUILD_TESTS "Build tests" OFF) @@ -165,6 +167,7 @@ include(cmake/ssl.cmake) include(cmake/gflags.cmake) include(cmake/benchmark.cmake) + include(cmake/address_sorting.cmake) if(NOT MSVC) set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS}</%text> -std=c99") @@ -296,11 +299,13 @@ endif (gRPC_BUILD_TESTS) % else: ${cc_library(lib)} + % if not lib.build in ["tool"]: ${cc_install(lib)} % endif % endif % endif % endif + % endif % endfor % for tgt in targets: @@ -321,7 +326,9 @@ % else: ${get_platforms_condition_begin(tgt.platforms)}\ ${cc_binary(tgt)} + % if not tgt.build in ["tool"]: ${cc_install(tgt)} + % endif ${get_platforms_condition_end(tgt.platforms)}\ % endif % endif @@ -375,6 +382,7 @@ PRIVATE <%text>${_gRPC_BENCHMARK_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR}</%text> + PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}</%text> % if lib.build in ['test', 'private'] and lib.language == 'c++': PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest @@ -455,6 +463,7 @@ PRIVATE <%text>${_gRPC_BENCHMARK_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR}</%text> + PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}</%text> % if tgt.build in ['test', 'private'] and tgt.language == 'c++': PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest @@ -499,3 +508,6 @@ DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR}</%text> ) endforeach() + + install(FILES <%text>${CMAKE_CURRENT_SOURCE_DIR}/etc/roots.pem</%text> + DESTINATION <%text>${gRPC_INSTALL_SHAREDIR}</%text>) diff --git a/templates/Makefile.template b/templates/Makefile.template index 196d12f678..354f2a2f40 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -416,7 +416,7 @@ OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib - PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.0.0 protobuf + PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.5.0 protobuf CARES_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.11.0 libcares else # HAS_PKG_CONFIG @@ -590,6 +590,11 @@ EMBED_CARES ?= false endif + ADDRESS_SORTING_DEP = $(LIBDIR)/$(CONFIG)/libaddress_sorting.a + ADDRESS_SORTING_MERGE_OBJS = $(LIBADDRESS_SORTING_OBJS) + ADDRESS_SORTING_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libaddress_sorting.a + CPPFLAGS := -Ithird_party/address_sorting/include $(CPPFLAGS) + ifeq ($(EMBED_CARES),true) CARES_DEP = $(LIBDIR)/$(CONFIG)/libares.a CARES_MERGE_OBJS = $(LIBARES_OBJS) @@ -839,7 +844,7 @@ @echo @echo "DEPENDENCY ERROR" @echo - @echo "The target you are trying to run requires protobuf 3.0.0+" + @echo "The target you are trying to run requires protobuf 3.5.0+" @echo "Your system doesn't have it, and neither does the third_party directory." @echo @echo "Please consult INSTALL to get more information." @@ -853,7 +858,7 @@ @echo @echo "DEPENDENCY ERROR" @echo - @echo "The target you are trying to run requires protobuf-compiler 3.0.0+" + @echo "The target you are trying to run requires protobuf-compiler 3.5.0+" @echo "Your system doesn't have it, and neither does the third_party directory." @echo @echo "Please consult INSTALL to get more information." @@ -1480,7 +1485,7 @@ else % endif - $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP)\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP)\ ## The else here corresponds to the if secure earlier. % else: % if lib.language == 'c++': @@ -1504,6 +1509,9 @@ % if lib.name != 'ares': $(CARES_DEP) \ % endif + % if lib.name != 'address_sorting': + $(ADDRESS_SORTING_DEP) \ + % endif % endif % if lib.language == 'c++': $(PROTOBUF_DEP)\ @@ -1513,6 +1521,7 @@ $(LIBGPR_OBJS) \ $(ZLIB_MERGE_OBJS) \ $(CARES_MERGE_OBJS) \ + $(ADDRESS_SORTING_MERGE_OBJS) \ % if lib.get('secure', 'check') == True: $(OPENSSL_MERGE_OBJS) \ % endif @@ -1526,6 +1535,7 @@ $(LIBGPR_OBJS) \ $(ZLIB_MERGE_OBJS) \ $(CARES_MERGE_OBJS) \ + $(ADDRESS_SORTING_MERGE_OBJS) \ % if lib.get('secure', 'check') == True: $(OPENSSL_MERGE_OBJS) \ % endif @@ -1548,9 +1558,9 @@ common = '$(LIB' + lib.name.upper() + '_OBJS)' link_libs = '' - lib_deps = ' $(ZLIB_DEP) $(CARES_DEP)' + lib_deps = ' $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP)' mingw_libs = '' - mingw_lib_deps = ' $(ZLIB_DEP) $(CARES_DEP)' + mingw_lib_deps = ' $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP)' if lib.language == 'c++': lib_deps += ' $(PROTOBUF_DEP)' mingw_lib_deps += ' $(PROTOBUF_DEP)' @@ -1575,7 +1585,7 @@ security = lib.get('secure', 'check') if security == True: common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)' - common = common + ' $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS)' + common = common + ' $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS)' if security in [True, 'check']: for src in lib.src: @@ -1626,7 +1636,7 @@ % endif % if lib.language == 'c++': ## If the lib was C++, we have to close the Makefile's if that tested - ## the presence of protobuf 3.0.0+ + ## the presence of protobuf 3.5.0+ endif % endif @@ -1692,7 +1702,7 @@ ifeq ($(NO_PROTOBUF),true) - # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error diff --git a/templates/config.m4.template b/templates/config.m4.template index cd93fbd0fb..cc19d98375 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -10,11 +10,12 @@ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include) LIBS="-lpthread $LIBS" - CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11" - CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti" + CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_16BIT=1" + CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_16BIT=1" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/templates/config.w32.template b/templates/config.w32.template index 4edef963f2..ef25e55596 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -23,11 +23,13 @@ EXTENSION("grpc", grpc_source, null, "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+ "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+ + "/DPB_FIELD_16BIT "+ "/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+"\\include "+ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ - "/I"+configure_module_dirname+"\\third_party\\zlib"); + "/I"+configure_module_dirname+"\\third_party\\zlib "+ + "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include"); <% dirs = {} for lib in libs: diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 3e80d602e1..af97d81834 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -202,6 +202,6 @@ # TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path? s.prepare_command = <<-END_OF_COMMAND - find src/core/ -type f -exec sed -E -i'.back' 's;#include "third_party/nanopb/(.*)";#include <nanopb/\\1>;g' {} \\\; + find src/core/ -type f ! -path '*.back*' -exec sed -E -i'.back' 's;#include "third_party/nanopb/(.*)";#include <nanopb/\\1>;g' {} \\\; END_OF_COMMAND end diff --git a/templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template b/templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template new file mode 100644 index 0000000000..8ce2a57323 --- /dev/null +++ b/templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template @@ -0,0 +1,208 @@ +%YAML 1.2 +--- | + <% + native_method_signatures = [ + 'void grpcsharp_init()', + 'void grpcsharp_shutdown()', + 'IntPtr grpcsharp_version_string() // returns not-owned const char*', + 'BatchContextSafeHandle grpcsharp_batch_context_create()', + 'IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx)', + 'IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx)', + 'void grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen)', + 'StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx)', + 'IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength)', + 'IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx)', + 'int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx)', + 'void grpcsharp_batch_context_reset(BatchContextSafeHandle ctx)', + 'void grpcsharp_batch_context_destroy(IntPtr ctx)', + 'RequestCallContextSafeHandle grpcsharp_request_call_context_create()', + 'CallSafeHandle grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx)', + 'IntPtr grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength)', + 'IntPtr grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength)', + 'Timespec grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx)', + 'IntPtr grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx)', + 'void grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx)', + 'void grpcsharp_request_call_context_destroy(IntPtr ctx)', + 'CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)', + 'void grpcsharp_call_credentials_release(IntPtr credentials)', + 'CallError grpcsharp_call_cancel(CallSafeHandle call)', + 'CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description)', + 'CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata)', + 'CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx)', + 'CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags)', + 'CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx)', + 'CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx)', + 'CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx)', + 'CallError grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)', + 'CallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials)', + 'CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call)', + 'void grpcsharp_call_destroy(IntPtr call)', + 'ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs)', + 'void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value)', + 'void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value)', + 'void grpcsharp_channel_args_destroy(IntPtr args)', + 'void grpcsharp_override_default_ssl_roots(string pemRootCerts)', + 'ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey)', + 'ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds)', + 'void grpcsharp_channel_credentials_release(IntPtr credentials)', + 'ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs)', + 'ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs)', + 'CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)', + 'ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect)', + 'void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)', + 'CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call)', + 'void grpcsharp_channel_destroy(IntPtr channel)', + 'int grpcsharp_sizeof_grpc_event()', + 'CompletionQueueSafeHandle grpcsharp_completion_queue_create_async()', + 'CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync()', + 'void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq)', + 'CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq)', + 'CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag)', + 'void grpcsharp_completion_queue_destroy(IntPtr cq)', + 'void gprsharp_free(IntPtr ptr)', + 'MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity)', + 'void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength)', + 'UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray)', + 'IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength)', + 'IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength)', + 'void grpcsharp_metadata_array_destroy_full(IntPtr array)', + 'void grpcsharp_redirect_log(GprLogDelegate callback)', + 'CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor)', + 'void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)', + 'ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth)', + 'void grpcsharp_server_credentials_release(IntPtr credentials)', + 'ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args)', + 'void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq)', + 'int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr)', + 'int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds)', + 'void grpcsharp_server_start(ServerSafeHandle server)', + 'CallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx)', + 'void grpcsharp_server_cancel_all_calls(ServerSafeHandle server)', + 'void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)', + 'void grpcsharp_server_destroy(IntPtr server)', + 'AuthContextSafeHandle grpcsharp_call_auth_context(CallSafeHandle call)', + 'IntPtr grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext) // returns const char*', + 'AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext)', + 'IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator) // returns const auth_property*', + 'void grpcsharp_auth_context_release(IntPtr authContext)', + 'Timespec gprsharp_now(ClockType clockType)', + 'Timespec gprsharp_inf_future(ClockType clockType)', + 'Timespec gprsharp_inf_past(ClockType clockType)', + 'Timespec gprsharp_convert_clock_type(Timespec t, ClockType targetClock)', + 'int gprsharp_sizeof_timespec()', + 'CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback)', + 'IntPtr grpcsharp_test_nop(IntPtr ptr)', + 'void grpcsharp_test_override_method(string methodName, string variant)', + ] + + import re + native_methods = [] + for signature in native_method_signatures: + match = re.match('([A-Za-z0-9_.]+) +([A-Za-z0-9_]+)\\((.*)\\)(.*)', signature) + if not match: + raise Exception('Malformed signature "%s"' % signature) + native_methods.append({'returntype': match.group(1), 'name': match.group(2), 'params': match.group(3), 'comment': match.group(4)}) + %> + #region Copyright notice and license + + // Copyright 2015 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. + + #endregion + + using System; + using System.Collections.Concurrent; + using System.Diagnostics; + using System.IO; + using System.Reflection; + using System.Runtime.InteropServices; + using System.Threading; + + using Grpc.Core.Logging; + using Grpc.Core.Utils; + + namespace Grpc.Core.Internal + { + internal partial class NativeMethods + { + #region Native methods + + % for method in native_methods: + public readonly Delegates.${method['name']}_delegate ${method['name']}; + % endfor + + #endregion + + public NativeMethods(UnmanagedLibrary library) + { + % for method in native_methods: + this.${method['name']} = GetMethodDelegate<Delegates.${method['name']}_delegate>(library); + % endfor + } + + public NativeMethods(DllImportsFromStaticLib unusedInstance) + { + % for method in native_methods: + this.${method['name']} = DllImportsFromStaticLib.${method['name']}; + % endfor + } + + public NativeMethods(DllImportsFromSharedLib unusedInstance) + { + % for method in native_methods: + this.${method['name']} = DllImportsFromSharedLib.${method['name']}; + % endfor + } + + /// <summary> + /// Delegate types for all published native methods. Declared under inner class to prevent scope pollution. + /// </summary> + public class Delegates + { + % for method in native_methods: + public delegate ${method['returntype']} ${method['name']}_delegate(${method['params']});${method['comment']} + % endfor + } + + /// <summary> + /// grpc_csharp_ext used as a static library (e.g Unity iOS). + /// </summary> + internal class DllImportsFromStaticLib + { + private const string ImportName = "__Internal"; + % for method in native_methods: + + [DllImport(ImportName)] + public static extern ${method['returntype']} ${method['name']}(${method['params']}); + % endfor + } + + /// <summary> + /// grpc_csharp_ext used a shared library (e.g on Unity Standalone and Android). + /// </summary> + internal class DllImportsFromSharedLib + { + private const string ImportName = "grpc_csharp_ext"; + % for method in native_methods: + + [DllImport(ImportName)] + public static extern ${method['returntype']} ${method['name']}(${method['params']}); + % endfor + } + } + } diff --git a/templates/src/csharp/Grpc.Core/Version.csproj.include.template b/templates/src/csharp/Grpc.Core/Version.csproj.include.template index 5bc66e911b..398b198dbd 100755 --- a/templates/src/csharp/Grpc.Core/Version.csproj.include.template +++ b/templates/src/csharp/Grpc.Core/Version.csproj.include.template @@ -4,6 +4,6 @@ <Project> <PropertyGroup> <GrpcCsharpVersion>${settings.csharp_version}</GrpcCsharpVersion> - <GoogleProtobufVersion>3.3.0</GoogleProtobufVersion> + <GoogleProtobufVersion>3.5.1</GoogleProtobufVersion> </PropertyGroup> </Project> diff --git a/templates/src/csharp/build_packages_dotnetcli.bat.template b/templates/src/csharp/build_packages_dotnetcli.bat.template index 6671991ad2..1bf78c4d23 100755 --- a/templates/src/csharp/build_packages_dotnetcli.bat.template +++ b/templates/src/csharp/build_packages_dotnetcli.bat.template @@ -21,17 +21,21 @@ set NUGET=C:\nuget\nuget.exe set DOTNET=dotnet - set -ex - mkdir ..\..\artifacts @rem Collect the artifacts built by the previous build step if running on Jenkins mkdir nativelibs + @rem Jenkins flow (deprecated) powershell -Command "cp -r ..\..\platform=*\artifacts\csharp_ext_* nativelibs" + @rem Kokoro flow + powershell -Command "cp -r ..\..\input_artifacts\csharp_ext_* nativelibs" @rem Collect protoc artifacts built by the previous build step mkdir protoc_plugins + @rem Jenkins flow (deprecated) powershell -Command "cp -r ..\..\platform=*\artifacts\protoc_* protoc_plugins" + @rem Kokoro flow + powershell -Command "cp -r ..\..\input_artifacts\protoc_* protoc_plugins" %%DOTNET% restore Grpc.sln || goto :error diff --git a/templates/src/csharp/build_packages_dotnetcli.sh.template b/templates/src/csharp/build_packages_dotnetcli.sh.template index be52b4631c..ddfea74744 100755 --- a/templates/src/csharp/build_packages_dotnetcli.sh.template +++ b/templates/src/csharp/build_packages_dotnetcli.sh.template @@ -23,11 +23,17 @@ # Collect the artifacts built by the previous build step mkdir -p nativelibs + # Jenkins flow (deprecated) cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/csharp_ext_* nativelibs || true + # Kokoro flow + cp -r $EXTERNAL_GIT_ROOT/input_artifacts/csharp_ext_* nativelibs || true # Collect protoc artifacts built by the previous build step mkdir -p protoc_plugins + # Jenkins flow (deprecated) cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/protoc_* protoc_plugins || true + # Kokoro flow + cp -r $EXTERNAL_GIT_ROOT/input_artifacts/protoc_* protoc_plugins || true dotnet restore Grpc.sln diff --git a/templates/src/objective-c/GRPCClient/private/version.h.template b/templates/src/objective-c/GRPCClient/private/version.h.template index 34df24cd83..22b3bb25d4 100644 --- a/templates/src/objective-c/GRPCClient/private/version.h.template +++ b/templates/src/objective-c/GRPCClient/private/version.h.template @@ -24,5 +24,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. - #define GRPC_OBJC_VERSION_STRING @"${settings.version}" diff --git a/templates/src/objective-c/tests/version.h.template b/templates/src/objective-c/tests/version.h.template index 72774ab99c..a87d43a892 100644 --- a/templates/src/objective-c/tests/version.h.template +++ b/templates/src/objective-c/tests/version.h.template @@ -24,6 +24,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. - #define GRPC_OBJC_VERSION_STRING @"${settings.version}" #define GRPC_C_VERSION_STRING @"${settings.core_version}" diff --git a/templates/test/cpp/naming/resolver_component_tests_defs.include b/templates/test/cpp/naming/resolver_component_tests_defs.include index efa54a456b..2690af4baa 100644 --- a/templates/test/cpp/naming/resolver_component_tests_defs.include +++ b/templates/test/cpp/naming/resolver_component_tests_defs.include @@ -1,4 +1,4 @@ -<%def name="resolver_component_tests(tests)">#!/bin/bash +<%def name="resolver_component_tests(tests)">#!/usr/bin/env python # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,78 +15,129 @@ # This file is auto-generated -set -ex - -# all command args required in this set order -FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2) -FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2) -FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2) -FLAGS_test_dns_server_port=$(echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2) - -for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_test_dns_server_port"; do - if [[ "$cmd_arg" == "" ]]; then - echo "Missing a CMD arg" && exit 1 - fi -done - -if [[ "$GRPC_DNS_RESOLVER" != "" && "$GRPC_DNS_RESOLVER" != ares ]]; then - echo "This test only works under GRPC_DNS_RESOLVER=ares. Have GRPC_DNS_RESOLVER=$GRPC_DNS_RESOLVER" && exit 1 -fi -export GRPC_DNS_RESOLVER=ares - -"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" > /dev/null 2>&1 & -DNS_SERVER_PID=$! -echo "Local DNS server started. PID: $DNS_SERVER_PID" - -# Health check local DNS server TCP and UDP ports -for ((i=0;i<30;i++)); -do - echo "Retry health-check DNS query to local DNS server over tcp and udp" - RETRY=0 - dig A health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. @localhost -p "$FLAGS_test_dns_server_port" +tries=1 +timeout=1 | grep '123.123.123.123' || RETRY=1 - dig A health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. @localhost -p "$FLAGS_test_dns_server_port" +tries=1 +timeout=1 +tcp | grep '123.123.123.123' || RETRY=1 - if [[ "$RETRY" == 0 ]]; then - break - fi; - sleep 0.1 -done - -if [[ $RETRY == 1 ]]; then - echo "FAILED TO START LOCAL DNS SERVER" - kill -SIGTERM "$DNS_SERVER_PID" - wait - exit 1 -fi - -function terminate_all { - echo "Received signal. Terminating $! and $DNS_SERVER_PID" - kill -SIGTERM "$!" || true - kill -SIGTERM "$DNS_SERVER_PID" || true - wait - exit 1 -} - -trap terminate_all SIGTERM SIGINT - -EXIT_CODE=0 -# TODO: this test should check for GCE residency and skip tests using _grpclb._tcp.* SRV records once GCE residency checks are made -# in the resolver. +import argparse +import sys +import subprocess +import tempfile +import os +import time +import signal + + +argp = argparse.ArgumentParser(description='Run c-ares resolver tests') +argp.add_argument('--test_bin_path', default=None, type=str, + help='Path to gtest test binary to invoke.') +argp.add_argument('--dns_server_bin_path', default=None, type=str, + help='Path to local DNS server python script.') +argp.add_argument('--records_config_path', default=None, type=str, + help=('Path to DNS records yaml file that ' + 'specifies records for the DNS sever. ')) +argp.add_argument('--dns_server_port', default=None, type=int, + help=('Port that local DNS server is listening on.')) +argp.add_argument('--dns_resolver_bin_path', default=None, type=str, + help=('Path to the DNS health check utility.')) +argp.add_argument('--tcp_connect_bin_path', default=None, type=str, + help=('Path to the TCP health check utility.')) +args = argp.parse_args() + +def test_runner_log(msg): + sys.stderr.write('\n%s: %s\n' % (__file__, msg)) + +cur_resolver = os.environ.get('GRPC_DNS_RESOLVER') +if cur_resolver and cur_resolver != 'ares': + test_runner_log(('WARNING: cur resolver set to %s. This set of tests ' + 'needs to use GRPC_DNS_RESOLVER=ares.')) + test_runner_log('Exit 1 without running tests.') + sys.exit(1) +os.environ.update({'GRPC_DNS_RESOLVER': 'ares'}) + +def wait_until_dns_server_is_up(args, + dns_server_subprocess, + dns_server_subprocess_output): + for i in range(0, 30): + test_runner_log('Health check: attempt to connect to DNS server over TCP.') + tcp_connect_subprocess = subprocess.Popen([ + args.tcp_connect_bin_path, + '--server_host', '127.0.0.1', + '--server_port', str(args.dns_server_port), + '--timeout', str(1)]) + tcp_connect_subprocess.communicate() + if tcp_connect_subprocess.returncode == 0: + test_runner_log(('Health check: attempt to make an A-record ' + 'query to DNS server.')) + dns_resolver_subprocess = subprocess.Popen([ + args.dns_resolver_bin_path, + '--qname', 'health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp', + '--server_host', '127.0.0.1', + '--server_port', str(args.dns_server_port)], + stdout=subprocess.PIPE) + dns_resolver_stdout, _ = dns_resolver_subprocess.communicate() + if dns_resolver_subprocess.returncode == 0: + if '123.123.123.123' in dns_resolver_stdout: + test_runner_log(('DNS server is up! ' + 'Successfully reached it over UDP and TCP.')) + return + time.sleep(0.1) + dns_server_subprocess.kill() + dns_server_subprocess.wait() + test_runner_log(('Failed to reach DNS server over TCP and/or UDP. ' + 'Exitting without running tests.')) + test_runner_log('======= DNS server stdout ' + '(merged stdout and stderr) =============') + with open(dns_server_subprocess_output, 'r') as l: + test_runner_log(l.read()) + test_runner_log('======= end DNS server output=========') + sys.exit(1) + +dns_server_subprocess_output = tempfile.mktemp() +with open(dns_server_subprocess_output, 'w') as l: + dns_server_subprocess = subprocess.Popen([ + args.dns_server_bin_path, + '--port', str(args.dns_server_port), + '--records_config_path', args.records_config_path], + stdin=subprocess.PIPE, + stdout=l, + stderr=l) + +def _quit_on_signal(signum, _frame): + test_runner_log('Received signal: %d' % signum) + dns_server_subprocess.kill() + dns_server_subprocess.wait() + sys.exit(1) + +signal.signal(signal.SIGINT, _quit_on_signal) +signal.signal(signal.SIGTERM, _quit_on_signal) +wait_until_dns_server_is_up(args, + dns_server_subprocess, + dns_server_subprocess_output) +num_test_failures = 0 % for test in tests: -$FLAGS_test_bin_path \\ +test_runner_log('Run test with target: %s' % '${test['target_name']}')\ - --target_name='${test['target_name']}' \\ +current_test_subprocess = subprocess.Popen([\ - --expected_addrs='${test['expected_addrs']}' \\ + args.test_bin_path,\ - --expected_chosen_service_config='${test['expected_chosen_service_config']}' \\ + '--target_name', '${test['target_name']}',\ - --expected_lb_policy='${test['expected_lb_policy']}' \\ + '--expected_addrs', '${test['expected_addrs']}',\ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & -wait "$!" || EXIT_CODE=1 + '--expected_chosen_service_config', '${test['expected_chosen_service_config']}',\ + + '--expected_lb_policy', '${test['expected_lb_policy']}',\ + + '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])\ + +current_test_subprocess.communicate()\ + +if current_test_subprocess.returncode != 0:\ + + num_test_failures += 1 % endfor -kill -SIGTERM "$DNS_SERVER_PID" || true -wait -exit $EXIT_CODE</%def> +test_runner_log('now kill DNS server') +dns_server_subprocess.kill() +dns_server_subprocess.wait() +test_runner_log('%d tests failed.' % num_test_failures) +sys.exit(num_test_failures)</%def> diff --git a/templates/test/cpp/naming/resolver_component_tests_runner.sh.template b/templates/test/cpp/naming/resolver_component_tests_runner.py.template index 86772dd141..86772dd141 100644 --- a/templates/test/cpp/naming/resolver_component_tests_runner.sh.template +++ b/templates/test/cpp/naming/resolver_component_tests_runner.py.template diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template deleted file mode 100644 index 1f6755eb51..0000000000 --- a/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template +++ /dev/null @@ -1,80 +0,0 @@ -%YAML 1.2 ---- | - # Copyright 2017 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. - - FROM debian:jessie - - # Install JDK 8 and Git - RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && ${'\\'} - echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} - echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 - RUN apt-get update && apt-get -y install ${'\\'} - git ${'\\'} - libapr1 ${'\\'} - oracle-java8-installer ${'\\'} - && ${'\\'} - apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ - ENV JAVA_HOME /usr/lib/jvm/java-8-oracle - ENV PATH $PATH:$JAVA_HOME/bin - - # Install protobuf - RUN apt-get update && apt-get install -y ${'\\'} - autoconf ${'\\'} - build-essential ${'\\'} - curl ${'\\'} - gcc ${'\\'} - libtool ${'\\'} - unzip ${'\\'} - && ${'\\'} - apt-get clean - WORKDIR / - RUN git clone https://github.com/google/protobuf.git - WORKDIR /protobuf - RUN git checkout v3.3.1 && ${'\\'} - ./autogen.sh && ${'\\'} - ./configure && ${'\\'} - make && ${'\\'} - make check && ${'\\'} - make install - - # Install gcloud command line tools - ENV CLOUD_SDK_REPO "cloud-sdk-jessie" - RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && ${'\\'} - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && ${'\\'} - apt-get update && apt-get install -y google-cloud-sdk && apt-get clean && ${'\\'} - gcloud config set component_manager/disable_update_check true - - # Install Android SDK - WORKDIR / - RUN mkdir android-sdk - WORKDIR android-sdk - RUN wget -q https://dl.google.com/android/repository/tools_r25.2.5-linux.zip && ${'\\'} - unzip -qq tools_r25.2.5-linux.zip && ${'\\'} - rm tools_r25.2.5-linux.zip && ${'\\'} - echo y | tools/bin/sdkmanager "platforms;android-22" && ${'\\'} - echo y | tools/bin/sdkmanager "build-tools;25.0.2" && ${'\\'} - echo y | tools/bin/sdkmanager "extras;android;m2repository" && ${'\\'} - echo y | tools/bin/sdkmanager "extras;google;google_play_services" && ${'\\'} - echo y | tools/bin/sdkmanager "extras;google;m2repository" && ${'\\'} - echo y | tools/bin/sdkmanager "patcher;v4" && ${'\\'} - echo y | tools/bin/sdkmanager "platform-tools" - ENV ANDROID_HOME "/android-sdk" - - # Reset the working directory - WORKDIR / - - # Define the default command. - CMD ["bash"] diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_nodepurejs/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_nodepurejs/Dockerfile.template new file mode 100644 index 0000000000..e53d863c92 --- /dev/null +++ b/templates/tools/dockerfile/interoptest/grpc_interop_nodepurejs/Dockerfile.template @@ -0,0 +1,23 @@ +%YAML 1.2 +--- | + # Copyright 2015 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. + + FROM debian:jessie + + <%include file="../../apt_get_basic.include"/> + <%include file="../../node_deps.include"/> + <%include file="../../run_tests_addons.include"/> + # Define the default command. + CMD ["bash"] diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template index f5a53f045f..bf28796de3 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template @@ -18,6 +18,10 @@ <%include file="../../apt_get_basic.include"/> <%include file="../../python_deps.include"/> + # Install pip and virtualenv for Python 3.4 + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 + RUN python3.4 -m pip install virtualenv + <%include file="../../run_tests_addons.include"/> # Define the default command. CMD ["bash"] diff --git a/templates/tools/dockerfile/node_deps.include b/templates/tools/dockerfile/node_deps.include index 2f7d0d3abb..bee3087b3f 100644 --- a/templates/tools/dockerfile/node_deps.include +++ b/templates/tools/dockerfile/node_deps.include @@ -9,4 +9,5 @@ RUN /bin/bash -l -c "nvm install 4 && npm config set cache /tmp/npm-cache && npm RUN /bin/bash -l -c "nvm install 5 && npm config set cache /tmp/npm-cache && npm install -g npm" RUN /bin/bash -l -c "nvm install 6 && npm config set cache /tmp/npm-cache && npm install -g npm" RUN /bin/bash -l -c "nvm install 8 && npm config set cache /tmp/npm-cache && npm install -g npm" -RUN /bin/bash -l -c "nvm alias default 8"
\ No newline at end of file +RUN /bin/bash -l -c "nvm install 9 && npm config set cache /tmp/npm-cache && npm install -g npm" +RUN /bin/bash -l -c "nvm alias default 9"
\ No newline at end of file diff --git a/templates/tools/dockerfile/python_deps.include b/templates/tools/dockerfile/python_deps.include index cd1af22b43..c7bf238b5a 100644 --- a/templates/tools/dockerfile/python_deps.include +++ b/templates/tools/dockerfile/python_deps.include @@ -9,6 +9,6 @@ RUN apt-get update && apt-get install -y ${'\\'} python-pip # Install Python packages from PyPI -RUN pip install --upgrade pip==9.0.1 +RUN pip install --upgrade pip==10.0.1 RUN pip install virtualenv -RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.0.post1 six==1.10.0 twisted==17.5.0 +RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 twisted==17.5.0 diff --git a/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template new file mode 100644 index 0000000000..d70ad94613 --- /dev/null +++ b/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template @@ -0,0 +1,58 @@ +%YAML 1.2 +--- | + # Copyright 2015 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. + + FROM alpine:3.5 + + # Install Git and basic packages. + RUN apk update && apk add ${'\\'} + autoconf ${'\\'} + automake ${'\\'} + bzip2 ${'\\'} + build-base ${'\\'} + cmake ${'\\'} + ccache ${'\\'} + curl ${'\\'} + gcc ${'\\'} + git ${'\\'} + libtool ${'\\'} + linux-headers ${'\\'} + make ${'\\'} + perl ${'\\'} + strace ${'\\'} + python-dev ${'\\'} + py-pip ${'\\'} + py-yaml ${'\\'} + unzip ${'\\'} + wget ${'\\'} + zip + + # Install Python packages from PyPI + RUN pip install --upgrade pip==10.0.1 + RUN pip install virtualenv + RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.0.post1 six==1.10.0 twisted==17.5.0 + + # Google Cloud platform API libraries + RUN pip install --upgrade google-api-python-client + + # Install gflags + RUN git clone https://github.com/gflags/gflags.git && cd gflags && git checkout v2.2.0 + RUN cd gflags && cmake . && make && make install + RUN ln -s /usr/local/include/gflags /usr/include/gflags + + <%include file="../../run_tests_addons.include"/> + + # Define the default command. + CMD ["bash"] diff --git a/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template b/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template index 0d47aa91f3..672e9fbb5c 100644 --- a/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/multilang_jessie_x64/Dockerfile.template @@ -25,6 +25,10 @@ <%include file="../../php_deps.include"/> <%include file="../../ruby_deps.include"/> <%include file="../../python_deps.include"/> + # Install pip and virtualenv for Python 3.4 + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 + RUN python3.4 -m pip install virtualenv + # Install coverage for Python test coverage reporting RUN pip install coverage ENV PATH ~/.local/bin:$PATH diff --git a/templates/tools/dockerfile/test/python_jessie_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_jessie_x64/Dockerfile.template index dba6a227f2..e73b839a28 100644 --- a/templates/tools/dockerfile/test/python_jessie_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_jessie_x64/Dockerfile.template @@ -19,6 +19,10 @@ <%include file="../../apt_get_basic.include"/> <%include file="../../gcp_api_libraries.include"/> <%include file="../../python_deps.include"/> + # Install pip and virtualenv for Python 3.4 + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 + RUN python3.4 -m pip install virtualenv + <%include file="../../run_tests_addons.include"/> # Define the default command. CMD ["bash"] diff --git a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template index 0df19f61e1..ba65c06a3b 100644 --- a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template @@ -20,6 +20,10 @@ <%include file="../../gcp_api_libraries.include"/> <%include file="../../python_deps.include"/> <%include file="../../apt_get_pyenv.include"/> + # Install pip and virtualenv for Python 3.4 + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 + RUN python3.4 -m pip install virtualenv + <%include file="../../run_tests_addons.include"/> # Define the default command. CMD ["bash"] |