diff options
author | 2015-09-10 11:46:52 -0700 | |
---|---|---|
committer | 2015-09-10 11:46:52 -0700 | |
commit | be947697d7c5edb1f67c9df5ef024e3eaf98e9e6 (patch) | |
tree | 774f0d333b48de97236fdb3e9382765a575a75ce /templates | |
parent | 3121fd4d757991e7ef95a7b6b370b83c23ba61b6 (diff) | |
parent | 374cd9b0abbcd0dc3f1e65777e0dd37a9d5c447f (diff) |
Merge github.com:grpc/grpc into immolating-conversion
Diffstat (limited to 'templates')
50 files changed, 775 insertions, 837 deletions
diff --git a/templates/BUILD.template b/templates/BUILD.template index 8b565a0dc0..bb18c353b1 100644 --- a/templates/BUILD.template +++ b/templates/BUILD.template @@ -1,227 +1,229 @@ -# GRPC Bazel BUILD file. -# This currently builds C, C++ and Objective-C code. -# This file has been automatically generated from a template file. -# Please look at the templates directory instead. -# This file can be regenerated from the template by running -# tools/buildgen/generate_projects.sh - -# Copyright 2015, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -licenses(["notice"]) # 3-clause BSD - -package(default_visibility = ["//visibility:public"]) - -<%! -def get_deps(target_dict): - deps = [] - if target_dict.get('secure', 'no') == 'yes': +%YAML 1.2 +--- | + # GRPC Bazel BUILD file. + # This currently builds C, C++ and Objective-C code. + # This file has been automatically generated from a template file. + # Please look at the templates directory instead. + # This file can be regenerated from the template by running + # tools/buildgen/generate_projects.sh + + # Copyright 2015, Google Inc. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following disclaimer + # in the documentation and/or other materials provided with the + # distribution. + # * Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + licenses(["notice"]) # 3-clause BSD + + package(default_visibility = ["//visibility:public"]) + + <%! + def get_deps(target_dict): + deps = [] + if target_dict.get('secure', False): + deps = [ + "//external:libssl", + ] + if target_dict.get('build', None) == 'protoc': + deps.append("//external:protobuf_compiler") + if target_dict['name'] == 'grpc++_unsecure' or target_dict['name'] == 'grpc++': + deps.append("//external:protobuf_clib") + elif target_dict['name'] == 'grpc': + deps.append("//external:zlib") + for d in target_dict.get('deps', []): + if d.find('//') == 0 or d[0] == ':': + deps.append(d) + else: + deps.append(':%s' % (d)) + return deps + %> + + % for lib in libs: + % if lib.build in ("all", "protoc"): + ${cc_library(lib)} + % endif + % endfor + + % for lib in libs: + % if lib.name in ("grpc", "gpr"): + ${objc_library(lib)} + % endif + % endfor + + % for tgt in targets: + % if tgt.build == 'protoc': + ${cc_binary(tgt)} + % endif + % endfor + + <%def name="cc_library(lib)"> + cc_library( + name = "${lib.name}", + srcs = [ + % for hdr in lib.get("headers", []): + "${hdr}", + % endfor + % for src in lib.src: + "${src}", + % endfor + ], + hdrs = [ + % for hdr in lib.get("public_headers", []): + "${hdr}", + % endfor + ], + includes = [ + "include", + ".", + ], deps = [ - "//external:libssl", - ] - if target_dict.get('build', None) == 'protoc': - deps.append("//external:protobuf_compiler") - if target_dict['name'] == 'grpc++_unsecure' or target_dict['name'] == 'grpc++': - deps.append("//external:protobuf_clib") - elif target_dict['name'] == 'grpc': - deps.append("//external:zlib") - for d in target_dict.get('deps', []): - if d.find('//') == 0 or d[0] == ':': - deps.append(d) - else: - deps.append(':%s' % (d)) - return deps -%> - -% for lib in libs: -% if lib.build in ("all", "protoc"): -${cc_library(lib)} -% endif -% endfor - -% for lib in libs: -% if lib.name in ("grpc", "gpr"): -${objc_library(lib)} -% endif -% endfor - -% for tgt in targets: -% if tgt.build == 'protoc': -${cc_binary(tgt)} -% endif -% endfor - -<%def name="cc_library(lib)"> -cc_library( - name = "${lib.name}", - srcs = [ -% for hdr in lib.get("headers", []): - "${hdr}", -% endfor -% for src in lib.src: - "${src}", -% endfor - ], - hdrs = [ -% for hdr in lib.get("public_headers", []): - "${hdr}", -% endfor - ], - includes = [ - "include", - ".", - ], - deps = [ -% for dep in get_deps(lib): - "${dep}", -% endfor - ], -) -</%def> - -<%def name="objc_library(lib)"> -objc_library( - name = "${lib.name}_objc", - srcs = [ -% for src in lib.src: - "${src}", -% endfor - ], - hdrs = [ -% for hdr in lib.get("public_headers", []): - "${hdr}", -% endfor -% for hdr in lib.get("headers", []): - "${hdr}", -% endfor - ], - includes = [ - "include", - ".", - ], - deps = [ -% for dep in lib.get("deps", []): - ":${dep}_objc", -% endfor -% if lib.get('secure', 'no') == 'yes': - "//external:libssl_objc", -% endif - ], -% if lib.get("baselib", false): - sdk_dylibs = ["libz"], -% endif -) -</%def> - -<%def name="cc_binary(tgt)"> -cc_binary( - name = "${tgt.name}", - srcs = [ -% for src in tgt.src: - "${src}", -% endfor - ], - deps = [ -% for dep in get_deps(tgt): - "${dep}", -% endfor - ], -) -</%def> - -objc_path = "src/objective-c" - -rx_library_path = objc_path + "/RxLibrary" - -objc_library( - name = "rx_library", - hdrs = glob([ - rx_library_path + "/*.h", - rx_library_path + "/transformations/*.h", - ]), - srcs = glob([ - rx_library_path + "/*.m", - rx_library_path + "/transformations/*.m", - ]), - includes = [objc_path], - deps = [ - ":rx_library_private", - ], -) - -objc_library( - name = "rx_library_private", - hdrs = glob([rx_library_path + "/private/*.h"]), - srcs = glob([rx_library_path + "/private/*.m"]), - visibility = ["//visibility:private"], -) - -objc_client_path = objc_path + "/GRPCClient" - -objc_library( - name = "grpc_client", - hdrs = glob([ - objc_client_path + "/*.h", - objc_client_path + "/private/*.h", - ]), - srcs = glob([ - objc_client_path + "/*.m", - objc_client_path + "/private/*.m", - ]), - includes = [objc_path], - bundles = [":gRPCCertificates"], - deps = [ - ":grpc_objc", - ":rx_library", - ], -) - -objc_bundle_library( - # The choice of name is signicant here, since it determines the bundle name. - name = "gRPCCertificates", - resources = ["etc/roots.pem"], -) - -proto_objc_rpc_path = objc_path + "/ProtoRPC" - -objc_library( - name = "proto_objc_rpc", - hdrs = glob([ - proto_objc_rpc_path + "/*.h", - ]), - srcs = glob([ - proto_objc_rpc_path + "/*.m", - ]), - includes = [objc_path], - deps = [ - ":grpc_client", - ":rx_library", - "//external:protobuf_objc", - ], -) + % for dep in get_deps(lib): + "${dep}", + % endfor + ], + ) + </%def> + + <%def name="objc_library(lib)"> + objc_library( + name = "${lib.name}_objc", + srcs = [ + % for src in lib.src: + "${src}", + % endfor + ], + hdrs = [ + % for hdr in lib.get("public_headers", []): + "${hdr}", + % endfor + % for hdr in lib.get("headers", []): + "${hdr}", + % endfor + ], + includes = [ + "include", + ".", + ], + deps = [ + % for dep in lib.get("deps", []): + ":${dep}_objc", + % endfor + % if lib.get('secure', False): + "//external:libssl_objc", + % endif + ], + % if lib.get("baselib", false): + sdk_dylibs = ["libz"], + % endif + ) + </%def> + + <%def name="cc_binary(tgt)"> + cc_binary( + name = "${tgt.name}", + srcs = [ + % for src in tgt.src: + "${src}", + % endfor + ], + deps = [ + % for dep in get_deps(tgt): + "${dep}", + % endfor + ], + ) + </%def> + + objc_path = "src/objective-c" + + rx_library_path = objc_path + "/RxLibrary" + + objc_library( + name = "rx_library", + hdrs = glob([ + rx_library_path + "/*.h", + rx_library_path + "/transformations/*.h", + ]), + srcs = glob([ + rx_library_path + "/*.m", + rx_library_path + "/transformations/*.m", + ]), + includes = [objc_path], + deps = [ + ":rx_library_private", + ], + ) + + objc_library( + name = "rx_library_private", + hdrs = glob([rx_library_path + "/private/*.h"]), + srcs = glob([rx_library_path + "/private/*.m"]), + visibility = ["//visibility:private"], + ) + + objc_client_path = objc_path + "/GRPCClient" + + objc_library( + name = "grpc_client", + hdrs = glob([ + objc_client_path + "/*.h", + objc_client_path + "/private/*.h", + ]), + srcs = glob([ + objc_client_path + "/*.m", + objc_client_path + "/private/*.m", + ]), + includes = [objc_path], + bundles = [":gRPCCertificates"], + deps = [ + ":grpc_objc", + ":rx_library", + ], + ) + + objc_bundle_library( + # The choice of name is signicant here, since it determines the bundle name. + name = "gRPCCertificates", + resources = ["etc/roots.pem"], + ) + + proto_objc_rpc_path = objc_path + "/ProtoRPC" + + objc_library( + name = "proto_objc_rpc", + hdrs = glob([ + proto_objc_rpc_path + "/*.h", + ]), + srcs = glob([ + proto_objc_rpc_path + "/*.m", + ]), + includes = [objc_path], + deps = [ + ":grpc_client", + ":rx_library", + "//external:protobuf_objc", + ], + ) diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index d675a1a7f0..060961f401 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -1,155 +1,157 @@ -# GRPC CocoaPods podspec -# This file has been automatically generated from a template file. -# Please look at the templates directory instead. -# This file can be regenerated from the template by running -# tools/buildgen/generate_projects.sh - -# Copyright 2015, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -<%! -bad_header_names = ('time.h', 'string.h') -def fix_header_name(name): - split_name = name.split('/') - if split_name[-1] in bad_header_names: - split_name[-1] = 'grpc_' + split_name[-1] - if split_name[0] == 'include': - split_name = split_name[1:] - return '/'.join(split_name) - -def grpc_files(libs): - out = [] - for lib in libs: - if lib.name in ("grpc", "gpr"): - out.extend(fix_header_name(h) for h in lib.get('headers', [])) - out.extend(fix_header_name(h) for h in lib.get('public_headers', [])) - out.extend(lib.get('src', [])) - return out; - -def grpc_private_headers(libs): - out = [] - for lib in libs: - if lib.name in ("grpc", "gpr"): - out.extend(lib.get('headers', [])) - return out -%> -Pod::Spec.new do |s| - s.name = 'gRPC' - s.version = '0.7.0' - s.summary = 'gRPC client library for iOS/OSX' - s.homepage = 'http://www.grpc.io' - s.license = 'New BSD' - s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - - # s.source = { :git => 'https://github.com/grpc/grpc.git', - # :tag => 'release-0_10_0-objectivec-0.6.0' } - - s.ios.deployment_target = '6.0' - s.osx.deployment_target = '10.8' - s.requires_arc = true - - objc_dir = 'src/objective-c' - - # Reactive Extensions library for iOS. - s.subspec 'RxLibrary' do |ss| - src_dir = "#{objc_dir}/RxLibrary" - ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" - ss.private_header_files = "#{src_dir}/private/*.h" - ss.header_mappings_dir = "#{objc_dir}" - end - - # Core cross-platform gRPC library, written in C. - s.subspec 'C-Core' do |ss| - ss.source_files = ${(',\n' + 22*' ').join('\'%s\'' % f for f in grpc_files(libs))} - - ss.private_header_files = ${(',\n' + 30*' ').join('\'%s\'' % f for f in grpc_private_headers(libs))} - - ss.header_mappings_dir = '.' - - ss.requires_arc = false - ss.libraries = 'z' - ss.dependency 'OpenSSL', '~> 1.0.200' - - # ss.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' - end - - # This is a workaround for Cocoapods Issue #1437. - # It renames time.h and string.h to grpc_time.h and grpc_string.h. - # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run - # prepare_command's of subspecs. +%YAML 1.2 +--- | + # GRPC CocoaPods podspec + # This file has been automatically generated from a template file. + # Please look at the templates directory instead. + # This file can be regenerated from the template by running + # tools/buildgen/generate_projects.sh + + # Copyright 2015, Google Inc. + # All rights reserved. # - # TODO(jcanizales): Try out others' solutions at Issue #1437. - s.prepare_command = <<-CMD - # Move contents of include up a level to avoid manually specifying include paths - cp -r "include/grpc" "." - - DIR_TIME="grpc/support" - BAD_TIME="$DIR_TIME/time.h" - GOOD_TIME="$DIR_TIME/grpc_time.h" - grep -rl "$BAD_TIME" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g - if [ -f "$BAD_TIME" ]; - then - mv -f "$BAD_TIME" "$GOOD_TIME" - fi - - DIR_STRING="src/core/support" - BAD_STRING="$DIR_STRING/string.h" - GOOD_STRING="$DIR_STRING/grpc_string.h" - grep -rl "$BAD_STRING" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g - if [ -f "$BAD_STRING" ]; - then - mv -f "$BAD_STRING" "$GOOD_STRING" - fi - CMD - - # Objective-C wrapper around the core gRPC library. - s.subspec 'GRPCClient' do |ss| - src_dir = "#{objc_dir}/GRPCClient" - ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" - ss.private_header_files = "#{src_dir}/private/*.h" - ss.header_mappings_dir = "#{objc_dir}" - - ss.dependency 'gRPC/C-Core' - ss.dependency 'gRPC/RxLibrary' - - # Certificates, to be able to establish TLS connections: - ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } - end - - # RPC library for ProtocolBuffers, based on gRPC - s.subspec 'ProtoRPC' do |ss| - src_dir = "#{objc_dir}/ProtoRPC" - ss.source_files = "#{src_dir}/*.{h,m}" - ss.header_mappings_dir = "#{objc_dir}" - - ss.dependency 'gRPC/GRPCClient' - ss.dependency 'gRPC/RxLibrary' - ss.dependency 'Protobuf', '~> 3.0.0-alpha-3' + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following disclaimer + # in the documentation and/or other materials provided with the + # distribution. + # * Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + <%! + bad_header_names = ('time.h', 'string.h') + def fix_header_name(name): + split_name = name.split('/') + if split_name[-1] in bad_header_names: + split_name[-1] = 'grpc_' + split_name[-1] + if split_name[0] == 'include': + split_name = split_name[1:] + return '/'.join(split_name) + + def grpc_files(libs): + out = [] + for lib in libs: + if lib.name in ("grpc", "gpr"): + out.extend(fix_header_name(h) for h in lib.get('headers', [])) + out.extend(fix_header_name(h) for h in lib.get('public_headers', [])) + out.extend(lib.get('src', [])) + return out; + + def grpc_private_headers(libs): + out = [] + for lib in libs: + if lib.name in ("grpc", "gpr"): + out.extend(lib.get('headers', [])) + return out + %> + Pod::Spec.new do |s| + s.name = 'gRPC' + s.version = '0.7.0' + s.summary = 'gRPC client library for iOS/OSX' + s.homepage = 'http://www.grpc.io' + s.license = 'New BSD' + s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } + + # s.source = { :git => 'https://github.com/grpc/grpc.git', + # :tag => 'release-0_10_0-objectivec-0.6.0' } + + s.ios.deployment_target = '6.0' + s.osx.deployment_target = '10.8' + s.requires_arc = true + + objc_dir = 'src/objective-c' + + # Reactive Extensions library for iOS. + s.subspec 'RxLibrary' do |ss| + src_dir = "#{objc_dir}/RxLibrary" + ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/private/*.h" + ss.header_mappings_dir = "#{objc_dir}" + end + + # Core cross-platform gRPC library, written in C. + s.subspec 'C-Core' do |ss| + ss.source_files = ${(',\n' + 22*' ').join('\'%s\'' % f for f in grpc_files(libs))} + + ss.private_header_files = ${(',\n' + 30*' ').join('\'%s\'' % f for f in grpc_private_headers(libs))} + + ss.header_mappings_dir = '.' + + ss.requires_arc = false + ss.libraries = 'z' + ss.dependency 'OpenSSL', '~> 1.0.200' + + # ss.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' + end + + # This is a workaround for Cocoapods Issue #1437. + # It renames time.h and string.h to grpc_time.h and grpc_string.h. + # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run + # prepare_command's of subspecs. + # + # TODO(jcanizales): Try out others' solutions at Issue #1437. + s.prepare_command = <<-CMD + # Move contents of include up a level to avoid manually specifying include paths + cp -r "include/grpc" "." + + DIR_TIME="grpc/support" + BAD_TIME="$DIR_TIME/time.h" + GOOD_TIME="$DIR_TIME/grpc_time.h" + grep -rl "$BAD_TIME" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g + if [ -f "$BAD_TIME" ]; + then + mv -f "$BAD_TIME" "$GOOD_TIME" + fi + + DIR_STRING="src/core/support" + BAD_STRING="$DIR_STRING/string.h" + GOOD_STRING="$DIR_STRING/grpc_string.h" + grep -rl "$BAD_STRING" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g + if [ -f "$BAD_STRING" ]; + then + mv -f "$BAD_STRING" "$GOOD_STRING" + fi + CMD + + # Objective-C wrapper around the core gRPC library. + s.subspec 'GRPCClient' do |ss| + src_dir = "#{objc_dir}/GRPCClient" + ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/private/*.h" + ss.header_mappings_dir = "#{objc_dir}" + + ss.dependency 'gRPC/C-Core' + ss.dependency 'gRPC/RxLibrary' + + # Certificates, to be able to establish TLS connections: + ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + end + + # RPC library for ProtocolBuffers, based on gRPC + s.subspec 'ProtoRPC' do |ss| + src_dir = "#{objc_dir}/ProtoRPC" + ss.source_files = "#{src_dir}/*.{h,m}" + ss.header_mappings_dir = "#{objc_dir}" + + ss.dependency 'gRPC/GRPCClient' + ss.dependency 'gRPC/RxLibrary' + ss.dependency 'Protobuf', '~> 3.0.0-alpha-3' + end end -end diff --git a/templates/src/core/surface/version.c.template b/templates/src/core/surface/version.c.template index 936341c3cf..3e6840460f 100644 --- a/templates/src/core/surface/version.c.template +++ b/templates/src/core/surface/version.c.template @@ -1,41 +1,43 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* This file is autogenerated from: - templates/src/core/surface/version.c.template */ - -#include <grpc/grpc.h> - -const char *grpc_version_string(void) { - return "${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build}"; -} +%YAML 1.2 +--- | + /* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + /* This file is autogenerated from: + templates/src/core/surface/version.c.template */ + + #include <grpc/grpc.h> + + const char *grpc_version_string(void) { + return "${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build}"; + } diff --git a/templates/tools/doxygen/Doxyfile.c++.internal.template b/templates/tools/doxygen/Doxyfile.c++.internal.template index abaf52440a..c77f1f2d95 100644 --- a/templates/tools/doxygen/Doxyfile.c++.internal.template +++ b/templates/tools/doxygen/Doxyfile.c++.internal.template @@ -1,2 +1,4 @@ -<%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ -${gen_doxyfile(['grpc++'], 'C++', libs, True)} +%YAML 1.2 +--- | + <%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ + ${gen_doxyfile(['grpc++'], 'C++', libs, True)} diff --git a/templates/tools/doxygen/Doxyfile.c++.template b/templates/tools/doxygen/Doxyfile.c++.template index 6cedfa5fe5..04f7045e5a 100644 --- a/templates/tools/doxygen/Doxyfile.c++.template +++ b/templates/tools/doxygen/Doxyfile.c++.template @@ -1,2 +1,4 @@ -<%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ -${gen_doxyfile(['grpc++'], 'C++', libs, False)} +%YAML 1.2 +--- | + <%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ + ${gen_doxyfile(['grpc++'], 'C++', libs, False)} diff --git a/templates/tools/doxygen/Doxyfile.core.internal.template b/templates/tools/doxygen/Doxyfile.core.internal.template index 8d7963aa85..05be9d81aa 100644 --- a/templates/tools/doxygen/Doxyfile.core.internal.template +++ b/templates/tools/doxygen/Doxyfile.core.internal.template @@ -1,2 +1,4 @@ -<%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ -${gen_doxyfile(['grpc', 'gpr'], 'Core', libs, True)} +%YAML 1.2 +--- | + <%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ + ${gen_doxyfile(['grpc', 'gpr'], 'Core', libs, True)} diff --git a/templates/tools/doxygen/Doxyfile.core.template b/templates/tools/doxygen/Doxyfile.core.template index 69b189fdfd..8004294ec1 100644 --- a/templates/tools/doxygen/Doxyfile.core.template +++ b/templates/tools/doxygen/Doxyfile.core.template @@ -1,2 +1,4 @@ -<%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ -${gen_doxyfile(['grpc', 'gpr'], 'Core', libs, False)} +%YAML 1.2 +--- | + <%namespace file="Doxyfile.include" import="gen_doxyfile"/>\ + ${gen_doxyfile(['grpc', 'gpr'], 'Core', libs, False)} diff --git a/templates/tools/run_tests/sources_and_headers.json.template b/templates/tools/run_tests/sources_and_headers.json.template index 1c0e04283a..6f51ed7323 100644 --- a/templates/tools/run_tests/sources_and_headers.json.template +++ b/templates/tools/run_tests/sources_and_headers.json.template @@ -1,33 +1,35 @@ -<%! -import json -import os - -def proto_headers(src): - out = [] - for f in src: - name, ext = os.path.splitext(f) - if ext == '.proto': - out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h']) - return out - -def no_protos(src): - out = [] - for f in src: - if os.path.splitext(f)[1] != '.proto': - out.append(f) - return out -%> - -${json.dumps([{"name": tgt.name, - "language": tgt.language, - "src": sorted( - no_protos(tgt.src) + - tgt.get('public_headers', []) + - tgt.get('headers', [])), - "headers": sorted( - tgt.get('public_headers', []) + - tgt.get('headers', []) + - proto_headers(tgt.src)), - "deps": sorted(tgt.get('deps', []))} - for tgt in (targets + libs)], - sort_keys=True, indent=2)} +%YAML 1.2 +--- | + <%! + import json + import os + + def proto_headers(src): + out = [] + for f in src: + name, ext = os.path.splitext(f) + if ext == '.proto': + out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h']) + return out + + def no_protos(src): + out = [] + for f in src: + if os.path.splitext(f)[1] != '.proto': + out.append(f) + return out + %> + + ${json.dumps([{"name": tgt.name, + "language": tgt.language, + "src": sorted( + no_protos(tgt.src) + + tgt.get('public_headers', []) + + tgt.get('headers', [])), + "headers": sorted( + tgt.get('public_headers', []) + + tgt.get('headers', []) + + proto_headers(tgt.src)), + "deps": sorted(tgt.get('deps', []))} + for tgt in (targets + libs)], + sort_keys=True, indent=2)} diff --git a/templates/tools/run_tests/tests.json.template b/templates/tools/run_tests/tests.json.template index 63046731de..655976ac86 100644 --- a/templates/tools/run_tests/tests.json.template +++ b/templates/tools/run_tests/tests.json.template @@ -1,13 +1,15 @@ -<%! -import json -%> - -${json.dumps([{"name": tgt.name, - "language": tgt.language, - "platforms": tgt.platforms, - "ci_platforms": tgt.ci_platforms, - "exclude_configs": tgt.get("exclude_configs", []), - "flaky": tgt.flaky} - for tgt in targets - if tgt.get('run', True) and tgt.build == 'test'], - sort_keys=True, indent=2)} +%YAML 1.2 +--- | + <%! + import json + %> + + ${json.dumps([{"name": tgt.name, + "language": tgt.language, + "platforms": tgt.platforms, + "ci_platforms": tgt.ci_platforms, + "exclude_configs": tgt.get("exclude_configs", []), + "flaky": tgt.flaky} + for tgt in targets + if tgt.get('run', True) and tgt.build == 'test'], + sort_keys=True, indent=2)} diff --git a/templates/vsprojects/Grpc.mak.template b/templates/vsprojects/Grpc.mak.template deleted file mode 100644 index 9d2f676d38..0000000000 --- a/templates/vsprojects/Grpc.mak.template +++ /dev/null @@ -1,206 +0,0 @@ -# Copyright 2015, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -<%! - import re -%>\ -<%namespace file="packages.include" import="get_openssl,get_zlib"/>\ -<%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\ -<% - build_from_project_file = set(['gpr', - 'gpr_test_util', - 'grpc', - 'grpc_test_util', - 'grpc_test_util_unsecure', - 'grpc_unsecure', - 'grpc++', - 'grpc++_unsecure' - ]) - buildable_targets = [ target for target in targets + libs - if target.build in ['all', 'test', 'private', 'tool', 'benchmark'] and - target.language in ['c', 'c++'] and - all([(src.endswith('.c') or src.endswith('.cc') or src.endswith('.proto')) for src in target.src]) and - 'windows' in target.get('platforms', ['windows']) ] - c_test_targets = [ target for target in buildable_targets if target.build == 'test' and not target.language == 'c++' ] - cxx_test_targets = [ target for target in buildable_targets if target.build == 'test' and target.language == 'c++' ] -%>\ -# NMake file to build secondary gRPC targets on Windows. -# Use grpc.sln to solution to build the gRPC libraries. - -OUT_DIR=test_bin - -CC=cl.exe /nologo -LINK=link.exe /nologo -LIBTOOL=lib.exe /nologo /nodefaultlib - -REPO_ROOT=.. -OPENSSL_INCLUDES = .\packages\${get_openssl()}\build\native\include -ZLIB_INCLUDES = .\packages\${get_zlib()}\build\native\include -INCLUDES=/I$(REPO_ROOT) /I$(REPO_ROOT)\include /I$(OPENSSL_INCLUDES) /I$(ZLIB_INCLUDES) - -GFLAGS_INCLUDES = .\..\third_party\gflags\include -GTEST_INCLUDES = .\..\third_party\gtest\include -PROTOBUF_INCLUDES = .\..\third_party\protobuf\src -CXX_INCLUDES=/I$(GFLAGS_INCLUDES) /I$(GTEST_INCLUDES) /I$(PROTOBUF_INCLUDES) - -#_SCL_SECURE_NO_WARNINGS supresses a ton of "potentially unsafe use of std lib" warnings -DEFINES=/D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /D _CRT_SECURE_NO_WARNINGS /D _SCL_SECURE_NO_WARNINGS - -#important options: /TC vs. /TP: compile as C vs. compile as C++ -CFLAGS=/c $(INCLUDES) /Z7 /W3 /WX- /sdl $(DEFINES) /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- -CXXFLAGS=/c $(INCLUDES) $(CXX_INCLUDES) /Z7 /W3 /WX- /sdl $(DEFINES) /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TP /analyze- - -LFLAGS=/DEBUG /INCREMENTAL /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 - -OPENSSL_LIBS=.\packages\${get_openssl()}\build\native\lib\v120\Win32\Debug\static\ssleay32.lib .\packages\${get_openssl()}\build\native\lib\v120\Win32\Debug\static\libeay32.lib -WINSOCK_LIBS=ws2_32.lib -GENERAL_LIBS=advapi32.lib comdlg32.lib gdi32.lib kernel32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib user32.lib uuid.lib winspool.lib -ZLIB_LIBS=.\packages\${get_zlib()}\build\native\lib\v120\Win32\Debug\static\cdecl\zlib.lib -LIBS=$(OPENSSL_LIBS) $(ZLIB_LIBS) $(GENERAL_LIBS) $(WINSOCK_LIBS) - -#shlwapi.lib provides PathMatchSpec() for gflags in windows -GFLAGS_LIBS=.\..\third_party\gflags\lib\Debug\gflags.lib shlwapi.lib -GTEST_LIBS=.\..\third_party\gtest\msvc\gtest\Debug\gtestd.lib -PROTOBUF_LIBS=.\..\third_party\protobuf\vsprojects\Debug\libprotobuf.lib -CXX_LIBS=$(GFLAGS_LIBS) $(GTEST_LIBS) $(PROTOBUF_LIBS) - -all: buildtests - -tools: - -tools_c: - -tools_cxx: - -$(OUT_DIR): - mkdir $(OUT_DIR) - -build_libs: \ -% for target in buildable_targets: -% if target.build == 'private' or target.build == 'all': -% if target.name in build_from_project_file: -build_${target.name} \ -% else: -Debug\${target.name}.lib \ -% endif -% endif -% endfor - -buildtests: buildtests_c buildtests_cxx - -buildtests_c: \ -% for target in c_test_targets: -${target.name}.exe \ -% endfor - - echo All C tests built. - -buildtests_cxx: \ -% for target in cxx_test_targets: -${target.name}.exe \ -% endfor - - echo All C++ tests built. - -% for target in buildable_targets: - -## replace all .proto includes with .pb.cc / .grpc.pb.cc -%if target.src: -%for source in target.src: -%if source.endswith(".proto"): -<% - src_name_parts = source.split(".") - target.src.append(src_name_parts[0] + ".pb.cc") - target.src.append(src_name_parts[0] + ".grpc.pb.cc") -%>\ -%endif -%endfor -%endif -## remove all .proto includes -<% - target.src = [item for item in target.src if not re.search('([^/]+)\.proto$', item)] -%>\ -%if target.name in build_from_project_file: -build_${target.name}: - msbuild grpc.sln /t:${target.name} /p:Configuration=Debug /p:Linkage-grpc_dependencies_zlib=static -%else: -%if target.build == 'private': -Debug\${target.name}.lib: \ -%else: -${target.name}.exe: \ -%for dep in target.get('deps', []): -%if dep in build_from_project_file: -build_${dep} \ -%else: -Debug\${dep}.lib \ -%endif -%endfor -%endif -$(OUT_DIR) - echo Building ${target.name} -%if target.language == 'c++': - $(CC) $(CXXFLAGS) /Fo:$(OUT_DIR)\ \ -%else: - $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ \ -%endif -%for source in target.src: -$(REPO_ROOT)\${to_windows_path(source)} \ -%endfor -%if not target.src: -$(REPO_ROOT)\${to_windows_path('vsprojects/dummy.c')} \ -%endif - -%if target.build == 'private': - $(LIBTOOL) /OUT:"Debug\${target.name}.lib" \ -%else: - $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\${target.name}.exe" \ -%for dep in target.get('deps', []): -Debug\${dep}.lib \ -%endfor -%if target.language == 'c++': -$(CXX_LIBS) \ -%endif -$(LIBS) \ -%endif -%if not target.src: -$(OUT_DIR)\dummy.obj \ -%else: -%for source in target.src: -%if re.search('([^/]+)\.c{1,2}$', source): -$(OUT_DIR)\${re.search('([^/]+)\.c{1,2}$', source).group(1)}.obj \ -%endif -%endfor -%endif - -%if target.build != 'private': -${target.name}: ${target.name}.exe - echo Running ${target.name} - $(OUT_DIR)\${target.name}.exe -%endif -%endif -% endfor diff --git a/templates/vsprojects/buildtests_c.sln.template b/templates/vsprojects/buildtests_c.sln.template new file mode 100644 index 0000000000..eb314a3097 --- /dev/null +++ b/templates/vsprojects/buildtests_c.sln.template @@ -0,0 +1,7 @@ +%YAML 1.2 +--- | + <%namespace file="sln_defs.include" import="gen_solution"/>\ + <% + solution_projects = [p for p in vsprojects if p.build != 'protoc' and p.language in ['c', 'c++'] and not (p.language == 'c++' and p.build in ['private', 'test'])] + %>\ + ${gen_solution(solution_projects, use_dlls='yes')} diff --git a/templates/vsprojects/cpptest.props.template b/templates/vsprojects/cpptest.props.template new file mode 100644 index 0000000000..14169d6ddf --- /dev/null +++ b/templates/vsprojects/cpptest.props.template @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(SolutionDir)\..;$(SolutionDir)\..\include;$(SolutionDir)\..\third_party\protobuf\src;$(SolutionDir)\..\third_party\gtest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <WarningLevel>EnableAllWarnings</WarningLevel> + </ClCompile> + <Link> + <AdditionalDependencies>grpc++_test_util.lib;grpc_test_util.lib;gpr_test_util.lib;gtestd.lib;gflags.lib;shlwapi.lib;gpr.lib;grpc.lib;grpc++.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(SolutionDir)\..\third_party\gtest\msvc\gtest\Debug;$(SolutionDir)\..\third_party\gflags\lib\Debug;$(SolutionDir)\..\Debug;$(SolutionDir)\..\packages\grpc.dependencies.openssl.${vspackages_dict['grpc.dependencies.openssl'].version}\build\native\lib\$(PlatformToolset)\$(Platform)\$(Configuration)\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup /> +</Project> diff --git a/templates/vsprojects/global.props.template b/templates/vsprojects/global.props.template new file mode 100644 index 0000000000..d28b239547 --- /dev/null +++ b/templates/vsprojects/global.props.template @@ -0,0 +1,16 @@ +%YAML 1.2 +--- | + <?xml version="1.0" encoding="utf-8"?> + <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(SolutionDir)\..;$(SolutionDir)\..\include;$(SolutionDir)\..\third_party\protobuf\src;${';'.join('$(SolutionDir)\\packages\\%s.%s\\build\\native\\include' % (p.name, p.version) for p in vspackages)};%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <WarningLevel>EnableAllWarnings</WarningLevel> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup /> + </Project> diff --git a/templates/vsprojects/gpr/gpr.vcxproj.filters.template b/templates/vsprojects/gpr/gpr.vcxproj.filters.template deleted file mode 100644 index 779a36bf0f..0000000000 --- a/templates/vsprojects/gpr/gpr.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('gpr', libs)} diff --git a/templates/vsprojects/gpr/gpr.vcxproj.template b/templates/vsprojects/gpr/gpr.vcxproj.template deleted file mode 100644 index ca217c2762..0000000000 --- a/templates/vsprojects/gpr/gpr.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('gpr', libs)} diff --git a/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template b/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template deleted file mode 100644 index d412d646e7..0000000000 --- a/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('gpr_test_util', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template b/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template deleted file mode 100644 index 70e0a6c13b..0000000000 --- a/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc++', libs)} diff --git a/templates/vsprojects/grpc++/grpc++.vcxproj.template b/templates/vsprojects/grpc++/grpc++.vcxproj.template deleted file mode 100644 index 5f13591b2d..0000000000 --- a/templates/vsprojects/grpc++/grpc++.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc++', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template index 465a3d76f5..99f707ad41 100644 --- a/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template +++ b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc++_unsecure', libs)} +%YAML 1.2 +--- | + <%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ + ${gen_filters('grpc++_unsecure', libs)} diff --git a/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template index 62016ccc0a..a6a7b2c108 100644 --- a/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template +++ b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc++_unsecure', libs)}
\ No newline at end of file +%YAML 1.2 +--- | + <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ + ${gen_project('grpc++_unsecure', libs)} diff --git a/templates/vsprojects/grpc.sln.template b/templates/vsprojects/grpc.sln.template index 5c5e28c885..dbbb2c2ad1 100644 --- a/templates/vsprojects/grpc.sln.template +++ b/templates/vsprojects/grpc.sln.template @@ -1,5 +1,7 @@ -<%namespace file="sln_defs.include" import="gen_solution"/>\ -<% -solution_projects = [p for p in vsprojects if p.build != 'protoc' and p.language in ['c', 'c++']] -%>\ -${gen_solution(solution_projects, use_dlls='yes')}
\ No newline at end of file +%YAML 1.2 +--- | + <%namespace file="sln_defs.include" import="gen_solution"/>\ + <% + solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++')] + %>\ + ${gen_solution(solution_projects, use_dlls='yes')} diff --git a/templates/vsprojects/grpc/grpc.vcxproj.filters.template b/templates/vsprojects/grpc/grpc.vcxproj.filters.template deleted file mode 100644 index 9607d23324..0000000000 --- a/templates/vsprojects/grpc/grpc.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc', libs)} diff --git a/templates/vsprojects/grpc/grpc.vcxproj.template b/templates/vsprojects/grpc/grpc.vcxproj.template deleted file mode 100644 index a19214e0a4..0000000000 --- a/templates/vsprojects/grpc/grpc.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, packages=['openssl','zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/grpc/packages.config.template b/templates/vsprojects/grpc/packages.config.template deleted file mode 100644 index 66ac90eb08..0000000000 --- a/templates/vsprojects/grpc/packages.config.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../packages.include" import="gen_packages_config"/>\ -${gen_packages_config(['openssl','zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_cpp_plugin/grpc_cpp_plugin.vcxproj.template b/templates/vsprojects/grpc_cpp_plugin/grpc_cpp_plugin.vcxproj.template index 49ab1b7385..980bc589e4 100644 --- a/templates/vsprojects/grpc_cpp_plugin/grpc_cpp_plugin.vcxproj.template +++ b/templates/vsprojects/grpc_cpp_plugin/grpc_cpp_plugin.vcxproj.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_cpp_plugin', targets, configuration_type='Application')} +%YAML 1.2 +--- | + <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ + ${gen_project('grpc_cpp_plugin', targets)} diff --git a/templates/vsprojects/grpc_csharp_ext.sln.template b/templates/vsprojects/grpc_csharp_ext.sln.template index eb33ce2eb6..1013d7bd97 100644 --- a/templates/vsprojects/grpc_csharp_ext.sln.template +++ b/templates/vsprojects/grpc_csharp_ext.sln.template @@ -1,5 +1,7 @@ -<%namespace file="sln_defs.include" import="gen_solution"/>\ -<% -solution_projects = [p for p in vsprojects if p.build == 'all' and p.language in ['c', 'csharp']] -%>\ -${gen_solution(solution_projects, use_dlls='only')}
\ No newline at end of file +%YAML 1.2 +--- | + <%namespace file="sln_defs.include" import="gen_solution"/>\ + <% + solution_projects = [p for p in vsprojects if p.build == 'all' and p.language in ['c', 'csharp']] + %>\ + ${gen_solution(solution_projects, use_dlls='only')} diff --git a/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template b/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template deleted file mode 100644 index 25b02b8c82..0000000000 --- a/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_csharp_ext', libs, configuration_type = 'DynamicLibrary', props=['zlib-dll'], packages=['openssl','zlib'])} diff --git a/templates/vsprojects/grpc_csharp_ext/packages.config.template b/templates/vsprojects/grpc_csharp_ext/packages.config.template deleted file mode 100644 index 4953b6451c..0000000000 --- a/templates/vsprojects/grpc_csharp_ext/packages.config.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../packages.include" import="gen_packages_config"/>\ -${gen_packages_config(['openssl','zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_csharp_plugin/grpc_csharp_plugin.vcxproj.template b/templates/vsprojects/grpc_csharp_plugin/grpc_csharp_plugin.vcxproj.template index 9d94e27c3a..2c677d7f75 100644 --- a/templates/vsprojects/grpc_csharp_plugin/grpc_csharp_plugin.vcxproj.template +++ b/templates/vsprojects/grpc_csharp_plugin/grpc_csharp_plugin.vcxproj.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_csharp_plugin', targets, configuration_type='Application')} +%YAML 1.2 +--- | + <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ + ${gen_project('grpc_csharp_plugin', targets)} diff --git a/templates/vsprojects/grpc_objective_c_plugin/grpc_objective_c_plugin.vcxproj.template b/templates/vsprojects/grpc_objective_c_plugin/grpc_objective_c_plugin.vcxproj.template index 794c7310c5..a31f3e383a 100644 --- a/templates/vsprojects/grpc_objective_c_plugin/grpc_objective_c_plugin.vcxproj.template +++ b/templates/vsprojects/grpc_objective_c_plugin/grpc_objective_c_plugin.vcxproj.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_objective_c_plugin', targets, configuration_type='Application')} +%YAML 1.2 +--- | + <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ + ${gen_project('grpc_objective_c_plugin', targets)} diff --git a/templates/vsprojects/grpc_plugin_support/grpc_plugin_support.vcxproj.template b/templates/vsprojects/grpc_plugin_support/grpc_plugin_support.vcxproj.template deleted file mode 100644 index 409e88f289..0000000000 --- a/templates/vsprojects/grpc_plugin_support/grpc_plugin_support.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_plugin_support', libs)} diff --git a/templates/vsprojects/grpc_protoc_plugins.sln.template b/templates/vsprojects/grpc_protoc_plugins.sln.template index 1c171f4f94..06f182b601 100644 --- a/templates/vsprojects/grpc_protoc_plugins.sln.template +++ b/templates/vsprojects/grpc_protoc_plugins.sln.template @@ -1,5 +1,7 @@ -<%namespace file="sln_defs.include" import="gen_solution"/>\ -<% -solution_projects = [p for p in vsprojects if p.build == 'protoc'] -%>\ -${gen_solution(solution_projects)}
\ No newline at end of file +%YAML 1.2 +--- | + <%namespace file="sln_defs.include" import="gen_solution"/>\ + <% + solution_projects = [p for p in vsprojects if p.build == 'protoc'] + %>\ + ${gen_solution(solution_projects)} diff --git a/templates/vsprojects/grpc_python_plugin/grpc_python_plugin.vcxproj.template b/templates/vsprojects/grpc_python_plugin/grpc_python_plugin.vcxproj.template index 977e015d6d..c2ef396842 100644 --- a/templates/vsprojects/grpc_python_plugin/grpc_python_plugin.vcxproj.template +++ b/templates/vsprojects/grpc_python_plugin/grpc_python_plugin.vcxproj.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_python_plugin', targets, configuration_type='Application')} +%YAML 1.2 +--- | + <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ + ${gen_project('grpc_python_plugin', targets)} diff --git a/templates/vsprojects/grpc_ruby_plugin/grpc_ruby_plugin.vcxproj.template b/templates/vsprojects/grpc_ruby_plugin/grpc_ruby_plugin.vcxproj.template index ecf42ae04e..e7c094f5f9 100644 --- a/templates/vsprojects/grpc_ruby_plugin/grpc_ruby_plugin.vcxproj.template +++ b/templates/vsprojects/grpc_ruby_plugin/grpc_ruby_plugin.vcxproj.template @@ -1,2 +1,4 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_ruby_plugin', targets, configuration_type='Application')} +%YAML 1.2 +--- | + <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ + ${gen_project('grpc_ruby_plugin', targets)} diff --git a/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template b/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template deleted file mode 100644 index 3781023837..0000000000 --- a/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_test_util', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.template b/templates/vsprojects/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.template deleted file mode 100644 index 98c5f500f5..0000000000 --- a/templates/vsprojects/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_test_util_unsecure', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template b/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template deleted file mode 100644 index aef6465915..0000000000 --- a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc_unsecure', libs)} diff --git a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template b/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template deleted file mode 100644 index fd827d191a..0000000000 --- a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_unsecure', libs, packages=['zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_unsecure/packages.config.template b/templates/vsprojects/grpc_unsecure/packages.config.template deleted file mode 100644 index 1337b5df2b..0000000000 --- a/templates/vsprojects/grpc_unsecure/packages.config.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="../packages.include" import="gen_packages_config"/>\ -${gen_packages_config(['zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/openssl.props.template b/templates/vsprojects/openssl.props.template new file mode 100644 index 0000000000..32c3604405 --- /dev/null +++ b/templates/vsprojects/openssl.props.template @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ImportGroup Label="PropertySheets" />
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup>
+ <Link>
+ <AdditionalDependencies>ssleay32.lib;libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(SolutionDir)\packages\grpc.dependencies.openssl.${vspackages_dict['grpc.dependencies.openssl'].version}\build\native\lib\$(PlatformToolset)\$(Platform)\$(Configuration)\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup />
+</Project>
diff --git a/templates/vsprojects/packages.include b/templates/vsprojects/packages.include index 2eba362179..f3c57634f9 100644 --- a/templates/vsprojects/packages.include +++ b/templates/vsprojects/packages.include @@ -1,54 +1,53 @@ -<%! - openssl_pkg_name = "grpc.dependencies.openssl" - openssl_pkg_version = "1.0.2.2" - zlib_pkg_name = "grpc.dependencies.zlib" - zlib_pkg_version = "1.2.8.9" -%>\ -<%def name="get_openssl()">${openssl_pkg_name}.${openssl_pkg_version}</%def>\ -<%def name="get_zlib()">${zlib_pkg_name}.${zlib_pkg_version}</%def>\ +<%def name="get_name(vspackages, package)">${''.join('%s.%s' % (p.name, p.version) for p in vspackages if p.name == package)}</%def> <%def name="gen_packages_config(packages)">\ <?xml version="1.0" encoding="utf-8"?> <packages> - % if 'openssl' in packages: - <package id="${openssl_pkg_name}" version="${openssl_pkg_version}" targetFramework="Native" /> - <package id="${openssl_pkg_name}.redist" version="${openssl_pkg_version}" targetFramework="Native" /> - % endif - % if 'zlib' in packages: - <package id="${zlib_pkg_name}" version="${zlib_pkg_version}" targetFramework="Native" /> - <package id="${zlib_pkg_name}.redist" version="${zlib_pkg_version}" targetFramework="Native" /> - % endif + % for package in vspackages: + % if packages == 'all' or package.name in packages: + <package id="${package.name}" version="${package.version}" targetFramework="Native" /> + % if package.redist: + <package id="${package.name}.redist" version="${package.version}" targetFramework="Native" /> + % endif + % endif + % endfor </packages> </%def>\ -<%def name="gen_package_props(packages)">\ -% if 'openssl' in packages: - <Import Project="..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.props" Condition="Exists('..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.props')" /> -% endif +<%def name="gen_package_props(packages, repo_root)">\ + % for package in vspackages: + % if packages == 'all' or package.name in packages: + % if package.props: + <Import Project="${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\${package.name}.props" Condition="Exists('${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\${package.version}.props')" /> + % endif + % endif + % endfor </%def>\ -<%def name="gen_package_targets(packages)">\ - % if 'zlib' in packages: - <Import Project="..\packages\${zlib_pkg_name}.redist.${zlib_pkg_version}\build\native\${zlib_pkg_name}.redist.targets" Condition="Exists('..\packages\${zlib_pkg_name}.redist.${zlib_pkg_version}\build\native\${zlib_pkg_name}.redist.targets')" /> - <Import Project="..\packages\${zlib_pkg_name}.${zlib_pkg_version}\build\native\${zlib_pkg_name}.targets" Condition="Exists('..\packages\${zlib_pkg_name}.${zlib_pkg_version}\build\native\${zlib_pkg_name}.targets')" /> - %endif - % if 'openssl' in packages: - <Import Project="..\packages\${openssl_pkg_name}.redist.${openssl_pkg_version}\build\native\${openssl_pkg_name}.redist.targets" Condition="Exists('..\packages\${openssl_pkg_name}.redist.${openssl_pkg_version}\build\native\${openssl_pkg_name}.redist.targets')" /> - <Import Project="..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.targets" Condition="Exists('..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.targets')" /> - % endif +<%def name="gen_package_targets(packages, repo_root)">\ + % for package in vspackages: + % if packages == 'all' or package.name in packages: + % if package.redist: + <Import Project="${repo_root}\vsprojects\packages\${package.name}.redist.${package.version}\build\native\${package.name}.redist.targets" Condition="Exists('${repo_root}\vsprojects\packages\${package.name}.redist.${package.version}\build\native\grpc.dependencies\${package.name}.targets')" /> + % endif + <Import Project="${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\${package.name}.targets" Condition="Exists('${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\grpc.dependencies\${package.name}.targets')" /> + % endif + % endfor </%def>\ -<%def name="gen_package_ensure(packages)">\ - % if packages: +<%def name="check_file_inner(file)"><Error Condition="!Exists('${file}')" Text="$([System.String]::Format('$(ErrorText)', '${file}')" /></%def>\ +<%def name="check_file(file, repo_root, package)">${check_file_inner(file % {'root':repo_root, 'name':package.name, 'version':package.version})}</%def>\ +<%def name="gen_package_ensure(packages, repo_root)">\ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> </PropertyGroup> - % if 'zlib' in packages: - <Error Condition="!Exists('..\packages\${zlib_pkg_name}.redist.${zlib_pkg_version}\build\native\${zlib_pkg_name}.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\${zlib_pkg_name}.redist.${zlib_pkg_version}\build\native\${zlib_pkg_name}.redist.targets'))" /> - <Error Condition="!Exists('..\packages\${zlib_pkg_name}.${zlib_pkg_version}\build\native\${zlib_pkg_name}.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\${zlib_pkg_name}.${zlib_pkg_version}\build\native\${zlib_pkg_name}.targets'))" /> - %endif - % if 'openssl' in packages: - <Error Condition="!Exists('..\packages\${openssl_pkg_name}.redist.${openssl_pkg_version}\build\native\${openssl_pkg_name}.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\${openssl_pkg_name}.redist.${openssl_pkg_version}\build\native\${openssl_pkg_name}.redist.targets'))" /> - <Error Condition="!Exists('..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.props'))" /> - <Error Condition="!Exists('..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\${openssl_pkg_name}.${openssl_pkg_version}\build\native\${openssl_pkg_name}.targets'))" /> - %endif + % for package in vspackages: + % if packages == 'all' or package.name in packages: + % if package.redist: + ${check_file('%(root)s\\vsprojects\\packages\\%(name)s.redist.%(version)s\\build\\native\\%(name)s.redist.targets', repo_root, package)} + % endif + % if package.props: + ${check_file('%(root)s\\vsprojects\\packages\\%(name)s.%(version)s\\build\\native\\%(name)s.props', repo_root, package)} + % endif + ${check_file('%(root)s\\vsprojects\\packages\\%(name)s.%(version)s\\build\\native\\%(name)s.targets', repo_root, package)} + % endif + % endfor </Target> - %endif </%def>\ diff --git a/templates/vsprojects/protobuf.props.template b/templates/vsprojects/protobuf.props.template new file mode 100644 index 0000000000..48f9431c1c --- /dev/null +++ b/templates/vsprojects/protobuf.props.template @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ImportGroup Label="PropertySheets" />
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup>
+ <Link>
+ <AdditionalDependencies>libprotobuf.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(SolutionDir)\..\third_party\protobuf\cmake\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup />
+</Project>
diff --git a/templates/vsprojects/protoc.props.template b/templates/vsprojects/protoc.props.template new file mode 100644 index 0000000000..a869005dae --- /dev/null +++ b/templates/vsprojects/protoc.props.template @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ImportGroup Label="PropertySheets" />
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup>
+ <Link>
+ <AdditionalDependencies>libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(SolutionDir)\..\third_party\protobuf\cmake\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup />
+</Project>
diff --git a/templates/vsprojects/sln_defs.include b/templates/vsprojects/sln_defs.include index 224f2cd1d5..a0489411c6 100644 --- a/templates/vsprojects/sln_defs.include +++ b/templates/vsprojects/sln_defs.include @@ -14,7 +14,7 @@ MinimumVisualStudioVersion = 10.0.40219.1 cpp_proj_type = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" %>\ % for project in solution_projects: -Project("${cpp_proj_type}") = "${project.name}", "${project.name}\${project.name}.vcxproj", "${project.vs_project_guid}" +Project("${cpp_proj_type}") = "${project.name}", "vcxproj\${project.vs_proj_dir}\${project.name}\${project.name}.vcxproj", "${project.vs_project_guid}" ProjectSection(myProperties) = preProject % if project.is_library: lib = "True" @@ -53,7 +53,7 @@ Global ${project.vs_project_guid}.Debug|x64.ActiveCfg = Debug|x64 ${project.vs_project_guid}.Release|Win32.ActiveCfg = Release|Win32 ${project.vs_project_guid}.Release|x64.ActiveCfg = Release|x64 - % if project.get('dll', 'no') != 'only': + % if project.get('dll', False) != 'only': ${project.vs_project_guid}.Debug|Win32.Build.0 = Debug|Win32 ${project.vs_project_guid}.Debug|x64.Build.0 = Debug|x64 ${project.vs_project_guid}.Release|Win32.Build.0 = Release|Win32 @@ -61,7 +61,7 @@ Global % endif % endif % if use_dlls == 'yes': - % if project.get('dll', 'no') == 'no': + % if project.get('dll', False) == False: ${project.vs_project_guid}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 ${project.vs_project_guid}.Debug-DLL|Win32.Build.0 = Debug|Win32 ${project.vs_project_guid}.Debug-DLL|x64.ActiveCfg = Debug|x64 @@ -82,7 +82,7 @@ Global % endif % endif % if use_dlls == 'only': - % if project.get('dll', 'no') == 'yes': + % if project.get('dll', False) == True: ${project.vs_project_guid}.Debug|Win32.ActiveCfg = Debug-DLL|Win32 ${project.vs_project_guid}.Debug|Win32.Build.0 = Debug-DLL|Win32 ${project.vs_project_guid}.Debug|x64.ActiveCfg = Debug-DLL|x64 diff --git a/templates/vsprojects/vcxproj.filters_defs.include b/templates/vsprojects/vcxproj.filters_defs.include index 787d66eeff..d1ebb56709 100644 --- a/templates/vsprojects/vcxproj.filters_defs.include +++ b/templates/vsprojects/vcxproj.filters_defs.include @@ -5,7 +5,7 @@ def calc_to_filter(path): return '\\'.join(path.split('/')[:-1]) %>\ -<%def name="get_repo_root()">..\..</%def>\ +<%def name="get_repo_root(proj)">${'..\..\..' + ('\..' if proj.vs_proj_dir != '.' else '')}</%def>\ <%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\ <%def name="to_filter(path)">${calc_to_filter(path)}</%def>\ <%def name="filter_to_guid(proj, filter)">${re.sub('(........)(....)(....)(....)', r'\1-\2-\3-\4-', hashlib.md5(''.join([filter, proj])).hexdigest())}</%def>\ @@ -17,7 +17,7 @@ % if project.get('src',[]): <ItemGroup> % for src_name in project.src: - <ClCompile Include="${get_repo_root()}\${to_windows_path(src_name)}"> + <ClCompile Include="${get_repo_root(project)}\${to_windows_path(src_name)}"> <Filter>${to_filter(src_name)}</Filter> </ClCompile> % endfor @@ -26,7 +26,7 @@ % if project.get('public_headers',[]): <ItemGroup> % for public_header in project.public_headers: - <ClInclude Include="${get_repo_root()}\${to_windows_path(public_header)}"> + <ClInclude Include="${get_repo_root(project)}\${to_windows_path(public_header)}"> <Filter>${to_filter(public_header)}</Filter> </ClInclude> % endfor @@ -35,7 +35,7 @@ % if project.get('headers',[]): <ItemGroup> % for header in project.headers: - <ClInclude Include="${get_repo_root()}\${to_windows_path(header)}"> + <ClInclude Include="${get_repo_root(project)}\${to_windows_path(header)}"> <Filter>${to_filter(header)}</Filter> </ClInclude> % endfor diff --git a/templates/vsprojects/vcxproj.template b/templates/vsprojects/vcxproj.template new file mode 100644 index 0000000000..ecf113b4a8 --- /dev/null +++ b/templates/vsprojects/vcxproj.template @@ -0,0 +1,18 @@ +%YAML 1.2 +--- +foreach: vsprojects +output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj +template: | + <%namespace file="vcxproj_defs.include" import="gen_project"/>\ + ${gen_project(selected.name, vsprojects)} +--- +foreach: vsprojects +output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj.filters +template: | + <%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ + ${gen_filters(selected.name, vsprojects)} +--- +output_name: grpc/packages.config +template: | + <%namespace file="packages.include" import="gen_packages_config"/>\ + ${gen_packages_config('all')} diff --git a/templates/vsprojects/vcxproj_defs.include b/templates/vsprojects/vcxproj_defs.include index 507c9a5204..17fbf56232 100644 --- a/templates/vsprojects/vcxproj_defs.include +++ b/templates/vsprojects/vcxproj_defs.include @@ -1,8 +1,7 @@ <%namespace file="packages.include" import="gen_package_props,gen_package_targets,gen_package_ensure"/>\ -<%def name="get_repo_root()">..\..</%def>\ <%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\ <%def name="get_subsystem(is_library)">${'Windows' if is_library else 'Console'}</%def>\ -<%def name="gen_project(name, collection, configuration_type = None, project_guid = None, props = [], packages = [])">\ +<%def name="gen_project(name, collection)">\ <% target = None for p in vsprojects: @@ -11,31 +10,36 @@ for t in collection: if t.name == name: target = t - if not configuration_type and target: - print target.name - if target.build == 'test' or target.build == 'tool': - configuration_type = 'Application' - if not configuration_type: - configuration_type = 'StaticLibrary' - if not project_guid: - project_guid = project.vs_project_guid + props = project.vs_props + packages = project.vs_packages + configuration_type = project.vs_config_type + project_guid = project.vs_project_guid if target.build == 'test' and target.language == 'c++': props.extend(['cpptest']) if configuration_type == 'Application': if target.build == 'protoc': - props.extend(['protoc']) + props.extend(['protoc', 'protobuf']) else: - props.extend(['winsock', 'protobuf', 'zlib', 'openssl']) + if target.language == 'c++': + props.extend(['protobuf']) + props.extend(['winsock', 'zlib']) + packages.extend(['grpc.dependencies.zlib']) + if target.get('secure', 'check'): + props.extend(['openssl']) + packages.extend(['grpc.dependencies.openssl']) else: props.extend(['winsock']) props.extend(['global']) - dll = project.get('dll', 'no') + props = sorted(list(set(props))) + packages = sorted(list(set(packages))) + dll = project.get('dll', False) + repo_root = '..\..\..' + ('\..' if project.vs_proj_dir != '.' else '') %>\ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> -${gen_package_props(packages)}\ +${gen_package_props(packages, repo_root)}\ <ItemGroup Label="ProjectConfigurations"> -% if dll == 'yes': +% if dll and dll != 'only': <ProjectConfiguration Include="Debug-DLL|Win32"> <Configuration>Debug-DLL</Configuration> <Platform>Win32</Platform> @@ -94,7 +98,7 @@ ${gen_package_props(packages)}\ <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> -% if dll == 'yes': +% if dll and dll != 'only': <PropertyGroup Condition="'$(Configuration)'=='Debug-DLL'" Label="Configuration"> <ConfigurationType>${configuration_type}</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> @@ -113,31 +117,24 @@ ${gen_package_props(packages)}\ <ImportGroup Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> % for prop in props: - <Import Project="..\${prop}.props" /> + <Import Project="${repo_root}\vsprojects\${prop}.props" /> % endfor </ImportGroup> <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)'=='Debug'"> +% for config in ['Debug', 'Release']:# + (['Debug-DLL', 'Release-DLL'] if dll and dll != 'only' else []): + <PropertyGroup Condition="'$(Configuration)'=='${config}'"> <TargetName>${name}</TargetName> - % if "zlib" in packages: - <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> - <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> - % endif - % if "openssl" in packages: - <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> - % endif - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)'=='Release'"> - <TargetName>${name}</TargetName> - % if "zlib" in packages: - <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> - <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> - % endif - % if "openssl" in packages: - <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> - % endif + % for package in vspackages: + % if packages == 'all' or package.name in packages: + % if package.get('linkage', None) is not None: + <Linkage-${package.name.replace('.', '_')}>${package.linkage}</Linkage-${package.name.replace('.', '_')}> + % endif + <Configuration-${package.name.replace('.', '_')}>Debug</Configuration-${package.name.replace('.', '_')}> + % endif + % endfor </PropertyGroup> - % if dll == 'yes': +% endfor + % if dll and dll != 'only': <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|Win32'"> <ClCompile> <PrecompiledHeader>NotUsing</PrecompiledHeader> @@ -270,14 +267,14 @@ ${gen_package_props(packages)}\ % if project.get('public_headers',[]): <ItemGroup> % for public_header in project.public_headers: - <ClInclude Include="${get_repo_root()}\${to_windows_path(public_header)}" /> + <ClInclude Include="${repo_root}\${to_windows_path(public_header)}" /> % endfor </ItemGroup> % endif % if project.get('headers',[]): <ItemGroup> % for header in project.headers: - <ClInclude Include="${get_repo_root()}\${to_windows_path(header)}" /> + <ClInclude Include="${repo_root}\${to_windows_path(header)}" /> % endfor </ItemGroup> % endif @@ -286,30 +283,30 @@ ${gen_package_props(packages)}\ % for src_name in project.src: % if src_name.endswith(".proto"): <% src_name_parts = src_name.split(".") %>\ - <ClCompile Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".pb.cc")}"> + <ClCompile Include="${repo_root}\${to_windows_path(src_name_parts[0] + ".pb.cc")}"> </ClCompile> - <ClInclude Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".pb.h")}"> + <ClInclude Include="${repo_root}\${to_windows_path(src_name_parts[0] + ".pb.h")}"> </ClInclude> - <ClCompile Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".grpc.pb.cc")}"> + <ClCompile Include="${repo_root}\${to_windows_path(src_name_parts[0] + ".grpc.pb.cc")}"> </ClCompile> - <ClInclude Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".grpc.pb.h")}"> + <ClInclude Include="${repo_root}\${to_windows_path(src_name_parts[0] + ".grpc.pb.h")}"> </ClInclude> % else: - <ClCompile Include="${get_repo_root()}\${to_windows_path(src_name)}"> + <ClCompile Include="${repo_root}\${to_windows_path(src_name)}"> </ClCompile> % endif % endfor </ItemGroup> % elif configuration_type != 'StaticLibrary': <ItemGroup> - <ClCompile Include="${get_repo_root()}\${to_windows_path('vsprojects/dummy.c')}"> + <ClCompile Include="${repo_root}\${to_windows_path('vsprojects/dummy.c')}"> </ClCompile> </ItemGroup> % endif % if project.get('deps',[]): <ItemGroup> % for dep in project.deps: - <ProjectReference Include="..\${dep}\${dep}.vcxproj"> + <ProjectReference Include="${repo_root}\vsprojects\vcxproj\${vsproject_dict[dep].vs_proj_dir}\${dep}\${dep}.vcxproj"> <Project>${vsproject_dict[dep].vs_project_guid}</Project> </ProjectReference> % endfor @@ -322,8 +319,8 @@ ${gen_package_props(packages)}\ %endif <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> -${gen_package_targets(packages)}\ +${gen_package_targets(packages, repo_root)}\ </ImportGroup> -${gen_package_ensure(packages)}\ +${gen_package_ensure(packages, repo_root)}\ </Project> </%def>\ diff --git a/templates/vsprojects/winsock.props.template b/templates/vsprojects/winsock.props.template new file mode 100644 index 0000000000..7db6731bd3 --- /dev/null +++ b/templates/vsprojects/winsock.props.template @@ -0,0 +1,14 @@ +%YAML 1.2 +--- | + <?xml version="1.0" encoding="utf-8"?> + <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemGroup /> + </Project>
\ No newline at end of file diff --git a/templates/vsprojects/zlib-dll.props.template b/templates/vsprojects/zlib-dll.props.template new file mode 100644 index 0000000000..eb83ca7c0a --- /dev/null +++ b/templates/vsprojects/zlib-dll.props.template @@ -0,0 +1,15 @@ +%YAML 1.2 +--- | + <?xml version="1.0" encoding="utf-8"?> + <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <Link> + <AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(SolutionDir)\packages\grpc.dependencies.zlib.${vspackages_dict['grpc.dependencies.zlib'].version}\build\native\lib\$(PlatformToolset)\$(Platform)\$(Configuration)\dynamic\cdecl;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup /> + </Project> diff --git a/templates/vsprojects/zlib.props.template b/templates/vsprojects/zlib.props.template new file mode 100644 index 0000000000..d14a3942b7 --- /dev/null +++ b/templates/vsprojects/zlib.props.template @@ -0,0 +1,15 @@ +%YAML 1.2 +--- | + <?xml version="1.0" encoding="utf-8"?> + <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <Link> + <AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(SolutionDir)\packages\grpc.dependencies.zlib.${vspackages_dict['grpc.dependencies.zlib'].version}\build\native\lib\$(PlatformToolset)\$(Platform)\$(Configuration)\static\cdecl;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup /> + </Project> |