diff options
Diffstat (limited to 'templates')
20 files changed, 338 insertions, 19 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index f2ce9b5a90..567bd3b7f8 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -177,7 +177,8 @@ if(NOT CARES_ROOT_DIR) set(CARES_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/third_party/cares/cares) endif() - set(CARES_STATIC ON) + set(CARES_SHARED OFF CACHE BOOL "disable shared library") + set(CARES_STATIC ON CACHE BOOL "link cares statically") set(CARES_INCLUDE_DIR "<%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/third_party/cares/cares") add_subdirectory(third_party/cares/cares) if(TARGET c-ares) diff --git a/templates/config.m4.template b/templates/config.m4.template index f91893c2bd..cd93fbd0fb 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -14,7 +14,7 @@ LIBS="-lpthread $LIBS" CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11" - CXXFLAGS="-std=c++11" + CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 6077f8098d..2281484917 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -31,11 +31,19 @@ return [f for f in out if not f.startswith("third_party/nanopb/")] def grpc_public_headers(libs): + excluded_files = ["include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_windows.h", + "include/grpc/support/sync_windows.h", + "include/grpc/support/tls_gcc.h", + "include/grpc/support/tls_msvc.h", + "include/grpc/impl/codegen/atm_gcc_sync.h", + "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/sync_windows.h"] out = [] for lib in libs: if lib.name in ("grpc", "gpr"): out += lib.get('public_headers', []) - return out + return [f for f in out if not f in excluded_files] def grpc_private_headers(libs): out = [] diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index e62e5b2721..215d5f9df9 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -31,6 +31,7 @@ s.add_dependency 'google-protobuf', '~> 3.1' s.add_dependency 'googleauth', '~> 0.5.1' + s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' s.add_development_dependency 'facter', '~> 2.4' diff --git a/templates/include/grpc/module.modulemap.template b/templates/include/grpc/module.modulemap.template new file mode 100644 index 0000000000..8edc4b56ac --- /dev/null +++ b/templates/include/grpc/module.modulemap.template @@ -0,0 +1,32 @@ +%YAML 1.2 +--- | + <%! + def grpc_public_headers_no_dir(libs): + excluded_files = ["include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_windows.h", + "include/grpc/support/sync_windows.h", + "include/grpc/support/tls_gcc.h", + "include/grpc/support/tls_msvc.h", + "include/grpc/impl/codegen/atm_gcc_sync.h", + "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/sync_windows.h"] + out = [] + for lib in libs: + if lib.name in ("grpc", "gpr"): + out += lib.get('public_headers', []) + out = [f for f in out if f not in excluded_files] + out = [hdr.split('/', 2)[2] for hdr in out] + return out + + def header_lines(files): + return ('\n ').join('header "%s"' % f for f in files) + %> + framework module grpc { + umbrella header "grpc.h" + + ${header_lines(grpc_public_headers_no_dir(libs))} + + export * + module * { export * } + } + diff --git a/templates/package.xml.template b/templates/package.xml.template index 15da704a47..f10f75b8c0 100644 --- a/templates/package.xml.template +++ b/templates/package.xml.template @@ -12,7 +12,7 @@ <email>grpc-packages@google.com</email> <active>yes</active> </lead> - <date>2017-05-22</date> + <date>2017-08-24</date> <time>16:06:07</time> <version> <release>${settings.php_version.php()}</release> @@ -27,6 +27,9 @@ - Channel are now by default persistent #11878 - Some bug fixes from 1.4 branch #12109, #12123 - Fixed hang bug when fork() was used #11814 + - License changed to Apache 2.0 + - Added support for php_namespace option in codegen plugin #11886 + - Updated gRPC C Core library version 1.6 </notes> <contents> <dir baseinstalldir="/" name="/"> diff --git a/templates/src/python/grpcio_testing/grpc_version.py.template b/templates/src/python/grpcio_testing/grpc_version.py.template new file mode 100644 index 0000000000..74db811d60 --- /dev/null +++ b/templates/src/python/grpcio_testing/grpc_version.py.template @@ -0,0 +1,19 @@ +%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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! + + VERSION='${settings.python_version.pep440()}' diff --git a/templates/test/cpp/naming/create_private_dns_zone.sh.template b/templates/test/cpp/naming/create_private_dns_zone.sh.template new file mode 100644 index 0000000000..14324b098c --- /dev/null +++ b/templates/test/cpp/naming/create_private_dns_zone.sh.template @@ -0,0 +1,4 @@ +%YAML 1.2 +--- | + <%namespace file="create_private_dns_zone_defs.include" import="*"/>\ + ${create_private_dns_zone(resolver_gce_integration_tests_zone_id, resolver_tests_common_zone_name)} diff --git a/templates/test/cpp/naming/create_private_dns_zone_defs.include b/templates/test/cpp/naming/create_private_dns_zone_defs.include new file mode 100644 index 0000000000..465dd6394b --- /dev/null +++ b/templates/test/cpp/naming/create_private_dns_zone_defs.include @@ -0,0 +1,32 @@ +<%def name="create_private_dns_zone(resolver_gce_integration_tests_zone_id, resolver_tests_common_zone_name)">#!/bin/bash +# 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. + +# This file is auto-generated + +set -ex + +cd $(dirname $0)/../../.. + +gcloud alpha dns managed-zones create \\ + + ${resolver_gce_integration_tests_zone_id} \\ + + --dns-name=${resolver_tests_common_zone_name} \\ + + --description="GCE-DNS-private-zone-for-GRPC-testing" \\ + + --visibility=private \\ + + --networks=default</%def> diff --git a/templates/test/cpp/naming/private_dns_zone_init.sh.template b/templates/test/cpp/naming/private_dns_zone_init.sh.template new file mode 100644 index 0000000000..d5ffd04add --- /dev/null +++ b/templates/test/cpp/naming/private_dns_zone_init.sh.template @@ -0,0 +1,4 @@ +%YAML 1.2 +--- | + <%namespace file="private_dns_zone_init_defs.include" import="*"/>\ + ${private_dns_zone_init(all_integration_test_records, resolver_gce_integration_tests_zone_id, resolver_tests_common_zone_name)} diff --git a/templates/test/cpp/naming/private_dns_zone_init_defs.include b/templates/test/cpp/naming/private_dns_zone_init_defs.include new file mode 100644 index 0000000000..06bc8adb94 --- /dev/null +++ b/templates/test/cpp/naming/private_dns_zone_init_defs.include @@ -0,0 +1,40 @@ +<%def name="private_dns_zone_init(records,resolver_gce_integration_tests_zone_id,resolver_tests_common_zone_name)">#!/bin/bash +# 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. + +# This file is auto-generated + +set -ex + +cd $(dirname $0)/../../.. + +gcloud dns record-sets transaction start -z=${resolver_gce_integration_tests_zone_id} + +% for r in records: +gcloud dns record-sets transaction add \\ + + -z=${resolver_gce_integration_tests_zone_id} \\ + + --name=${r['name']}.${resolver_tests_common_zone_name} \\ + + --type=${r['type']} \\ + + --ttl=${r['ttl']} \\ + + ${r['data']} + +% endfor +gcloud dns record-sets transaction describe -z=${resolver_gce_integration_tests_zone_id} +gcloud dns record-sets transaction execute -z=${resolver_gce_integration_tests_zone_id} +gcloud dns record-sets list -z=${resolver_gce_integration_tests_zone_id}</%def> diff --git a/templates/test/cpp/naming/resolver_component_tests_defs.include b/templates/test/cpp/naming/resolver_component_tests_defs.include new file mode 100644 index 0000000000..6fa91c741a --- /dev/null +++ b/templates/test/cpp/naming/resolver_component_tests_defs.include @@ -0,0 +1,92 @@ +<%def name="resolver_component_tests(tests)">#!/bin/bash +# 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. + +# 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" 2>&1 > /dev/null & +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. + +% for test in tests: +$FLAGS_test_bin_path \\ + + --target_name='${test['target_name']}' \\ + + --expected_addrs='${test['expected_addrs']}' \\ + + --expected_chosen_service_config='${test['expected_chosen_service_config']}' \\ + + --expected_lb_policy='${test['expected_lb_policy']}' \\ + + --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port & +wait $! || EXIT_CODE=1 + +% endfor +kill -SIGTERM $DNS_SERVER_PID || true +wait +exit $EXIT_CODE</%def> diff --git a/templates/test/cpp/naming/resolver_component_tests_runner.sh.template b/templates/test/cpp/naming/resolver_component_tests_runner.sh.template new file mode 100644 index 0000000000..86772dd141 --- /dev/null +++ b/templates/test/cpp/naming/resolver_component_tests_runner.sh.template @@ -0,0 +1,4 @@ +%YAML 1.2 +--- | + <%namespace file="resolver_component_tests_defs.include" import="*"/>\ + ${resolver_component_tests(resolver_component_test_cases)} diff --git a/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include b/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include new file mode 100644 index 0000000000..2413ec57d0 --- /dev/null +++ b/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include @@ -0,0 +1,64 @@ +<%def name="resolver_gce_integration_tests(tests, records, resolver_tests_common_zone_name)">#!/bin/bash +# 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. + +# This file is auto-generated + +set -ex + +if [[ "$GRPC_DNS_RESOLVER" == "" ]]; then + export GRPC_DNS_RESOLVER=ares +elif [[ "$GRPC_DNS_RESOLVER" != ares ]]; then + echo "Unexpected: GRPC_DNS_RESOLVER=$GRPC_DNS_RESOLVER. This test only works with c-ares resolver" + exit 1 +fi + +cd $(dirname $0)/../../.. + +if [[ "$CONFIG" == "" ]]; then + export CONFIG=opt +fi +make resolver_component_test +echo "Sanity check DNS records are resolveable with dig:" +EXIT_CODE=0 + +% for r in records: +ONE_FAILED=0 +dig ${r['type']} ${r['name']}.${resolver_tests_common_zone_name} | grep 'ANSWER SECTION' || ONE_FAILED=1 +if [[ "$ONE_FAILED" != 0 ]]; then + echo "Sanity check: dig ${r['type']} ${r['name']}.${resolver_tests_common_zone_name} FAILED" + exit 1 +fi + +% endfor +echo "Sanity check PASSED. Run resolver tests:" + +% for test in tests: +ONE_FAILED=0 +bins/$CONFIG/resolver_component_test \\ + + --target_name='${test['target_name']}' \\ + + --expected_addrs='${test['expected_addrs']}' \\ + + --expected_chosen_service_config='${test['expected_chosen_service_config']}' \\ + + --expected_lb_policy='${test['expected_lb_policy']}' || ONE_FAILED=1 +if [[ "$ONE_FAILED" != 0 ]]; then + echo "Test based on target record: ${test['target_name']} FAILED" + EXIT_CODE=1 +fi + +% endfor +exit $EXIT_CODE</%def> diff --git a/templates/test/cpp/naming/resolver_gce_integration_tests_runner.sh.template b/templates/test/cpp/naming/resolver_gce_integration_tests_runner.sh.template new file mode 100644 index 0000000000..c728784d29 --- /dev/null +++ b/templates/test/cpp/naming/resolver_gce_integration_tests_runner.sh.template @@ -0,0 +1,4 @@ +%YAML 1.2 +--- | + <%namespace file="resolver_gce_integration_tests_defs.include" import="*"/>\ + ${resolver_gce_integration_tests(resolver_gce_integration_test_cases, all_integration_test_records, resolver_tests_common_zone_name)} diff --git a/templates/tools/dockerfile/apt_get_basic.include b/templates/tools/dockerfile/apt_get_basic.include index 9237e7dace..6e19e65157 100644 --- a/templates/tools/dockerfile/apt_get_basic.include +++ b/templates/tools/dockerfile/apt_get_basic.include @@ -6,6 +6,7 @@ RUN apt-get update && apt-get install -y ${'\\'} bzip2 ${'\\'} ccache ${'\\'} curl ${'\\'} + dnsutils ${'\\'} gcc ${'\\'} gcc-multilib ${'\\'} git ${'\\'} diff --git a/templates/tools/dockerfile/clang_format.include b/templates/tools/dockerfile/clang_format.include index 9a2b60ba8c..81bd2be797 100644 --- a/templates/tools/dockerfile/clang_format.include +++ b/templates/tools/dockerfile/clang_format.include @@ -1,5 +1,5 @@ RUN apt-get update && apt-get -y install wget -RUN echo deb http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list -RUN echo deb-src http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list -RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key| apt-key add - +RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list +RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list +RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - RUN apt-get update && apt-get -y install clang-format-3.8 diff --git a/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template b/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template index 69cd4034b0..1ab667c95d 100644 --- a/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template +++ b/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template @@ -14,9 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM ubuntu:15.10 + FROM debian:jessie <%include file="../clang_format.include"/> ADD clang_format_all_the_things.sh / CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"] +
\ No newline at end of file diff --git a/templates/tools/dockerfile/python_deps.include b/templates/tools/dockerfile/python_deps.include index 2c12981418..bf1f57f267 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 pip --upgrade +RUN pip install --upgrade pip==9.0.1 RUN pip install virtualenv -RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.2.0 six==1.10.0 +RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.2.0 six==1.10.0 twisted==17.5.0 diff --git a/templates/tools/dockerfile/test/sanity/Dockerfile.template b/templates/tools/dockerfile/test/sanity/Dockerfile.template index 3f9ea32233..bf34c0ab0f 100644 --- a/templates/tools/dockerfile/test/sanity/Dockerfile.template +++ b/templates/tools/dockerfile/test/sanity/Dockerfile.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM ubuntu:15.10 + FROM debian:jessie <%include file="../../apt_get_basic.include"/> <%include file="../../gcp_api_libraries.include"/> @@ -33,14 +33,23 @@ #====================================== # More sanity test dependencies (bazel) - RUN apt-get install -y openjdk-8-jdk - # Check out Bazel version 0.4.1 since this version allows running - # ./compile.sh without a local protoc dependency - # TODO(mattkwong): install dependencies to support latest Bazel version if newer - # version is needed - RUN git clone https://github.com/bazelbuild/bazel.git /bazel && ${"\\"} - cd /bazel && git checkout tags/0.4.1 && ./compile.sh - RUN ln -s /bazel/output/bazel /bin/ + RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list + RUN apt-get update + RUN apt-get install -y -t jessie-backports openjdk-8-jdk + + #======================== + # Bazel installation + RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" > /etc/apt/sources.list.d/bazel.list + RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - + RUN apt-get -y update + RUN apt-get -y install bazel + + # Pin Bazel to 0.4.4 + # Installing Bazel via apt-get first is required before installing 0.4.4 to + # allow gRPC to build without errors. See https://github.com/grpc/grpc/issues/10553 + RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-linux-x86_64.sh + RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh + RUN ./bazel-0.4.4-installer-linux-x86_64.sh <%include file="../../clang_format.include"/> <%include file="../../run_tests_addons.include"/> |