diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ca7686384a..5dffa1090e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -53,7 +53,6 @@ jobs: env: - { FLAVOR: cs } - { FLAVOR: cpp-core, BOOST: 1.66.0, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.66.0, COMPILER: clang } - { FLAVOR: hs } - { FLAVOR: java } diff --git a/.github/workflows/linux_cron.yml b/.github/workflows/linux_cron.yml index 8252cecedb..a44153e331 100644 --- a/.github/workflows/linux_cron.yml +++ b/.github/workflows/linux_cron.yml @@ -24,13 +24,6 @@ jobs: - { FLAVOR: cpp-core, BOOST: 1.62.0, COMPILER: clang } - { FLAVOR: cpp-core, BOOST: 1.61.0, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.66.0, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.65.1, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.64.0, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.63.0, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.62.0, COMPILER: clang } - - { FLAVOR: cpp-grpc, BOOST: 1.61.0, COMPILER: clang } - - { FLAVOR: cpp-core, BOOST: 1.66.0, COMPILER: gcc } - { FLAVOR: cpp-core, BOOST: 1.65.1, COMPILER: gcc } - { FLAVOR: cpp-core, BOOST: 1.64.0, COMPILER: gcc } @@ -38,13 +31,6 @@ jobs: - { FLAVOR: cpp-core, BOOST: 1.62.0, COMPILER: gcc } - { FLAVOR: cpp-core, BOOST: 1.61.0, COMPILER: gcc } - - { FLAVOR: cpp-grpc, BOOST: 1.66.0, COMPILER: gcc } - - { FLAVOR: cpp-grpc, BOOST: 1.65.1, COMPILER: gcc } - - { FLAVOR: cpp-grpc, BOOST: 1.64.0, COMPILER: gcc } - - { FLAVOR: cpp-grpc, BOOST: 1.63.0, COMPILER: gcc } - - { FLAVOR: cpp-grpc, BOOST: 1.62.0, COMPILER: gcc } - - { FLAVOR: cpp-grpc, BOOST: 1.61.0, COMPILER: gcc } - env: ${{ matrix.env }} steps: diff --git a/.gitmodules b/.gitmodules index 713e206e87..5dbd016012 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "thirdparty/grpc"] - path = thirdparty/grpc - url = https://github.com/grpc/grpc.git - [submodule "thirdparty/rapidjson"] path = thirdparty/rapidjson url = https://github.com/Tencent/rapidjson.git diff --git a/CHANGELOG.md b/CHANGELOG.md index f71083a69c..fb702b690c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,39 @@ tag versions. The Bond compiler (`gbc`) and different versioning scheme, following the Haskell community's [package versioning policy](https://wiki.haskell.org/Package_versioning_policy). +## Unreleased ## + +* IDL core version: TBD +* C++ version: TBD (major bump needed) +* C# NuGet version: TBD (major bump needed) +* `gbc` & compiler library: TBD (major bump needed) + +### `gbc` and Bond compiler library ### +* **Breaking change**: Codegen for Bond-over-gRPC has been removed: the + `--grpc` switch is no longer supported. Service definitions are still + parsed, but codegen can no longer be done for C++ or C#. See [issue + \#1131, Bond-over-gRPC will be deprecated February + 2022](https://github.com/microsoft/bond/issues/1131), for the full + announcement. + +### C++ ### + +* **Breaking change**: All Bond-over-gRPC code has been removed. This is + everything under the `bond::ext:grpc` namespace. Service definitions can + still appear in .bond files, but no C++ code will be generated for them. + See [issue \#1131, Bond-over-gRPC will be deprecated February + 2022](https://github.com/microsoft/bond/issues/1131), for the full + announcement. + +### C# ### + +* **Breaking change**: All Bond-over-gRPC code has been removed. This is + everything under the `Bond.Grpc` namespace and the Bond.Grpc.CSharp NuGet + package. Service definitions can still appear in .bond files, but no C# + code will be generated for them. See [issue \#1131, Bond-over-gRPC will be + deprecated February 2022](https://github.com/microsoft/bond/issues/1131), + for the full announcement. + ## 10.0: 2022-03-07 ## * IDL core version: 3.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4086359426..7b22038a7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,19 +12,9 @@ set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cmake-modules) -# Initialize before ThirdParty -set (BOND_ENABLE_GRPC - "TRUE" - CACHE BOOL "If FALSE, then do not build gRPC integration") -set (BOND_FIND_GRPC - "FALSE" - CACHE BOOL "If TRUE, search for an installed gRPC library; if FALSE, then build and use gRPC from the /thirdparty subdirectory") set (BOND_FIND_RAPIDJSON "FALSE" CACHE BOOL "If FALSE, then use and install rapidjson from the /thirdparty subdirectory") -# We need to include third-party CMake modules before we configure our own -# settings so that we don't apply our settings to third-party code. -add_subdirectory (thirdparty) enable_testing() diff --git a/README.md b/README.md index 3126dd8b65..34a19cdda4 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ to build Bond you will need CMake (3.1+), [Haskell Stack](https://docs.haskellstack.org/en/stable/README/#how-to-install) (1.5.1+) and Boost (1.61+). -Additionally, Bond requires RapidJSON and optionally requires gRPC. The Bond repository primarily uses Git submodules for these two dependencies. It should be cloned with the `--recursive` flag: +Additionally, Bond requires RapidJSON. The Bond repository has a Git submodules for RapidJSON. It should be cloned with the `--recursive` flag: ```bash git clone --recursive https://github.com/microsoft/bond.git @@ -45,8 +45,6 @@ git clone --recursive https://github.com/microsoft/bond.git If you already have RapidJSON and would like to build against it, add argument `-DBOND_FIND_RAPIDJSON=TRUE` to the CMake invocation. It will use find_package(RapidJSON). If you do not provide a RapidJSON library, Bond will also install RapidJSON. -If you do not wish to build the gRPC component, add argument `-DBOND_ENABLE_GRPC=FALSE` to the CMake invocation. - Following are specific instructions for building on various platforms. ### Linux @@ -81,7 +79,6 @@ In the root `bond` directory run: ```bash mkdir build cd build -cmake -DBOND_ENABLE_GRPC=FALSE .. make sudo make install ``` @@ -89,14 +86,13 @@ sudo make install The `build` directory is just an example. Any directory can be used as the build destination. -To build the Bond Python module, all the C++/Python tests and -examples, and Bond-over-gRPC, a few more packages are needed. +To build the Bond Python module and all the C++/Python tests and +examples, a few more packages are needed. ```bash sudo apt-get install \ autoconf \ build-essential \ - golang \ libboost-date-time-dev \ libboost-python-dev \ libboost-test-dev \ @@ -110,7 +106,6 @@ the new options. ```bash cd build # or wherever you ran CMake before -cmake -DBOND_ENABLE_GRPC=TRUE -DgRPC_ZLIB_PROVIDER=package .. ``` Running the following command in the `build` directory will build and execute all @@ -145,7 +140,6 @@ order to generate and build from makefiles, in the root `bond` directory run: ```bash mkdir build cd build -cmake -DBOND_ENABLE_GRPC=FALSE .. make sudo make install ``` @@ -154,7 +148,7 @@ Alternatively, you can generate Xcode projects by passing the `-G Xcode` option to cmake: ```bash -cmake -DBOND_ENABLE_GRPC=FALSE -G Xcode .. +cmake -G Xcode .. ``` You can build and run unit tests by building the `check` target in Xcode or by @@ -225,9 +219,9 @@ set BOOST_LIBRARYDIR=D:\boost_1_61_0\lib64-msvc-14.0 ``` The core Bond library and most examples only require Boost headers. The -pre-built libraries are only needed for unit tests, Python, and gRPC -support. If Boost or Python libraries are not found on the system, then some -tests and examples will not be built. +pre-built libraries are only needed for unit tests, and Python. If Boost or +Python libraries are not found on the system, then some tests and examples +will not be built. To generate a solution to build the Bond Core C++ and Python with Visual Studio 2015 run the following commands from the root `bond` directory: @@ -236,7 +230,7 @@ Studio 2015 run the following commands from the root `bond` directory: mkdir build cd build set PreferredToolArchitecture=x64 -cmake -DBOND_ENABLE_GRPC=FALSE -G "Visual Studio 14 2015 Win64" .. +cmake -G "Visual Studio 14 2015 Win64" .. ``` Setting `PreferredToolArchitecture=x64` selects the 64-bit toolchain which @@ -259,21 +253,6 @@ To build and execute the unit tests and examples run: cmake --build . --target check -- /maxcpucount:8 ``` -To build Bond's gRPC++ integration from source, some of -[gRPC's prerequisites](https://github.com/grpc/grpc/blob/master/INSTALL.md#building-using-cmake-with-boringssl) -are also needed: - -```bash -choco install activeperl golang ninja yasm -``` - -You will also need to enable gRPC in the `cmake` configuration step by running the following -in the `build` directory from above and then following the other `cmake` commands above: - -```bash -cmake -DBOND_ENABLE_GRPC=TRUE -G "Visual Studio 14 2015 Win64" .. -``` - Alternatively, you can build and install Bond using the [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager: ```batch diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 5f7a0c7923..285323b38b 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -5,12 +5,6 @@ This project incorporates components from the projects listed below. The origina 1. cmake-modules (https://github.com/rpavlik/cmake-modules) 2. RapidJSON (https://github.com/miloyip/rapidjson/) -3. gRPC (https://github.com/grpc/grpc) -4. c-ares (https://github.com/c-ares/c-ares) -5. gflags (https://github.com/gflags/gflags) -6. Protocol Buffers (https://github.com/google/protobuf) -7. BoringSSL (https://boringssl.googlesource.com/boringssl) -8. zlib (http://zlib.net/) cmake-modules NOTICES AND INFORMATION BEGIN HERE ========================================= @@ -101,388 +95,3 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ========================================= END OF RapidJSON NOTICES AND INFORMATION - -gRPC NOTICES AND INFORMATION BEGIN HERE -========================================= -Copyright (c) 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. - -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the GRPC project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of GRPC, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of GRPC. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of GRPC or any code incorporated within this -implementation of GRPC constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of GRPC -shall terminate as of the date such litigation is filed. -========================================= -END OF gRPC NOTICES AND INFORMATION - -c-ares NOTICES AND INFORMATION BEGIN HERE -========================================= -Copyright (c) 2007 - 2016, Daniel Stenberg with many contributors, see AUTHORS -file. - -Copyright (c) 1998 by the Massachusetts Institute of Technology. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided that -the above copyright notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting documentation, and that -the name of M.I.T. not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior permission. -M.I.T. makes no representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. -========================================= -END OF c-ares NOTICES AND INFORMATION - -gflags NOTICES AND INFORMATION BEGIN HERE -========================================= -Copyright (c) 2006, 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. -========================================= -END OF gflags NOTICES AND INFORMATION - -Protocol Buffers NOTICES AND INFORMATION BEGIN HERE -========================================= -This license applies to all parts of Protocol Buffers except the following: - - - Atomicops support for generic gcc, located in - src/google/protobuf/stubs/atomicops_internals_generic_gcc.h. - This file is copyrighted by Red Hat Inc. - - - Atomicops support for AIX/POWER, located in - src/google/protobuf/stubs/atomicops_internals_power.h. - This file is copyrighted by Bloomberg Finance LP. - -Copyright 2014, 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. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. -========================================= -END OF Protocol Buffers NOTICES AND INFORMATION - -BoringSSL NOTICES AND INFORMATION BEGIN HERE -========================================= -BoringSSL is a fork of OpenSSL. As such, large parts of it fall under OpenSSL -licensing. Files that are completely new have a Google copyright and an ISC -license. This license is reproduced at the bottom of this file. - -Contributors to BoringSSL are required to follow the CLA rules for Chromium: -https://cla.developers.google.com/clas - -Some files from Intel are under yet another license, which is also included -underneath. - -The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the -OpenSSL License and the original SSLeay license apply to the toolkit. See below -for the actual license texts. Actually both licenses are BSD-style Open Source -licenses. In case of any license issues related to OpenSSL please contact -openssl-core@openssl.org. - -The following are Google-internal bug numbers where explicit permission from -some authors is recorded for use of their work. (This is purely for our own -record keeping.) - 27287199 - 27287880 - 27287883 - - OpenSSL License - --------------- - -/* ==================================================================== - * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. 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. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED 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 OpenSSL PROJECT OR - * ITS 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 product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - - Original SSLeay License - ----------------------- - -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG "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 AUTHOR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - - -ISC license used for completely new code in BoringSSL: - -/* Copyright (c) 2015, Google Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - - -Some files from Intel carry the following license: - -# Copyright (c) 2012, Intel Corporation -# -# 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 the Intel Corporation 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 INTEL CORPORATION "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 INTEL CORPORATION 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 O THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -========================================= -END OF BoringSSL NOTICES AND INFORMATION - -zlib NOTICES AND INFORMATION BEGIN HERE -========================================= -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 - - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). -*/ -========================================= -END OF zlib NOTICES AND INFORMATION diff --git a/appveyor.yml b/appveyor.yml index 20ac09884d..f53a5a1e36 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,7 +44,6 @@ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 BOND_ARCH: 64 BOND_BOOST: "1.61.0" - BOND_CMAKE_FLAGS: "-DBOND_ENABLE_GRPC=FALSE" - BOND_BUILD: C# BOND_OUTPUT: Properties BOND_CONFIG: Debug @@ -56,18 +55,10 @@ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 BOND_ARCH: 32 BOND_BOOST: "1.62.0" - BOND_CMAKE_FLAGS: "-DBOND_ENABLE_GRPC=FALSE" - BOND_BUILD: Python APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 BOND_ARCH: 64 BOND_BOOST: "1.63.0" - BOND_CMAKE_FLAGS: "-DBOND_ENABLE_GRPC=FALSE" - # C++ gRPC build and tests - - BOND_BUILD: C++ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - BOND_ARCH: 64 - BOND_BOOST: "1.63.0" - BOND_CMAKE_FLAGS: "-DBOND_SKIP_CORE_TESTS=TRUE;-DBOND_SKIP_GBC_TESTS=TRUE" install: # Installing .NET Core needs Windows Update enabled. - sc config wuauserv start= auto @@ -86,12 +77,6 @@ git submodule update --init thirdparty\rapidjson - # If gRPC is not disabled, init gRPC and its dependencies - - if (($env:BOND_BUILD -eq 'C++') -and (-not ($env:BOND_CMAKE_FLAGS -match '-DBOND_ENABLE_GRPC=FALSE'))) { - git submodule update --init --recursive thirdparty\grpc - } - $boostComponents = ( 'boost_chrono', 'boost_date_time', @@ -168,21 +153,6 @@ } - if (($env:BOND_BUILD -eq 'C++') -and (-not ($env:BOND_CMAKE_FLAGS -match '-DBOND_ENABLE_GRPC=FALSE'))) { - - # We're building C++ and gRPC isn't disabled, so we need - # gRPC dependencies. - - choco install yasm -y - - $machinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine") - - $userPath = [System.Environment]::GetEnvironmentVariable("Path","User") - - $env:Path = "$machinePath;$userPath" - - } - cache: - cs\packages -> cs\test\core\packages.config - "c:\\sr" @@ -249,7 +219,7 @@ # on what part of C++ we're building--but they're pretty # fast to build, so build them all. - $compatTests = ('Tests\Compat', 'Tests\GrpcCompatClient', 'Tests\GrpcCompatServer') + $compatTests = ('Tests\Compat' ) dotnet msbuild cs\cs.sln /verbosity:minimal "/target:$($compatTests -join ';')" @@ -365,9 +335,6 @@ dotnet test cs\test\internal\Internal.csproj if (-not $?) { throw "tests failed" } - dotnet test cs\test\grpc\grpc.csproj - if (-not $?) { throw "tests failed" } - & cs\test\test-examples.ps1 -IgnorePatterns '*\shared-types-assembly\*' -ErrorVariable exampleErrors if ($exampleErrors) { throw "One or more example failed. See above for details." } } diff --git a/cmake/Bond.cmake b/cmake/Bond.cmake index 9fb770c4b5..22148614e2 100644 --- a/cmake/Bond.cmake +++ b/cmake/Bond.cmake @@ -4,14 +4,13 @@ include (Folders) # # add_bond_codegen (file.bond [file2.bond ...] # [ENUM_HEADER] -# [GRPC] # [OUTPUT_DIR dir] # [IMPORT_DIR dir [dir2, ...]] # [OPTIONS opt [opt2 ...]]) # [TARGET name] # function (add_bond_codegen) - set (flagArgs ENUM_HEADER GRPC) + set (flagArgs ENUM_HEADER) set (oneValueArgs OUTPUT_DIR TARGET) set (multiValueArgs IMPORT_DIR OPTIONS) cmake_parse_arguments (arg "${flagArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -31,9 +30,6 @@ function (add_bond_codegen) if (arg_ENUM_HEADER) list(APPEND options --enum-header) endif() - if (arg_GRPC) - list(APPEND options --grpc) - endif() set (inputs "${arg_UNPARSED_ARGUMENTS}") set (outputs) foreach (file ${inputs}) @@ -48,10 +44,6 @@ function (add_bond_codegen) if (arg_ENUM_HEADER) list(APPEND outputs "${outputDir}/${name}_enum.h") endif() - if (arg_GRPC) - list(APPEND outputs "${outputDir}/${name}_grpc.cpp") - list(APPEND outputs "${outputDir}/${name}_grpc.h") - endif() endforeach() # if BOND_GBC_PATH is not set we must add a dependency on the "gbc" target to build it if (NOT BOND_GBC_PATH) @@ -75,33 +67,24 @@ endfunction() # # add_bond_executable (name # [schem.bond [schema2.bond]] -# source.cpp [source2.cpp] -# [GRPC]) +# source.cpp [source2.cpp]) # function (add_bond_executable target) set (schemas) set (sources) - set (flagArgs GRPC) - cmake_parse_arguments (arg "${flagArgs}" "" "" ${ARGN}) + cmake_parse_arguments (arg "" "" "" ${ARGN}) foreach (file ${ARGV}) get_filename_component (ext ${file} EXT) if (ext STREQUAL ".bond") get_filename_component (name ${file} NAME_WE) list (APPEND schemas "${file}") list (APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${name}_types.cpp") - if (arg_GRPC) - list (APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${name}_grpc.cpp") - endif() endif() endforeach() if (schemas) set (options) - if (arg_GRPC) - list (APPEND options GRPC) - endif() add_bond_codegen (${schemas} ${options}) endif() - list (REMOVE_ITEM ARGV GRPC) add_executable (${ARGV} ${sources}) add_target_to_folder(${target}) target_link_libraries (${target} PRIVATE @@ -116,8 +99,7 @@ endfunction() # add_bond_test (name # [schem.bond [schema2.bond]] # source.cpp [source2.cpp] -# [BUILD_ONLY] -# [GRPC]) +# [BUILD_ONLY]) # function (add_bond_test test) set (flagArgs BUILD_ONLY) @@ -133,17 +115,6 @@ function (add_bond_test test) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${test}) endif() - - get_property (lastTestPort GLOBAL PROPERTY LAST_TEST_PORT) - if (NOT DEFINED lastTestPort) - set (lastTestPort 25189) - endif() - math(EXPR testPort1 "${lastTestPort} + 1") - math(EXPR testPort2 "${lastTestPort} + 2") - target_compile_definitions (${test} PRIVATE - -DTEST_PORT_1=${testPort1} - -DTEST_PORT_2=${testPort2}) - set_property (GLOBAL PROPERTY LAST_TEST_PORT "${testPort2}") endfunction() # diff --git a/cmake/Compiler.cmake b/cmake/Compiler.cmake index 968db5bb3a..e4ab0ef929 100644 --- a/cmake/Compiler.cmake +++ b/cmake/Compiler.cmake @@ -18,15 +18,3 @@ function (cxx_add_compile_options compiler) add_compile_options (${ARGV}) endif() endfunction() - -# TODO: remove when deleting Bond-over-gRPC code -function (cxx_target_no_warn_deprecated target) - # Need to ignore both the warning about not understanding [[deprecated]] - # and the warning about [[deprecated]] things if the compiler _does_ - # understand [[deprecated]] - cxx_target_compile_options (AppleClang ${target} PRIVATE -Wno-unknown-attributes -Wno-deprecated-declarations -Wno-c++14-extensions) - cxx_target_compile_options (Clang ${target} PRIVATE -Wno-unknown-attributes -Wno-deprecated-declarations -Wno-c++14-extensions) - cxx_target_compile_options (GNU ${target} PRIVATE -Wno-attributes -Wno-deprecated-declarations) - - cxx_target_compile_options (MSVC ${target} PRIVATE /wd4996) -endfunction() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 0231384f32..3f284974ab 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -74,20 +74,6 @@ if (WIN32) PATHS "${CMAKE_CURRENT_SOURCE_DIR}/cs/test/compat/core/bin/debug" "${CMAKE_CURRENT_SOURCE_DIR}/cs/test/compat/core/bin/retail") - - find_program (BOND_CSHARP_GRPC_COMPAT_SERVER GrpcCompatServer.exe - PATH_SUFFIXES net45 - NO_DEFAULT_PATH - PATHS - "${CMAKE_CURRENT_SOURCE_DIR}/cs/test/compat/grpc/server/bin/debug" - "${CMAKE_CURRENT_SOURCE_DIR}/cs/test/compat/grpc/server/bin/retail") - - find_program (BOND_CSHARP_GRPC_COMPAT_CLIENT GrpcCompatClient.exe - PATH_SUFFIXES net45 - NO_DEFAULT_PATH - PATHS - "${CMAKE_CURRENT_SOURCE_DIR}/cs/test/compat/grpc/client/bin/debug" - "${CMAKE_CURRENT_SOURCE_DIR}/cs/test/compat/grpc/client/bin/retail") endif() # find Java libraries and programs @@ -220,7 +206,3 @@ set (BOND_SKIP_COMPAT_TESTS set (BOND_STACK_OPTIONS "" CACHE STRING "Options to pass to Haskell Stack") - -if (BOND_ENABLE_GRPC AND ((CXX_STANDARD LESS 11) OR (MSVC_VERSION LESS 1800))) - message(FATAL_ERROR "BOND_ENABLE_GRPC is TRUE but compiler specified does not support C++11 standard") -endif() diff --git a/compiler/Main.hs b/compiler/Main.hs index 3f7bb227e4..dfbed52d10 100644 --- a/compiler/Main.hs +++ b/compiler/Main.hs @@ -94,9 +94,7 @@ cppCodegen options@Cpp {..} = do , (Simple, ProtocolWriter " ::bond::SimpleBinaryWriter<::bond::OutputBuffer>") ] templates = concat $ map snd $ filter fst codegen_templates - codegen_templates = [ (core_enabled, core_files) - , (grpc_enabled, [grpc_h export_attribute, grpc_cpp]) - ] + codegen_templates = [ (core_enabled, core_files) ] core_files = [ reflection_h export_attribute , types_h export_attribute header enum_header allocator alloc_ctors_enabled type_aliases_enabled scoped_alloc_enabled @@ -123,9 +121,7 @@ csCodegen options@Cs {..} = do then ConstructorParameters else DefaultWithProtectedBase templates = concat $ map snd $ filter fst codegen_templates - codegen_templates = [ (structs_enabled, [types_cs Class fieldMapping constructorOptions]) - , (grpc_enabled, [grpc_cs]) - ] + codegen_templates = [ (structs_enabled, [types_cs Class fieldMapping constructorOptions]) ] csCodegen _ = error "csCodegen: impossible happened." anyServiceInheritance :: [Declaration] -> Bool @@ -142,9 +138,8 @@ codeGen options typeMapping templates file = do namespaceMapping <- parseNamespaceMappings $ namespace options (Bond imports namespaces declarations) <- parseFile (import_dir options) file let mappingContext = MappingContext typeMapping aliasMapping namespaceMapping namespaces - case (anyServiceInheritance declarations, service_inheritance_enabled options, grpc_enabled options) of - (True, False, _) -> fail "Use --enable-service-inheritance to enable service inheritance syntax." - (True, True, True) -> fail "Service inheritance is not supported in gRPC codegen." + case (anyServiceInheritance declarations, service_inheritance_enabled options) of + (True, False) -> fail "Use --enable-service-inheritance to enable service inheritance syntax." _ -> forM_ templates $ \template -> do let (suffix, code) = template mappingContext baseName imports declarations let fileName = baseName ++ suffix diff --git a/compiler/Options.hs b/compiler/Options.hs index e4b0f0b8cd..573c8d5c6d 100644 --- a/compiler/Options.hs +++ b/compiler/Options.hs @@ -40,7 +40,6 @@ data Options , jobs :: Maybe Int , no_banner :: Bool , core_enabled :: Bool - , grpc_enabled :: Bool , alloc_ctors_enabled :: Bool , type_aliases_enabled :: Bool , scoped_alloc_enabled :: Bool @@ -58,7 +57,6 @@ data Options , jobs :: Maybe Int , no_banner :: Bool , structs_enabled :: Bool - , grpc_enabled :: Bool , service_inheritance_enabled :: Bool , constructor_parameters :: Bool } @@ -96,7 +94,6 @@ cpp = Cpp , jobs = def &= opt "0" &= typ "NUM" &= name "j" &= help "Run NUM jobs simultaneously (or '$ncpus' if no NUM is not given)" , no_banner = def &= help "Omit the banner at the top of generated files" , core_enabled = True &= explicit &= name "core" &= help "Generate core serialization definitions (true by default, --core=false to disable)" - , grpc_enabled = False &= explicit &= name "grpc" &= help "Generate gRPC definitions" , alloc_ctors_enabled = False &= explicit &= name "alloc-ctors" &= help "Generate constructors with allocator argument" , type_aliases_enabled = False &= explicit &= name "type-aliases" &= help "Generate type aliases" , scoped_alloc_enabled = False &= explicit &= name "scoped-alloc" &= help "Use std::scoped_allocator_adaptor for strings and containers" @@ -111,7 +108,6 @@ cs = Cs , readonly_properties = def &= name "r" &= help "Generate private property setters" , fields = def &= name "f" &= help "Generate public fields rather than properties" , structs_enabled = True &= explicit &= name "structs" &= help "Generate C# types for Bond structs and enums (true by default, use \"--structs=false\" to disable)" - , grpc_enabled = False &= explicit &= name "grpc" &= help "Generate C# services and proxies for gRPC" , constructor_parameters = def &= explicit &= name "preview-constructor-parameters" &= help "PREVIEW FEATURE: Generate a constructor that takes all the fields as parameters. Typically used with readonly-properties." } &= name "c#" &= diff --git a/compiler/bond.cabal b/compiler/bond.cabal index c82b1f0c01..4edd6287bf 100644 --- a/compiler/bond.cabal +++ b/compiler/bond.cabal @@ -35,13 +35,10 @@ library Language.Bond.Codegen.Cpp.Apply_h Language.Bond.Codegen.Cpp.ApplyOverloads Language.Bond.Codegen.Cpp.Enum_h - Language.Bond.Codegen.Cpp.Grpc_cpp - Language.Bond.Codegen.Cpp.Grpc_h Language.Bond.Codegen.Cpp.Reflection_h Language.Bond.Codegen.Cpp.Types_cpp Language.Bond.Codegen.Cpp.Types_h Language.Bond.Codegen.Cpp.Util - Language.Bond.Codegen.Cs.Grpc_cs Language.Bond.Codegen.Cs.Types_cs Language.Bond.Codegen.Cs.Util Language.Bond.Codegen.CustomMapping diff --git a/compiler/src/Language/Bond/Codegen/Cpp/Grpc_cpp.hs b/compiler/src/Language/Bond/Codegen/Cpp/Grpc_cpp.hs deleted file mode 100644 index 39dc62cac8..0000000000 --- a/compiler/src/Language/Bond/Codegen/Cpp/Grpc_cpp.hs +++ /dev/null @@ -1,33 +0,0 @@ --- Copyright (c) Microsoft. All rights reserved. --- Licensed under the MIT license. See LICENSE file in the project root for full license information. - -{-# LANGUAGE QuasiQuotes, OverloadedStrings, RecordWildCards #-} - -module Language.Bond.Codegen.Cpp.Grpc_cpp (grpc_cpp) where - -import Data.Monoid -import Prelude -import Data.Text.Lazy (Text) -import Text.Shakespeare.Text -import Language.Bond.Syntax.Types -import Language.Bond.Codegen.TypeMapping -import Language.Bond.Codegen.Util -import qualified Language.Bond.Codegen.Cpp.Util as CPP - --- | Codegen template for generating /base_name/_grpc.cpp containing --- definitions of helper functions and schema metadata static variables. -grpc_cpp :: MappingContext -> String -> [Import] -> [Declaration] -> (String, Text) -grpc_cpp cpp file _imports declarations = ("_grpc.cpp", [lt| -#include "#{file}_reflection.h" -#include "#{file}_grpc.h" - -#{CPP.openNamespace cpp} - #{doubleLineSepEnd 1 statics declarations} -#{CPP.closeNamespace cpp} -|]) - where - -- definitions of Schema statics for non-generic services - statics s@Service {..} = - if null declParams then CPP.schemaMetadata cpp s else mempty - - statics _ = mempty diff --git a/compiler/src/Language/Bond/Codegen/Cpp/Grpc_h.hs b/compiler/src/Language/Bond/Codegen/Cpp/Grpc_h.hs deleted file mode 100644 index 7bc0acbbc3..0000000000 --- a/compiler/src/Language/Bond/Codegen/Cpp/Grpc_h.hs +++ /dev/null @@ -1,237 +0,0 @@ --- Copyright (c) Microsoft. All rights reserved. --- Licensed under the MIT license. See LICENSE file in the project root for full license information. - -{-# LANGUAGE QuasiQuotes, OverloadedStrings, RecordWildCards #-} - -module Language.Bond.Codegen.Cpp.Grpc_h (grpc_h) where - -import System.FilePath -import Data.Maybe (isNothing) -import Data.Monoid -import Prelude -import qualified Data.Text.Lazy as L -import Data.Text.Lazy.Builder -import Text.Shakespeare.Text -import Language.Bond.Util -import Language.Bond.Syntax.Types -import Language.Bond.Codegen.Util -import Language.Bond.Codegen.TypeMapping -import qualified Language.Bond.Codegen.Cpp.Util as CPP - - --- | Codegen template for generating /base_name/_grpc.h containing declarations of --- of service interface and proxy. -grpc_h :: Maybe String -> MappingContext -> String -> [Import] -> [Declaration] -> (String, L.Text) -grpc_h export_attribute cpp file imports declarations = ("_grpc.h", [lt| -#pragma once - -#include "#{file}_reflection.h" -#include "#{file}_types.h" -#{newlineSep 0 includeImport imports} -#{includeBondReflection} -#include -#include -#include -#include - -#include -#include -#include - -#{CPP.openNamespace cpp} -#{doubleLineSep 1 grpc declarations} - -#{CPP.closeNamespace cpp} - -|]) - where - includeImport (Import path) = [lt|#include "#{dropExtension (slashForward path)}_grpc.h"|] - - idl = MappingContext idlTypeMapping [] [] [] - - cppType = getTypeName cpp - - payload = maybe "void" cppType - - bonded mt = bonded' (payload mt) - where - bonded' params = [lt|::bond::bonded<#{padLeft}#{params}>|] - where - paramsText = toLazyText params - padLeft = if L.head paramsText == ':' then [lt| |] else mempty - - includeBondReflection = - if usesBondVoid then [lt|#include |] else mempty - where usesBondVoid = any declUses declarations - declUses Service {serviceMethods = methods} = any methodUses methods - declUses _ = False - methodUses Function {methodInput = input} = isNothing (methodTypeToMaybe input) - methodUses Event {} = True - - grpc s@Service{..} = [lt| -#{template}struct #{declName} final -{ - struct Schema - { - #{export_attr}static const ::bond::Metadata metadata; - - #{newlineSep 2 methodMetadata serviceMethods} - - public: struct service - { - #{newlineSep 3 (uncurry methodTemplate) (zip serviceMethods uniqueMethodTemplateStructNames)} - }; - - private: typedef boost::mpl::list<> methods0; - #{newlineSep 2 pushMethod indexedMethods} - - public: typedef #{typename}methods#{length serviceMethods}::type methods; - - #{constructor} - }; - - class #{proxyName} : public ::bond::ext::grpc::detail::client - { - public: - using ::bond::ext::grpc::detail::client::client; - - #{doubleLineSep 2 publicProxyMethodDecl serviceMethods} - - private: - #{newlineSep 2 privateProxyMethodDecl serviceMethods} - }; - - class #{serviceName} : public ::bond::ext::grpc::detail::service - { - public: - explicit #{serviceName}(const ::bond::ext::grpc::Scheduler& scheduler) - : ::bond::ext::grpc::detail::service( - scheduler, - { - #{commaLineSep 5 serviceMethodName serviceMethods} - }) - {} - - #{newlineSep 2 serviceVirtualMethod serviceMethods} - - private: - void start() override - { - _data.emplace(*this); - } - - struct data - { - explicit data(#{serviceName}& s) - : _s(s) - {} - - #{serviceName}& _s; - #{newlineSep 3 serviceDataMember serviceMethodsWithIndex} - }; - - ::boost::optional _data; - }; -}; - -#{onlyTemplate $ CPP.schemaMetadata cpp s} -|] - where - template = CPP.template s - onlyTemplate x = if null declParams then mempty else x - onlyNonTemplate x = if null declParams then x else mempty - typename = onlyTemplate [lt|typename |] - - export_attr = onlyNonTemplate $ optional (\a -> [lt|#{a} - |]) export_attribute - - methodMetadataVar m = [lt|s_#{methodName m}_metadata|] - - methodMetadata m = - [lt|private: #{export_attr}static const ::bond::Metadata #{methodMetadataVar m};|] - - -- reversed list of method names zipped with indexes - indexedMethods :: [(String, Int)] - indexedMethods = zipWith ((,) . methodName) (reverse serviceMethods) [0..] - - pushMethod (method, i) = - [lt|private: typedef #{typename}boost::mpl::push_front::type methods#{i + 1};|] - - -- constructor, generated only for service templates - constructor = onlyTemplate [lt|Schema() - { - // Force instantiation of template statics - (void)metadata; - #{newlineSep 3 static serviceMethods} - }|] - where - static m = [lt|(void)#{methodMetadataVar m};|] - - -- unique names for each of the MethodTemplate derived structs that - -- we need to generate in the same order as serviceMethods. - uniqueMethodTemplateStructNames :: [String] - uniqueMethodTemplateStructNames = uniqueNames (map (\n -> n ++ "_type") methodNames) reservedNames - where - methodNames = map methodName serviceMethods - reservedNames = methodTemplateReservedNames ++ methodNames - -- methodTemplateReservedNames are names used in ::bond::reflection::MethodTemplate<> - methodTemplateReservedNames = ["MethodTemplate", "service_type", "input_type", "result_type", "metadata", "method"] - - methodTemplate :: Method -> String -> L.Text - methodTemplate m methodTemplateStructName = [lt|typedef struct #{methodTemplateStructName} : ::bond::ext::grpc::reflection::MethodTemplate<#{declName}, #{payload $ methodTypeToMaybe (methodInput m)}, #{resultType m}, &#{methodMetadataVar m}> {} #{methodName m};|] - - proxyName = "Client" :: String - serviceName = "Service" :: String - - serviceMethodsWithIndex :: [(Integer,Method)] - serviceMethodsWithIndex = zip [0..] serviceMethods - - publicProxyMethodDecl Function{methodInput = Void, ..} = [lt|void Async#{methodName}(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m#{methodName}, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result<#{payload (methodTypeToMaybe methodResult)}>> Async#{methodName}(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<#{payload (methodTypeToMaybe methodResult)}>(_m#{methodName}, std::move(context)); - }|] - publicProxyMethodDecl Function{..} = [lt|void Async#{methodName}(const #{bonded (methodTypeToMaybe methodInput)}& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m#{methodName}, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<#{payload (methodTypeToMaybe methodResult)}>> Async#{methodName}(const #{bonded (methodTypeToMaybe methodInput)}& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<#{payload (methodTypeToMaybe methodResult)}>(_m#{methodName}, std::move(context), request); - } - void Async#{methodName}(const #{payload (methodTypeToMaybe methodInput)}& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m#{methodName}, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<#{payload (methodTypeToMaybe methodResult)}>> Async#{methodName}(const #{payload (methodTypeToMaybe methodInput)}& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<#{payload (methodTypeToMaybe methodResult)}>(_m#{methodName}, std::move(context), request); - }|] - publicProxyMethodDecl Event{methodInput = Void, ..} = [lt|void Async#{methodName}(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m#{methodName}, std::move(context), {}); - }|] - publicProxyMethodDecl Event{..} = [lt|void Async#{methodName}(const #{bonded (methodTypeToMaybe methodInput)}& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m#{methodName}, std::move(context), {}, request); - } - void Async#{methodName}(const #{payload (methodTypeToMaybe methodInput)}& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m#{methodName}, std::move(context), {}, request); - }|] - - privateProxyMethodDecl f = [lt|const ::bond::ext::grpc::detail::client::Method _m#{methodName f}{ ::bond::ext::grpc::detail::client::make_method("/#{getDeclTypeName idl s}/#{methodName f}") };|] - - serviceMethodName f = [lt|"/#{getDeclTypeName idl s}/#{methodName f}"|] - - serviceDataMember (index,f) = [lt|::bond::ext::grpc::detail::service::Method _m#{index}{ _s, #{index}, ::bond::ext::grpc::detail::service::make_callback(&#{serviceName}::#{methodName f}, _s) };|] - - serviceVirtualMethod f = [lt|virtual void #{methodName f}(::bond::ext::grpc::unary_call<#{payload $ methodTypeToMaybe $ methodInput f}, #{resultType f}>) = 0;|] - - resultType Function{..} = payload (methodTypeToMaybe methodResult) - resultType Event{} = "::bond::reflection::nothing" - - grpc _ = mempty diff --git a/compiler/src/Language/Bond/Codegen/Cs/Grpc_cs.hs b/compiler/src/Language/Bond/Codegen/Cs/Grpc_cs.hs deleted file mode 100644 index 01a0b8a029..0000000000 --- a/compiler/src/Language/Bond/Codegen/Cs/Grpc_cs.hs +++ /dev/null @@ -1,241 +0,0 @@ --- Copyright (c) Microsoft. All rights reserved. --- Licensed under the MIT license. See LICENSE file in the project root for full license information. - -{-# LANGUAGE OverloadedStrings, QuasiQuotes, RecordWildCards #-} - -module Language.Bond.Codegen.Cs.Grpc_cs ( - grpc_cs) -where - -import Data.Monoid -import qualified Data.Text.Lazy as L -import qualified Language.Bond.Codegen.Cs.Util as CS -import Language.Bond.Codegen.TypeMapping -import Language.Bond.Codegen.Util -import Language.Bond.Syntax.Types hiding (methodTypeToMaybe) -import Language.Bond.Util -import Prelude -import Text.Shakespeare.Text - --- | Represents a parameter in an abstract server method. --- --- This data definition would be in the where clause of grpc_cs if data --- definitions were permitted in where clauses. -data CsServerMethodParam = CsServerMethodParam { name :: L.Text, csType :: L.Text } - --- | Generates a C# parameter declaration for a server method parameter. -csServerParamDecl :: CsServerMethodParam -> L.Text -csServerParamDecl (CsServerMethodParam {..}) = [lt|#{csType} #{name}|] - --- | Contains splicable text for a client method's first parameter. Create --- one of these with the function csClientRequestParam. Some kinds of --- methods don't need a first param, so some of the record's fields may be --- empty. If non-empty, the correct comma and space are included so this --- text can just be spliced in. --- --- This data definition would be in the where clause of grpc_cs if data --- definitions were permitted in where clauses. -data CsClientRequestParam = CsClientRequestParam - { bareParam :: L.Text -- bare param declaration: what the caller passes in, if applicable - , messageParam :: L.Text -- param declaration wrapped in an IMessage - , toMessage :: L.Text -- code to create an IMessage for the request - , forwardMessageParam :: L.Text -- code to forward the IMessage param on to the CallInvoker - } - --- | Codegen template for generating code containing declarations of --- of services including proxies and services files for gRPC integration. -grpc_cs :: MappingContext -> String -> [Import] -> [Declaration] -> (String, L.Text) -grpc_cs cs _ _ declarations = ("_grpc.cs", [lt| -#{CS.disableCscWarnings} -#{CS.disableReSharperWarnings} - -namespace #{csNamespace} -{ - using System.Collections.Generic; - - #{doubleLineSep 1 grpc declarations} -} // #{csNamespace} -|]) - where - csNamespace = sepBy "." toText $ getNamespace cs - idl = MappingContext idlTypeMapping [] [] [] - - grpc s@Service{..} = [lt|#{CS.typeAttributes cs s}public static class #{declName}#{generics} #{genericsWhere} - { - static readonly string ServiceName = "#{getDeclTypeName idl s}"; - - #{doubleLineSep 2 methodDeclaration serviceMethods} - - public abstract class #{declName}Base - { - #{doubleLineSep 3 serverBaseMethods serviceMethods} - } - - public class #{declName}Client : global::Grpc.Core.ClientBase<#{declName}Client> - { - public #{declName}Client(global::Grpc.Core.Channel channel) : base(channel) - { - } - - public #{declName}Client(global::Grpc.Core.CallInvoker callInvoker) : base(callInvoker) - { - } - - protected #{declName}Client() : base() - { - } - - protected #{declName}Client(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) : base(configuration) - { - } - - #{doubleLineSep 3 clientMethods serviceMethods} - - protected override #{declName}Client NewInstance(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) - { - return new #{declName}Client(configuration); - } - } - - public static global::Grpc.Core.ServerServiceDefinition BindService(#{declName}Base serviceImpl) - { - return global::Grpc.Core.ServerServiceDefinition.CreateBuilder() - #{newlineSep 5 serviceMethodBuilder serviceMethods} - .Build(); - } - } -|] - where - methodNames = map methodName serviceMethods - - uniqImplName name = uniqueName (name ++ "_impl") methodNames - - csTypeOf Void = "global::Bond.Void" - csTypeOf (Unary t) = getTypeName cs t - csTypeOf (Streaming t) = getTypeName cs t - - csRequestTypeName (Function {..}) = csTypeOf methodInput - csRequestTypeName (Event {..}) = csTypeOf methodInput - - csResponseTypeName (Function {..}) = csTypeOf methodResult - csResponseTypeName Event{} = csTypeOf Void - - messageVoid = [lt|global::Bond.Grpc.IMessage|] - - messageOf :: Type -> L.Text - messageOf t = [lt|global::Bond.Grpc.IMessage<#{getTypeName cs t}>|] - - methodTypeEnum :: Method -> L.Text - methodTypeEnum (Function {..}) = case (methodResult, methodInput) of - (Streaming _, Streaming _) -> [lt|global::Grpc.Core.MethodType.DuplexStreaming|] - (Streaming _, _) -> [lt|global::Grpc.Core.MethodType.ServerStreaming|] - (_, Streaming _) -> [lt|global::Grpc.Core.MethodType.ClientStreaming|] - _ -> [lt|global::Grpc.Core.MethodType.Unary|] - methodTypeEnum (Event {..}) = case methodInput of - Streaming _ -> error ("Unexpected event '" ++ methodName ++ "' with Streaming parameter") -- the parser should have rejected this - _ -> [lt|global::Grpc.Core.MethodType.Unary|] - - generics = angles $ sepBy ", " paramName declParams - - genericsWhere = sepBy " " addWhere declParams - where - addWhere a = [lt|where #{paramName a} : class|] - - methodDeclaration m = [lt|static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage<#{csResponseTypeName m}>> Method_#{methodName m} = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage<#{csResponseTypeName m}>>( - #{methodTypeEnum m}, - ServiceName, - "#{methodName m}", - global::Bond.Grpc.Marshaller<#{csRequestTypeName m}>.Instance, - global::Bond.Grpc.Marshaller<#{csResponseTypeName m}>.Instance);|] - - serverMethodParams :: MethodType -> MethodType -> [CsServerMethodParam] - serverMethodParams reqType respType = (forRequest reqType) ++ (forResponse respType) ++ context - where - forRequest Void = [(CsServerMethodParam [lt|request|] messageVoid)] - forRequest (Unary t) = [(CsServerMethodParam [lt|request|] [lt|#{messageOf t}|])] - forRequest (Streaming t) = [(CsServerMethodParam [lt|requests|] [lt|Grpc.Core.IAsyncStreamReader<#{messageOf t}>|])] - forResponse Void = [] - forResponse (Unary _) = [] - forResponse (Streaming t) = [(CsServerMethodParam [lt|responses|] [lt|Grpc.Core.IAsyncStreamWriter<#{messageOf t}>|])] - context = [(CsServerMethodParam [lt|context|] [lt|global::Grpc.Core.ServerCallContext|])] - - -- | For functions (not events), given the result type, compute the - -- C# abstract method return type. - csServerFunctionReturn :: MethodType -> L.Text - csServerFunctionReturn Void = [lt|global::System.Threading.Tasks.Task<#{messageVoid}>|] - csServerFunctionReturn (Unary t) = [lt|global::System.Threading.Tasks.Task<#{messageOf t}>|] - csServerFunctionReturn (Streaming _) = [lt|global::System.Threading.Tasks.Task|] - - serverBaseMethods Function{..} = [lt|#{CS.schemaAttributes 3 methodAttributes}public abstract #{csServerFunctionReturn methodResult} #{methodName}(#{csParams});|] - where params = serverMethodParams methodInput methodResult - csParams = commaSep csServerParamDecl params - - serverBaseMethods Event{..} = [lt|#{CS.schemaAttributes 3 methodAttributes}public abstract global::System.Threading.Tasks.Task #{methodName}(#{csParams}); - - internal global::System.Threading.Tasks.Task<#{messageVoid}> #{uniqImplName methodName}(#{csParams}) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(#{handlerArgs}); - }|] - where params = serverMethodParams methodInput Void - csParams = commaSep csServerParamDecl params - handlerArgs = commaSep id ((L.pack methodName):(map name params)) - - -- | For functions (not events), given the input and result types, - -- compute the C# client method return type. - csClientFunctionReturn :: MethodType -> MethodType -> L.Text - csClientFunctionReturn (Streaming input) (Streaming result) = [lt|global::Grpc.Core.AsyncDuplexStreamingCall<#{messageOf input}, #{messageOf result}>|] - csClientFunctionReturn (Streaming input) (Unary result) = [lt|global::Grpc.Core.AsyncClientStreamingCall<#{messageOf input}, #{messageOf result}>|] - csClientFunctionReturn _ (Streaming result) = [lt|global::Grpc.Core.AsyncServerStreamingCall<#{messageOf result}>|] - csClientFunctionReturn _ (Unary result) = [lt|global::Grpc.Core.AsyncUnaryCall<#{messageOf result}>|] - csClientFunctionReturn _ Void = [lt|global::Grpc.Core.AsyncUnaryCall<#{messageVoid}>|] - - -- | Given the input type, compute the client method parameter. - csClientRequestParam :: MethodType -> CsClientRequestParam - csClientRequestParam Void = CsClientRequestParam - { bareParam = mempty - , messageParam = [lt|#{messageVoid} request, |] - , toMessage = [lt|global::Bond.Grpc.Message.Void, |] - , forwardMessageParam = [lt|, request|] } - csClientRequestParam (Unary t) = CsClientRequestParam - { bareParam = [lt|#{getTypeName cs t} request, |] - , messageParam = [lt|#{messageOf t} request, |] - , toMessage = [lt|global::Bond.Grpc.Message.From(request), |] - , forwardMessageParam = [lt|, request|] } - csClientRequestParam (Streaming _) = CsClientRequestParam - { bareParam = mempty - , messageParam = mempty - , toMessage = mempty - , forwardMessageParam = mempty } - - -- | Given the input and result types, compute the call invoker needed. - clientCallInvoker :: MethodType -> MethodType -> L.Text - clientCallInvoker (Streaming _) (Streaming _) = [lt|AsyncDuplexStreamingCall|] - clientCallInvoker (Streaming _) (Unary _) = [lt|AsyncClientStreamingCall|] - clientCallInvoker (Unary _) (Streaming _) = [lt|AsyncServerStreamingCall|] - clientCallInvoker _ _ = [lt|AsyncUnaryCall|] - - clientMethods Function{..} = [lt|#{CS.schemaAttributes 3 methodAttributes}public virtual #{csClientFunctionReturn methodInput methodResult} #{methodName}Async(#{bareParam requestParam}global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return #{methodName}Async(#{toMessage requestParam}new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - #{CS.schemaAttributes 3 methodAttributes}public virtual #{csClientFunctionReturn methodInput methodResult} #{methodName}Async(#{messageParam requestParam}global::Grpc.Core.CallOptions options) - { - return CallInvoker.#{clientCallInvoker methodInput methodResult}(Method_#{methodName}, null, options#{forwardMessageParam requestParam}); - }|] - where requestParam = csClientRequestParam methodInput - - clientMethods Event{..} = [lt|#{CS.schemaAttributes 3 methodAttributes}public virtual void #{methodName}Async(#{bareParam requestParam}global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - #{methodName}Async(#{toMessage requestParam}new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - #{CS.schemaAttributes 3 methodAttributes}public virtual void #{methodName}Async(#{messageParam requestParam}global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_#{methodName}, null, options#{forwardMessageParam requestParam}); - }|] - where requestParam = csClientRequestParam methodInput - - serviceMethodBuilder Function{..} = [lt|.AddMethod(Method_#{methodName}, serviceImpl.#{methodName})|] - serviceMethodBuilder Event{..} = [lt|.AddMethod(Method_#{methodName}, serviceImpl.#{uniqImplName methodName})|] - - grpc _ = mempty diff --git a/compiler/src/Language/Bond/Codegen/Templates.hs b/compiler/src/Language/Bond/Codegen/Templates.hs index 96950b37a0..0ed0131467 100644 --- a/compiler/src/Language/Bond/Codegen/Templates.hs +++ b/compiler/src/Language/Bond/Codegen/Templates.hs @@ -41,14 +41,11 @@ module Language.Bond.Codegen.Templates , apply_h , apply_cpp , Protocol(..) - , grpc_h - , grpc_cpp -- ** C# , FieldMapping(..) , StructMapping(..) , ConstructorOptions(..) , types_cs - , grpc_cs -- ** Java , JavaFieldMapping(..) , class_java @@ -63,10 +60,7 @@ import Language.Bond.Codegen.Cpp.Enum_h import Language.Bond.Codegen.Cpp.Reflection_h import Language.Bond.Codegen.Cpp.Types_cpp import Language.Bond.Codegen.Cpp.Types_h -import Language.Bond.Codegen.Cpp.Grpc_cpp -import Language.Bond.Codegen.Cpp.Grpc_h import Language.Bond.Codegen.Cs.Types_cs -import Language.Bond.Codegen.Cs.Grpc_cs import Language.Bond.Codegen.Java.Class_java import Language.Bond.Codegen.Java.Enum_java -- redundant imports for haddock diff --git a/compiler/tests/TestMain.hs b/compiler/tests/TestMain.hs index 1993d998a5..ca60f46b8b 100644 --- a/compiler/tests/TestMain.hs +++ b/compiler/tests/TestMain.hs @@ -121,11 +121,6 @@ tests = testGroup "Compiler tests" ] , testGroup "Exports" [ verifyExportsCodegen - [ "c++" - , "--export-attribute=DllExport" - ] - "service" - , verifyExportsCodegen [ "c++" , "--export-attribute=DllExport" ] @@ -136,20 +131,6 @@ tests = testGroup "Compiler tests" , "--namespace=tests=nsmapped" ] "basic_types_nsmapped" - , testGroup "Grpc" - [ verifyCppGrpcCodegen - [ "c++" - ] - "service" - , verifyCppGrpcCodegen - [ "c++" - ] - "generic_service" - , verifyCppGrpcCodegen - [ "c++" - ] - "service_attributes" - ] ] , testGroup "C#" [ verifyCsCodegen "attributes" @@ -199,24 +180,6 @@ tests = testGroup "Compiler tests" ] "empty_struct" "constructor-parameters" - , testGroup "Grpc" - [ verifyCsGrpcCodegen - [ "c#" - ] - "service" - , verifyCsGrpcCodegen - [ "c#" - ] - "generic_service" - , verifyCsGrpcCodegen - [ "c#" - ] - "service_attributes" - , verifyCsGrpcCodegen - [ "c#" - ] - "streaming" - ] ] , testGroup "Java" [ verifyJavaCodegen "attributes" diff --git a/compiler/tests/Tests/Codegen.hs b/compiler/tests/Tests/Codegen.hs index 3d83cee18a..e997b1d7db 100644 --- a/compiler/tests/Tests/Codegen.hs +++ b/compiler/tests/Tests/Codegen.hs @@ -8,11 +8,9 @@ module Tests.Codegen ( verifyCodegen , verifyCodegenVariation , verifyCppCodegen - , verifyCppGrpcCodegen , verifyApplyCodegen , verifyExportsCodegen , verifyCsCodegen - , verifyCsGrpcCodegen , verifyJavaCodegen ) where @@ -86,35 +84,6 @@ verifyExportsCodegen args baseName = , types_h export_attribute header enum_header allocator alloc_ctors_enabled type_aliases_enabled scoped_alloc_enabled ] -verifyCppGrpcCodegen :: [String] -> FilePath -> TestTree -verifyCppGrpcCodegen args baseName = - testGroup baseName $ - map (verifyFile options baseName (cppExpandAliases (type_aliases_enabled options) cppTypeMapping) "") templates - where - options = processOptions args - templates = - [ grpc_h (export_attribute options) - , grpc_cpp - , types_cpp - ] - -verifyCsGrpcCodegen :: [String] -> FilePath -> TestTree -verifyCsGrpcCodegen args baseName = - testGroup baseName $ - map (verifyFile (processOptions args) baseName csTypeMapping "") - [ grpc_cs - , types_cs Class (fieldMapping (processOptions args)) (constructorOptions (processOptions args)) - ] - where - fieldMapping Cs {..} = if readonly_properties - then ReadOnlyProperties - else if fields - then PublicFields - else Properties - constructorOptions Cs {..} = if constructor_parameters - then ConstructorParameters - else DefaultWithProtectedBase - verifyFiles :: Options -> FilePath -> FilePath -> [TestTree] verifyFiles options baseName variation = map (verify (typeMapping options) variation) (templates options) diff --git a/compiler/tests/generated/generic_service_grpc.cpp b/compiler/tests/generated/generic_service_grpc.cpp deleted file mode 100644 index 0cf5a6c3c7..0000000000 --- a/compiler/tests/generated/generic_service_grpc.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "generic_service_reflection.h" -#include "generic_service_grpc.h" - -namespace tests -{ - -} // namespace tests diff --git a/compiler/tests/generated/generic_service_grpc.cs b/compiler/tests/generated/generic_service_grpc.cs deleted file mode 100644 index fadb56f5ac..0000000000 --- a/compiler/tests/generated/generic_service_grpc.cs +++ /dev/null @@ -1,160 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - - -namespace tests -{ - using System.Collections.Generic; - - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public static class Foo where Payload : class - { - static readonly string ServiceName = "tests.Foo"; - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo31 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo31", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo32 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo32", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo33 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo33", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method>, global::Bond.Grpc.IMessage> Method_ConsumesGeneric1 = new global::Grpc.Core.Method>, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "ConsumesGeneric1", - global::Bond.Grpc.Marshaller>.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method>>, global::Bond.Grpc.IMessage> Method_ConsumesGeneric2 = new global::Grpc.Core.Method>>, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "ConsumesGeneric2", - global::Bond.Grpc.Marshaller>>.Instance, - global::Bond.Grpc.Marshaller.Instance); - - public abstract class FooBase - { - public abstract global::System.Threading.Tasks.Task> foo31(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo32(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo33(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> ConsumesGeneric1(global::Bond.Grpc.IMessage> request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> ConsumesGeneric2(global::Bond.Grpc.IMessage>> request, global::Grpc.Core.ServerCallContext context); - } - - public class FooClient : global::Grpc.Core.ClientBase - { - public FooClient(global::Grpc.Core.Channel channel) : base(channel) - { - } - - public FooClient(global::Grpc.Core.CallInvoker callInvoker) : base(callInvoker) - { - } - - protected FooClient() : base() - { - } - - protected FooClient(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) : base(configuration) - { - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo31Async(Payload request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo31Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo31Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo31, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo32Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo32Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo32Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo32, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo33Async(Payload request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo33Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo33Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo33, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> ConsumesGeneric1Async(SomeBox request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return ConsumesGeneric1Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> ConsumesGeneric1Async(global::Bond.Grpc.IMessage> request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_ConsumesGeneric1, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> ConsumesGeneric2Async(SomeBox> request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return ConsumesGeneric2Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> ConsumesGeneric2Async(global::Bond.Grpc.IMessage>> request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_ConsumesGeneric2, null, options, request); - } - - protected override FooClient NewInstance(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) - { - return new FooClient(configuration); - } - } - - public static global::Grpc.Core.ServerServiceDefinition BindService(FooBase serviceImpl) - { - return global::Grpc.Core.ServerServiceDefinition.CreateBuilder() - .AddMethod(Method_foo31, serviceImpl.foo31) - .AddMethod(Method_foo32, serviceImpl.foo32) - .AddMethod(Method_foo33, serviceImpl.foo33) - .AddMethod(Method_ConsumesGeneric1, serviceImpl.ConsumesGeneric1) - .AddMethod(Method_ConsumesGeneric2, serviceImpl.ConsumesGeneric2) - .Build(); - } - } - -} // tests diff --git a/compiler/tests/generated/generic_service_grpc.h b/compiler/tests/generated/generic_service_grpc.h deleted file mode 100644 index 4cd7178c2b..0000000000 --- a/compiler/tests/generated/generic_service_grpc.h +++ /dev/null @@ -1,226 +0,0 @@ - -#pragma once - -#include "generic_service_reflection.h" -#include "generic_service_types.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace tests -{ - -template - struct Foo final -{ - struct Schema - { - static const ::bond::Metadata metadata; - - private: static const ::bond::Metadata s_foo31_metadata; - private: static const ::bond::Metadata s_foo32_metadata; - private: static const ::bond::Metadata s_foo33_metadata; - private: static const ::bond::Metadata s_ConsumesGeneric1_metadata; - private: static const ::bond::Metadata s_ConsumesGeneric2_metadata; - - public: struct service - { - typedef struct foo31_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo31; - typedef struct foo32_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo32; - typedef struct foo33_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo33; - typedef struct ConsumesGeneric1_type : ::bond::ext::grpc::reflection::MethodTemplate, void, &s_ConsumesGeneric1_metadata> {} ConsumesGeneric1; - typedef struct ConsumesGeneric2_type : ::bond::ext::grpc::reflection::MethodTemplate >, void, &s_ConsumesGeneric2_metadata> {} ConsumesGeneric2; - }; - - private: typedef boost::mpl::list<> methods0; - private: typedef typename boost::mpl::push_front::type methods1; - private: typedef typename boost::mpl::push_front::type methods2; - private: typedef typename boost::mpl::push_front::type methods3; - private: typedef typename boost::mpl::push_front::type methods4; - private: typedef typename boost::mpl::push_front::type methods5; - - public: typedef typename methods5::type methods; - - Schema() - { - // Force instantiation of template statics - (void)metadata; - (void)s_foo31_metadata; - (void)s_foo32_metadata; - (void)s_foo33_metadata; - (void)s_ConsumesGeneric1_metadata; - (void)s_ConsumesGeneric2_metadata; - } - }; - - class Client : public ::bond::ext::grpc::detail::client - { - public: - using ::bond::ext::grpc::detail::client::client; - - void Asyncfoo31(const ::bond::bonded& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo31, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result> Asyncfoo31(const ::bond::bonded& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo31, std::move(context), request); - } - void Asyncfoo31(const Payload& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo31, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo31(const Payload& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo31, std::move(context), request); - } - - void Asyncfoo32(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo32, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo32(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo32, std::move(context)); - } - - void Asyncfoo33(const ::bond::bonded& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo33, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result> Asyncfoo33(const ::bond::bonded& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo33, std::move(context), request); - } - void Asyncfoo33(const Payload& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo33, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo33(const Payload& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo33, std::move(context), request); - } - - void AsyncConsumesGeneric1(const ::bond::bonded< ::tests::SomeBox>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric1, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result> AsyncConsumesGeneric1(const ::bond::bonded< ::tests::SomeBox>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric1, std::move(context), request); - } - void AsyncConsumesGeneric1(const ::tests::SomeBox& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric1, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result> AsyncConsumesGeneric1(const ::tests::SomeBox& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric1, std::move(context), request); - } - - void AsyncConsumesGeneric2(const ::bond::bonded< ::tests::SomeBox >>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric2, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result> AsyncConsumesGeneric2(const ::bond::bonded< ::tests::SomeBox >>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric2, std::move(context), request); - } - void AsyncConsumesGeneric2(const ::tests::SomeBox >& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric2, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result> AsyncConsumesGeneric2(const ::tests::SomeBox >& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mConsumesGeneric2, std::move(context), request); - } - - private: - const ::bond::ext::grpc::detail::client::Method _mfoo31{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo31") }; - const ::bond::ext::grpc::detail::client::Method _mfoo32{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo32") }; - const ::bond::ext::grpc::detail::client::Method _mfoo33{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo33") }; - const ::bond::ext::grpc::detail::client::Method _mConsumesGeneric1{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/ConsumesGeneric1") }; - const ::bond::ext::grpc::detail::client::Method _mConsumesGeneric2{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/ConsumesGeneric2") }; - }; - - class Service : public ::bond::ext::grpc::detail::service - { - public: - explicit Service(const ::bond::ext::grpc::Scheduler& scheduler) - : ::bond::ext::grpc::detail::service( - scheduler, - { - "/tests.Foo/foo31", - "/tests.Foo/foo32", - "/tests.Foo/foo33", - "/tests.Foo/ConsumesGeneric1", - "/tests.Foo/ConsumesGeneric2" - }) - {} - - virtual void foo31(::bond::ext::grpc::unary_call) = 0; - virtual void foo32(::bond::ext::grpc::unary_call) = 0; - virtual void foo33(::bond::ext::grpc::unary_call) = 0; - virtual void ConsumesGeneric1(::bond::ext::grpc::unary_call<::tests::SomeBox, void>) = 0; - virtual void ConsumesGeneric2(::bond::ext::grpc::unary_call<::tests::SomeBox >, void>) = 0; - - private: - void start() override - { - _data.emplace(*this); - } - - struct data - { - explicit data(Service& s) - : _s(s) - {} - - Service& _s; - ::bond::ext::grpc::detail::service::Method _m0{ _s, 0, ::bond::ext::grpc::detail::service::make_callback(&Service::foo31, _s) }; - ::bond::ext::grpc::detail::service::Method _m1{ _s, 1, ::bond::ext::grpc::detail::service::make_callback(&Service::foo32, _s) }; - ::bond::ext::grpc::detail::service::Method _m2{ _s, 2, ::bond::ext::grpc::detail::service::make_callback(&Service::foo33, _s) }; - ::bond::ext::grpc::detail::service::Method _m3{ _s, 3, ::bond::ext::grpc::detail::service::make_callback(&Service::ConsumesGeneric1, _s) }; - ::bond::ext::grpc::detail::service::Method _m4{ _s, 4, ::bond::ext::grpc::detail::service::make_callback(&Service::ConsumesGeneric2, _s) }; - }; - - ::boost::optional _data; - }; -}; - - - template - const ::bond::Metadata Foo::Schema::metadata - = ::bond::reflection::MetadataInit >("Foo", "tests.Foo", - ::bond::reflection::Attributes()); - - template - const ::bond::Metadata Foo::Schema::s_foo31_metadata - = ::bond::reflection::MetadataInit("foo31"); - - template - const ::bond::Metadata Foo::Schema::s_foo32_metadata - = ::bond::reflection::MetadataInit("foo32"); - - template - const ::bond::Metadata Foo::Schema::s_foo33_metadata - = ::bond::reflection::MetadataInit("foo33"); - - template - const ::bond::Metadata Foo::Schema::s_ConsumesGeneric1_metadata - = ::bond::reflection::MetadataInit("ConsumesGeneric1"); - - template - const ::bond::Metadata Foo::Schema::s_ConsumesGeneric2_metadata - = ::bond::reflection::MetadataInit("ConsumesGeneric2"); - - -} // namespace tests - diff --git a/compiler/tests/generated/generic_service_types.cpp b/compiler/tests/generated/generic_service_types.cpp deleted file mode 100644 index a5b981fb60..0000000000 --- a/compiler/tests/generated/generic_service_types.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "generic_service_reflection.h" -#include - -namespace tests -{ - -} // namespace tests diff --git a/compiler/tests/generated/generic_service_types.cs b/compiler/tests/generated/generic_service_types.cs deleted file mode 100644 index 4b7cce9136..0000000000 --- a/compiler/tests/generated/generic_service_types.cs +++ /dev/null @@ -1,36 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - -namespace tests -{ - using System.Collections.Generic; - - [global::Bond.Schema] - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public partial class SomeBox - { - [global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.classT))] - public T value { get; set; } - - public SomeBox() - : this("tests.SomeBox", "SomeBox") - {} - - protected SomeBox(string fullName, string name) - { - value = global::Bond.GenericFactory.Create(); - } - } -} // tests diff --git a/compiler/tests/generated/service_attributes_grpc.cpp b/compiler/tests/generated/service_attributes_grpc.cpp deleted file mode 100644 index 7dfe1b8fa8..0000000000 --- a/compiler/tests/generated/service_attributes_grpc.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -#include "service_attributes_reflection.h" -#include "service_attributes_grpc.h" - -namespace tests -{ - - const ::bond::Metadata Foo::Schema::metadata - = ::bond::reflection::MetadataInit("Foo", "tests.Foo", - { - { "FooAttribute", "Bar" } - }); - - const ::bond::Metadata Foo::Schema::s_foo_metadata - = ::bond::reflection::MetadataInit("foo", - { - { "foo", "method" }, - { "method", "" } - }); - - -} // namespace tests diff --git a/compiler/tests/generated/service_attributes_grpc.cs b/compiler/tests/generated/service_attributes_grpc.cs deleted file mode 100644 index 5b6894e9ee..0000000000 --- a/compiler/tests/generated/service_attributes_grpc.cs +++ /dev/null @@ -1,87 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - - -namespace tests -{ - using System.Collections.Generic; - - [global::Bond.Attribute("FooAttribute", "Bar")] - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public static class Foo - { - static readonly string ServiceName = "tests.Foo"; - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - public abstract class FooBase - { - [global::Bond.Attribute("foo", "method")] - [global::Bond.Attribute("method", "")] - public abstract global::System.Threading.Tasks.Task> foo(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - } - - public class FooClient : global::Grpc.Core.ClientBase - { - public FooClient(global::Grpc.Core.Channel channel) : base(channel) - { - } - - public FooClient(global::Grpc.Core.CallInvoker callInvoker) : base(callInvoker) - { - } - - protected FooClient() : base() - { - } - - protected FooClient(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) : base(configuration) - { - } - - [global::Bond.Attribute("foo", "method")] - [global::Bond.Attribute("method", "")] - public virtual global::Grpc.Core.AsyncUnaryCall> fooAsync(Param request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return fooAsync(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - [global::Bond.Attribute("foo", "method")] - [global::Bond.Attribute("method", "")] - public virtual global::Grpc.Core.AsyncUnaryCall> fooAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo, null, options, request); - } - - protected override FooClient NewInstance(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) - { - return new FooClient(configuration); - } - } - - public static global::Grpc.Core.ServerServiceDefinition BindService(FooBase serviceImpl) - { - return global::Grpc.Core.ServerServiceDefinition.CreateBuilder() - .AddMethod(Method_foo, serviceImpl.foo) - .Build(); - } - } - -} // tests diff --git a/compiler/tests/generated/service_attributes_grpc.h b/compiler/tests/generated/service_attributes_grpc.h deleted file mode 100644 index 40e277a17c..0000000000 --- a/compiler/tests/generated/service_attributes_grpc.h +++ /dev/null @@ -1,104 +0,0 @@ - -#pragma once - -#include "service_attributes_reflection.h" -#include "service_attributes_types.h" - - -#include -#include -#include -#include - -#include -#include -#include - -namespace tests -{ - -struct Foo final -{ - struct Schema - { - static const ::bond::Metadata metadata; - - private: static const ::bond::Metadata s_foo_metadata; - - public: struct service - { - typedef struct foo_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo; - }; - - private: typedef boost::mpl::list<> methods0; - private: typedef boost::mpl::push_front::type methods1; - - public: typedef methods1::type methods; - - - }; - - class Client : public ::bond::ext::grpc::detail::client - { - public: - using ::bond::ext::grpc::detail::client::client; - - void Asyncfoo(const ::bond::bonded< ::tests::Param>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<::tests::Result>> Asyncfoo(const ::bond::bonded< ::tests::Param>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::Result>(_mfoo, std::move(context), request); - } - void Asyncfoo(const ::tests::Param& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::Result>> Asyncfoo(const ::tests::Param& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::Result>(_mfoo, std::move(context), request); - } - - private: - const ::bond::ext::grpc::detail::client::Method _mfoo{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo") }; - }; - - class Service : public ::bond::ext::grpc::detail::service - { - public: - explicit Service(const ::bond::ext::grpc::Scheduler& scheduler) - : ::bond::ext::grpc::detail::service( - scheduler, - { - "/tests.Foo/foo" - }) - {} - - virtual void foo(::bond::ext::grpc::unary_call<::tests::Param, ::tests::Result>) = 0; - - private: - void start() override - { - _data.emplace(*this); - } - - struct data - { - explicit data(Service& s) - : _s(s) - {} - - Service& _s; - ::bond::ext::grpc::detail::service::Method _m0{ _s, 0, ::bond::ext::grpc::detail::service::make_callback(&Service::foo, _s) }; - }; - - ::boost::optional _data; - }; -}; - - - - -} // namespace tests - diff --git a/compiler/tests/generated/service_attributes_types.cpp b/compiler/tests/generated/service_attributes_types.cpp deleted file mode 100644 index 2bf4d9cb1e..0000000000 --- a/compiler/tests/generated/service_attributes_types.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -#include "service_attributes_reflection.h" -#include - -namespace tests -{ - - const ::bond::Metadata Result::Schema::metadata - = Result::Schema::GetMetadata(); - - - const ::bond::Metadata Param::Schema::metadata - = Param::Schema::GetMetadata(); - - -} // namespace tests diff --git a/compiler/tests/generated/service_attributes_types.cs b/compiler/tests/generated/service_attributes_types.cs deleted file mode 100644 index c4da8e90aa..0000000000 --- a/compiler/tests/generated/service_attributes_types.cs +++ /dev/null @@ -1,33 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - -namespace tests -{ - using System.Collections.Generic; - - [global::Bond.Schema] - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public partial class Result - { - - } - - [global::Bond.Schema] - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public partial class Param - { - - } -} // tests diff --git a/compiler/tests/generated/service_grpc.cpp b/compiler/tests/generated/service_grpc.cpp deleted file mode 100644 index 197039c1d5..0000000000 --- a/compiler/tests/generated/service_grpc.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -#include "service_reflection.h" -#include "service_grpc.h" - -namespace tests -{ - - const ::bond::Metadata Foo::Schema::metadata - = ::bond::reflection::MetadataInit("Foo", "tests.Foo", - ::bond::reflection::Attributes()); - - const ::bond::Metadata Foo::Schema::s_foo11_metadata - = ::bond::reflection::MetadataInit("foo11"); - - const ::bond::Metadata Foo::Schema::s_foo12_metadata - = ::bond::reflection::MetadataInit("foo12"); - - const ::bond::Metadata Foo::Schema::s_foo12_impl_metadata - = ::bond::reflection::MetadataInit("foo12_impl"); - - const ::bond::Metadata Foo::Schema::s_foo13_metadata - = ::bond::reflection::MetadataInit("foo13"); - - const ::bond::Metadata Foo::Schema::s_foo14_metadata - = ::bond::reflection::MetadataInit("foo14"); - - const ::bond::Metadata Foo::Schema::s_foo15_metadata - = ::bond::reflection::MetadataInit("foo15"); - - const ::bond::Metadata Foo::Schema::s_foo21_metadata - = ::bond::reflection::MetadataInit("foo21"); - - const ::bond::Metadata Foo::Schema::s_foo22_metadata - = ::bond::reflection::MetadataInit("foo22"); - - const ::bond::Metadata Foo::Schema::s_foo23_metadata - = ::bond::reflection::MetadataInit("foo23"); - - const ::bond::Metadata Foo::Schema::s_foo24_metadata - = ::bond::reflection::MetadataInit("foo24"); - - const ::bond::Metadata Foo::Schema::s_foo31_metadata - = ::bond::reflection::MetadataInit("foo31"); - - const ::bond::Metadata Foo::Schema::s_foo32_metadata - = ::bond::reflection::MetadataInit("foo32"); - - const ::bond::Metadata Foo::Schema::s_foo33_metadata - = ::bond::reflection::MetadataInit("foo33"); - - const ::bond::Metadata Foo::Schema::s__rd_foo33_metadata - = ::bond::reflection::MetadataInit("_rd_foo33"); - - const ::bond::Metadata Foo::Schema::s_foo34_metadata - = ::bond::reflection::MetadataInit("foo34"); - - const ::bond::Metadata Foo::Schema::s_foo41_metadata - = ::bond::reflection::MetadataInit("foo41"); - - const ::bond::Metadata Foo::Schema::s_foo42_metadata - = ::bond::reflection::MetadataInit("foo42"); - - const ::bond::Metadata Foo::Schema::s_foo43_metadata - = ::bond::reflection::MetadataInit("foo43"); - - const ::bond::Metadata Foo::Schema::s_foo44_metadata - = ::bond::reflection::MetadataInit("foo44"); - - const ::bond::Metadata Foo::Schema::s_cq_metadata - = ::bond::reflection::MetadataInit("cq"); - - const ::bond::Metadata Foo::Schema::s_foo11_type_metadata - = ::bond::reflection::MetadataInit("foo11_type"); - - const ::bond::Metadata Foo::Schema::s_MethodTemplate_metadata - = ::bond::reflection::MetadataInit("MethodTemplate"); - - const ::bond::Metadata Foo::Schema::s_service_type_metadata - = ::bond::reflection::MetadataInit("service_type"); - - const ::bond::Metadata Foo::Schema::s_input_type_metadata - = ::bond::reflection::MetadataInit("input_type"); - - const ::bond::Metadata Foo::Schema::s_result_type_metadata - = ::bond::reflection::MetadataInit("result_type"); - - const ::bond::Metadata Foo::Schema::s_metadata_metadata - = ::bond::reflection::MetadataInit("metadata"); - - const ::bond::Metadata Foo::Schema::s_method_metadata - = ::bond::reflection::MetadataInit("method"); - - -} // namespace tests diff --git a/compiler/tests/generated/service_grpc.cs b/compiler/tests/generated/service_grpc.cs deleted file mode 100644 index fe8ea865a9..0000000000 --- a/compiler/tests/generated/service_grpc.cs +++ /dev/null @@ -1,624 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - - -namespace tests -{ - using System.Collections.Generic; - - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public static class Foo - { - static readonly string ServiceName = "tests.Foo"; - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo11 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo11", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo12 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo12", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo12_impl = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo12_impl", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo13 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo13", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo14 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo14", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo15 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo15", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo21 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo21", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo22 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo22", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo23 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo23", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo24 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo24", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo31 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo31", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo32 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo32", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo33 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo33", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method__rd_foo33 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "_rd_foo33", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo34 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo34", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo41 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo41", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo42 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo42", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo43 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo43", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo44 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo44", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_cq = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "cq", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo11_type = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "foo11_type", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_MethodTemplate = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "MethodTemplate", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_service_type = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "service_type", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_input_type = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "input_type", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_result_type = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "result_type", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_metadata = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "metadata", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_method = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "method", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - public abstract class FooBase - { - public abstract global::System.Threading.Tasks.Task foo11(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - internal global::System.Threading.Tasks.Task> foo11_impl(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(foo11, request, context); - } - - public abstract global::System.Threading.Tasks.Task foo12(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - internal global::System.Threading.Tasks.Task> foo12_impl0(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(foo12, request, context); - } - - public abstract global::System.Threading.Tasks.Task foo12_impl(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - internal global::System.Threading.Tasks.Task> foo12_impl_impl(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(foo12_impl, request, context); - } - - public abstract global::System.Threading.Tasks.Task foo13(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - internal global::System.Threading.Tasks.Task> foo13_impl(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(foo13, request, context); - } - - public abstract global::System.Threading.Tasks.Task foo14(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - internal global::System.Threading.Tasks.Task> foo14_impl(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(foo14, request, context); - } - - public abstract global::System.Threading.Tasks.Task foo15(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - internal global::System.Threading.Tasks.Task> foo15_impl(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context) { - return global::Bond.Grpc.Internal.NothingCallHandler.Handle(foo15, request, context); - } - - public abstract global::System.Threading.Tasks.Task> foo21(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo22(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo23(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo24(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo31(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo32(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo33(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> _rd_foo33(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo34(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo41(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo42(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo43(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo44(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> cq(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo11_type(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> MethodTemplate(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> service_type(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> input_type(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> result_type(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> metadata(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> method(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - } - - public class FooClient : global::Grpc.Core.ClientBase - { - public FooClient(global::Grpc.Core.Channel channel) : base(channel) - { - } - - public FooClient(global::Grpc.Core.CallInvoker callInvoker) : base(callInvoker) - { - } - - protected FooClient() : base() - { - } - - protected FooClient(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) : base(configuration) - { - } - - public virtual void foo11Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - foo11Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual void foo11Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_foo11, null, options, request); - } - - public virtual void foo12Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - foo12Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual void foo12Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_foo12, null, options, request); - } - - public virtual void foo12_implAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - foo12_implAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual void foo12_implAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_foo12_impl, null, options, request); - } - - public virtual void foo13Async(BasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - foo13Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual void foo13Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_foo13, null, options, request); - } - - public virtual void foo14Async(dummy request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - foo14Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual void foo14Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_foo14, null, options, request); - } - - public virtual void foo15Async(global::tests2.OtherBasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - foo15Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual void foo15Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - global::Bond.Grpc.Internal.NothingCallInvoker.NothingCall(CallInvoker, Method_foo15, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo21Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo21Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo21Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo21, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo22Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo22Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo22Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo22, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo23Async(BasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo23Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo23Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo23, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo24Async(dummy request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo24Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo24Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo24, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo31Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo31Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo31Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo31, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo32Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo32Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo32Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo32, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo33Async(BasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo33Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo33Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo33, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> _rd_foo33Async(BasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return _rd_foo33Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> _rd_foo33Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method__rd_foo33, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo34Async(dummy request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo34Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo34Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo34, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo41Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo41Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo41Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo41, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo42Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo42Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo42Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo42, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo43Async(BasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo43Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo43Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo43, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo44Async(dummy request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo44Async(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo44Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo44, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> cqAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return cqAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> cqAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_cq, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo11_typeAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo11_typeAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo11_typeAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo11_type, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> MethodTemplateAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return MethodTemplateAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> MethodTemplateAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_MethodTemplate, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> service_typeAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return service_typeAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> service_typeAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_service_type, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> input_typeAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return input_typeAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> input_typeAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_input_type, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> result_typeAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return result_typeAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> result_typeAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_result_type, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> metadataAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return metadataAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> metadataAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_metadata, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> methodAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return methodAsync(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> methodAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_method, null, options, request); - } - - protected override FooClient NewInstance(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) - { - return new FooClient(configuration); - } - } - - public static global::Grpc.Core.ServerServiceDefinition BindService(FooBase serviceImpl) - { - return global::Grpc.Core.ServerServiceDefinition.CreateBuilder() - .AddMethod(Method_foo11, serviceImpl.foo11_impl) - .AddMethod(Method_foo12, serviceImpl.foo12_impl0) - .AddMethod(Method_foo12_impl, serviceImpl.foo12_impl_impl) - .AddMethod(Method_foo13, serviceImpl.foo13_impl) - .AddMethod(Method_foo14, serviceImpl.foo14_impl) - .AddMethod(Method_foo15, serviceImpl.foo15_impl) - .AddMethod(Method_foo21, serviceImpl.foo21) - .AddMethod(Method_foo22, serviceImpl.foo22) - .AddMethod(Method_foo23, serviceImpl.foo23) - .AddMethod(Method_foo24, serviceImpl.foo24) - .AddMethod(Method_foo31, serviceImpl.foo31) - .AddMethod(Method_foo32, serviceImpl.foo32) - .AddMethod(Method_foo33, serviceImpl.foo33) - .AddMethod(Method__rd_foo33, serviceImpl._rd_foo33) - .AddMethod(Method_foo34, serviceImpl.foo34) - .AddMethod(Method_foo41, serviceImpl.foo41) - .AddMethod(Method_foo42, serviceImpl.foo42) - .AddMethod(Method_foo43, serviceImpl.foo43) - .AddMethod(Method_foo44, serviceImpl.foo44) - .AddMethod(Method_cq, serviceImpl.cq) - .AddMethod(Method_foo11_type, serviceImpl.foo11_type) - .AddMethod(Method_MethodTemplate, serviceImpl.MethodTemplate) - .AddMethod(Method_service_type, serviceImpl.service_type) - .AddMethod(Method_input_type, serviceImpl.input_type) - .AddMethod(Method_result_type, serviceImpl.result_type) - .AddMethod(Method_metadata, serviceImpl.metadata) - .AddMethod(Method_method, serviceImpl.method) - .Build(); - } - } - -} // tests diff --git a/compiler/tests/generated/service_grpc.h b/compiler/tests/generated/service_grpc.h deleted file mode 100644 index cdbfd06244..0000000000 --- a/compiler/tests/generated/service_grpc.h +++ /dev/null @@ -1,557 +0,0 @@ - -#pragma once - -#include "service_reflection.h" -#include "service_types.h" -#include "basic_types_grpc.h" -#include "namespace_basic_types_grpc.h" -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace tests -{ - -struct Foo final -{ - struct Schema - { - static const ::bond::Metadata metadata; - - private: static const ::bond::Metadata s_foo11_metadata; - private: static const ::bond::Metadata s_foo12_metadata; - private: static const ::bond::Metadata s_foo12_impl_metadata; - private: static const ::bond::Metadata s_foo13_metadata; - private: static const ::bond::Metadata s_foo14_metadata; - private: static const ::bond::Metadata s_foo15_metadata; - private: static const ::bond::Metadata s_foo21_metadata; - private: static const ::bond::Metadata s_foo22_metadata; - private: static const ::bond::Metadata s_foo23_metadata; - private: static const ::bond::Metadata s_foo24_metadata; - private: static const ::bond::Metadata s_foo31_metadata; - private: static const ::bond::Metadata s_foo32_metadata; - private: static const ::bond::Metadata s_foo33_metadata; - private: static const ::bond::Metadata s__rd_foo33_metadata; - private: static const ::bond::Metadata s_foo34_metadata; - private: static const ::bond::Metadata s_foo41_metadata; - private: static const ::bond::Metadata s_foo42_metadata; - private: static const ::bond::Metadata s_foo43_metadata; - private: static const ::bond::Metadata s_foo44_metadata; - private: static const ::bond::Metadata s_cq_metadata; - private: static const ::bond::Metadata s_foo11_type_metadata; - private: static const ::bond::Metadata s_MethodTemplate_metadata; - private: static const ::bond::Metadata s_service_type_metadata; - private: static const ::bond::Metadata s_input_type_metadata; - private: static const ::bond::Metadata s_result_type_metadata; - private: static const ::bond::Metadata s_metadata_metadata; - private: static const ::bond::Metadata s_method_metadata; - - public: struct service - { - typedef struct foo11_type0 : ::bond::ext::grpc::reflection::MethodTemplate {} foo11; - typedef struct foo12_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo12; - typedef struct foo12_impl_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo12_impl; - typedef struct foo13_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo13; - typedef struct foo14_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo14; - typedef struct foo15_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo15; - typedef struct foo21_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo21; - typedef struct foo22_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo22; - typedef struct foo23_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo23; - typedef struct foo24_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo24; - typedef struct foo31_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo31; - typedef struct foo32_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo32; - typedef struct foo33_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo33; - typedef struct _rd_foo33_type : ::bond::ext::grpc::reflection::MethodTemplate {} _rd_foo33; - typedef struct foo34_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo34; - typedef struct foo41_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo41; - typedef struct foo42_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo42; - typedef struct foo43_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo43; - typedef struct foo44_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo44; - typedef struct cq_type : ::bond::ext::grpc::reflection::MethodTemplate {} cq; - typedef struct foo11_type_type : ::bond::ext::grpc::reflection::MethodTemplate {} foo11_type; - typedef struct MethodTemplate_type : ::bond::ext::grpc::reflection::MethodTemplate {} MethodTemplate; - typedef struct service_type_type : ::bond::ext::grpc::reflection::MethodTemplate {} service_type; - typedef struct input_type_type : ::bond::ext::grpc::reflection::MethodTemplate {} input_type; - typedef struct result_type_type : ::bond::ext::grpc::reflection::MethodTemplate {} result_type; - typedef struct metadata_type : ::bond::ext::grpc::reflection::MethodTemplate {} metadata; - typedef struct method_type : ::bond::ext::grpc::reflection::MethodTemplate {} method; - }; - - private: typedef boost::mpl::list<> methods0; - private: typedef boost::mpl::push_front::type methods1; - private: typedef boost::mpl::push_front::type methods2; - private: typedef boost::mpl::push_front::type methods3; - private: typedef boost::mpl::push_front::type methods4; - private: typedef boost::mpl::push_front::type methods5; - private: typedef boost::mpl::push_front::type methods6; - private: typedef boost::mpl::push_front::type methods7; - private: typedef boost::mpl::push_front::type methods8; - private: typedef boost::mpl::push_front::type methods9; - private: typedef boost::mpl::push_front::type methods10; - private: typedef boost::mpl::push_front::type methods11; - private: typedef boost::mpl::push_front::type methods12; - private: typedef boost::mpl::push_front::type methods13; - private: typedef boost::mpl::push_front::type methods14; - private: typedef boost::mpl::push_front::type methods15; - private: typedef boost::mpl::push_front::type methods16; - private: typedef boost::mpl::push_front::type methods17; - private: typedef boost::mpl::push_front::type methods18; - private: typedef boost::mpl::push_front::type methods19; - private: typedef boost::mpl::push_front::type methods20; - private: typedef boost::mpl::push_front::type methods21; - private: typedef boost::mpl::push_front::type methods22; - private: typedef boost::mpl::push_front::type methods23; - private: typedef boost::mpl::push_front::type methods24; - private: typedef boost::mpl::push_front::type methods25; - private: typedef boost::mpl::push_front::type methods26; - private: typedef boost::mpl::push_front::type methods27; - - public: typedef methods27::type methods; - - - }; - - class Client : public ::bond::ext::grpc::detail::client - { - public: - using ::bond::ext::grpc::detail::client::client; - - void Asyncfoo11(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo11, std::move(context), {}); - } - - void Asyncfoo12(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo12, std::move(context), {}); - } - - void Asyncfoo12_impl(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo12_impl, std::move(context), {}); - } - - void Asyncfoo13(const ::bond::bonded< ::tests::BasicTypes>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo13, std::move(context), {}, request); - } - void Asyncfoo13(const ::tests::BasicTypes& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo13, std::move(context), {}, request); - } - - void Asyncfoo14(const ::bond::bonded< ::tests::dummy>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo14, std::move(context), {}, request); - } - void Asyncfoo14(const ::tests::dummy& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo14, std::move(context), {}, request); - } - - void Asyncfoo15(const ::bond::bonded< ::tests2::OtherBasicTypes>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo15, std::move(context), {}, request); - } - void Asyncfoo15(const ::tests2::OtherBasicTypes& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo15, std::move(context), {}, request); - } - - void Asyncfoo21(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo21, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo21(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo21, std::move(context)); - } - - void Asyncfoo22(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo22, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo22(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo22, std::move(context)); - } - - void Asyncfoo23(const ::bond::bonded< ::tests::BasicTypes>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo23, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result> Asyncfoo23(const ::bond::bonded< ::tests::BasicTypes>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo23, std::move(context), request); - } - void Asyncfoo23(const ::tests::BasicTypes& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo23, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo23(const ::tests::BasicTypes& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo23, std::move(context), request); - } - - void Asyncfoo24(const ::bond::bonded< ::tests::dummy>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo24, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result> Asyncfoo24(const ::bond::bonded< ::tests::dummy>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo24, std::move(context), request); - } - void Asyncfoo24(const ::tests::dummy& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo24, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo24(const ::tests::dummy& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo24, std::move(context), request); - } - - void Asyncfoo31(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo31, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asyncfoo31(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mfoo31, std::move(context)); - } - - void Asyncfoo32(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo32, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asyncfoo32(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mfoo32, std::move(context)); - } - - void Asyncfoo33(const ::bond::bonded< ::tests::BasicTypes>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo33, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asyncfoo33(const ::bond::bonded< ::tests::BasicTypes>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mfoo33, std::move(context), request); - } - void Asyncfoo33(const ::tests::BasicTypes& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo33, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asyncfoo33(const ::tests::BasicTypes& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mfoo33, std::move(context), request); - } - - void Async_rd_foo33(const ::bond::bonded< ::tests::BasicTypes>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m_rd_foo33, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Async_rd_foo33(const ::bond::bonded< ::tests::BasicTypes>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_m_rd_foo33, std::move(context), request); - } - void Async_rd_foo33(const ::tests::BasicTypes& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_m_rd_foo33, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Async_rd_foo33(const ::tests::BasicTypes& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_m_rd_foo33, std::move(context), request); - } - - void Asyncfoo34(const ::bond::bonded< ::tests::dummy>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo34, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asyncfoo34(const ::bond::bonded< ::tests::dummy>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mfoo34, std::move(context), request); - } - void Asyncfoo34(const ::tests::dummy& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo34, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asyncfoo34(const ::tests::dummy& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mfoo34, std::move(context), request); - } - - void Asyncfoo41(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo41, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::dummy>> Asyncfoo41(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::dummy>(_mfoo41, std::move(context)); - } - - void Asyncfoo42(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo42, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::dummy>> Asyncfoo42(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::dummy>(_mfoo42, std::move(context)); - } - - void Asyncfoo43(const ::bond::bonded< ::tests::BasicTypes>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo43, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<::tests::dummy>> Asyncfoo43(const ::bond::bonded< ::tests::BasicTypes>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::dummy>(_mfoo43, std::move(context), request); - } - void Asyncfoo43(const ::tests::BasicTypes& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo43, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::dummy>> Asyncfoo43(const ::tests::BasicTypes& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::dummy>(_mfoo43, std::move(context), request); - } - - void Asyncfoo44(const ::bond::bonded< ::tests::dummy>& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo44, std::move(context), cb, request); - } - std::future<::bond::ext::grpc::unary_call_result<::tests::dummy>> Asyncfoo44(const ::bond::bonded< ::tests::dummy>& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::dummy>(_mfoo44, std::move(context), request); - } - void Asyncfoo44(const ::tests::dummy& request, const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo44, std::move(context), cb, request); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::dummy>> Asyncfoo44(const ::tests::dummy& request, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::dummy>(_mfoo44, std::move(context), request); - } - - void Asynccq(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mcq, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result<::tests::BasicTypes>> Asynccq(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch<::tests::BasicTypes>(_mcq, std::move(context)); - } - - void Asyncfoo11_type(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mfoo11_type, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncfoo11_type(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mfoo11_type, std::move(context)); - } - - void AsyncMethodTemplate(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mMethodTemplate, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> AsyncMethodTemplate(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mMethodTemplate, std::move(context)); - } - - void Asyncservice_type(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mservice_type, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncservice_type(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mservice_type, std::move(context)); - } - - void Asyncinput_type(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_minput_type, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncinput_type(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_minput_type, std::move(context)); - } - - void Asyncresult_type(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mresult_type, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncresult_type(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mresult_type, std::move(context)); - } - - void Asyncmetadata(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mmetadata, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncmetadata(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mmetadata, std::move(context)); - } - - void Asyncmethod(const ::std::function)>& cb, ::std::shared_ptr<::grpc::ClientContext> context = {}) - { - ::bond::ext::grpc::detail::client::dispatch(_mmethod, std::move(context), cb); - } - ::std::future<::bond::ext::grpc::unary_call_result> Asyncmethod(::std::shared_ptr<::grpc::ClientContext> context = {}) - { - return ::bond::ext::grpc::detail::client::dispatch(_mmethod, std::move(context)); - } - - private: - const ::bond::ext::grpc::detail::client::Method _mfoo11{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo11") }; - const ::bond::ext::grpc::detail::client::Method _mfoo12{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo12") }; - const ::bond::ext::grpc::detail::client::Method _mfoo12_impl{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo12_impl") }; - const ::bond::ext::grpc::detail::client::Method _mfoo13{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo13") }; - const ::bond::ext::grpc::detail::client::Method _mfoo14{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo14") }; - const ::bond::ext::grpc::detail::client::Method _mfoo15{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo15") }; - const ::bond::ext::grpc::detail::client::Method _mfoo21{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo21") }; - const ::bond::ext::grpc::detail::client::Method _mfoo22{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo22") }; - const ::bond::ext::grpc::detail::client::Method _mfoo23{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo23") }; - const ::bond::ext::grpc::detail::client::Method _mfoo24{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo24") }; - const ::bond::ext::grpc::detail::client::Method _mfoo31{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo31") }; - const ::bond::ext::grpc::detail::client::Method _mfoo32{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo32") }; - const ::bond::ext::grpc::detail::client::Method _mfoo33{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo33") }; - const ::bond::ext::grpc::detail::client::Method _m_rd_foo33{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/_rd_foo33") }; - const ::bond::ext::grpc::detail::client::Method _mfoo34{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo34") }; - const ::bond::ext::grpc::detail::client::Method _mfoo41{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo41") }; - const ::bond::ext::grpc::detail::client::Method _mfoo42{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo42") }; - const ::bond::ext::grpc::detail::client::Method _mfoo43{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo43") }; - const ::bond::ext::grpc::detail::client::Method _mfoo44{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo44") }; - const ::bond::ext::grpc::detail::client::Method _mcq{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/cq") }; - const ::bond::ext::grpc::detail::client::Method _mfoo11_type{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/foo11_type") }; - const ::bond::ext::grpc::detail::client::Method _mMethodTemplate{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/MethodTemplate") }; - const ::bond::ext::grpc::detail::client::Method _mservice_type{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/service_type") }; - const ::bond::ext::grpc::detail::client::Method _minput_type{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/input_type") }; - const ::bond::ext::grpc::detail::client::Method _mresult_type{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/result_type") }; - const ::bond::ext::grpc::detail::client::Method _mmetadata{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/metadata") }; - const ::bond::ext::grpc::detail::client::Method _mmethod{ ::bond::ext::grpc::detail::client::make_method("/tests.Foo/method") }; - }; - - class Service : public ::bond::ext::grpc::detail::service - { - public: - explicit Service(const ::bond::ext::grpc::Scheduler& scheduler) - : ::bond::ext::grpc::detail::service( - scheduler, - { - "/tests.Foo/foo11", - "/tests.Foo/foo12", - "/tests.Foo/foo12_impl", - "/tests.Foo/foo13", - "/tests.Foo/foo14", - "/tests.Foo/foo15", - "/tests.Foo/foo21", - "/tests.Foo/foo22", - "/tests.Foo/foo23", - "/tests.Foo/foo24", - "/tests.Foo/foo31", - "/tests.Foo/foo32", - "/tests.Foo/foo33", - "/tests.Foo/_rd_foo33", - "/tests.Foo/foo34", - "/tests.Foo/foo41", - "/tests.Foo/foo42", - "/tests.Foo/foo43", - "/tests.Foo/foo44", - "/tests.Foo/cq", - "/tests.Foo/foo11_type", - "/tests.Foo/MethodTemplate", - "/tests.Foo/service_type", - "/tests.Foo/input_type", - "/tests.Foo/result_type", - "/tests.Foo/metadata", - "/tests.Foo/method" - }) - {} - - virtual void foo11(::bond::ext::grpc::unary_call) = 0; - virtual void foo12(::bond::ext::grpc::unary_call) = 0; - virtual void foo12_impl(::bond::ext::grpc::unary_call) = 0; - virtual void foo13(::bond::ext::grpc::unary_call<::tests::BasicTypes, ::bond::reflection::nothing>) = 0; - virtual void foo14(::bond::ext::grpc::unary_call<::tests::dummy, ::bond::reflection::nothing>) = 0; - virtual void foo15(::bond::ext::grpc::unary_call<::tests2::OtherBasicTypes, ::bond::reflection::nothing>) = 0; - virtual void foo21(::bond::ext::grpc::unary_call) = 0; - virtual void foo22(::bond::ext::grpc::unary_call) = 0; - virtual void foo23(::bond::ext::grpc::unary_call<::tests::BasicTypes, void>) = 0; - virtual void foo24(::bond::ext::grpc::unary_call<::tests::dummy, void>) = 0; - virtual void foo31(::bond::ext::grpc::unary_call) = 0; - virtual void foo32(::bond::ext::grpc::unary_call) = 0; - virtual void foo33(::bond::ext::grpc::unary_call<::tests::BasicTypes, ::tests::BasicTypes>) = 0; - virtual void _rd_foo33(::bond::ext::grpc::unary_call<::tests::BasicTypes, ::tests::BasicTypes>) = 0; - virtual void foo34(::bond::ext::grpc::unary_call<::tests::dummy, ::tests::BasicTypes>) = 0; - virtual void foo41(::bond::ext::grpc::unary_call) = 0; - virtual void foo42(::bond::ext::grpc::unary_call) = 0; - virtual void foo43(::bond::ext::grpc::unary_call<::tests::BasicTypes, ::tests::dummy>) = 0; - virtual void foo44(::bond::ext::grpc::unary_call<::tests::dummy, ::tests::dummy>) = 0; - virtual void cq(::bond::ext::grpc::unary_call) = 0; - virtual void foo11_type(::bond::ext::grpc::unary_call) = 0; - virtual void MethodTemplate(::bond::ext::grpc::unary_call) = 0; - virtual void service_type(::bond::ext::grpc::unary_call) = 0; - virtual void input_type(::bond::ext::grpc::unary_call) = 0; - virtual void result_type(::bond::ext::grpc::unary_call) = 0; - virtual void metadata(::bond::ext::grpc::unary_call) = 0; - virtual void method(::bond::ext::grpc::unary_call) = 0; - - private: - void start() override - { - _data.emplace(*this); - } - - struct data - { - explicit data(Service& s) - : _s(s) - {} - - Service& _s; - ::bond::ext::grpc::detail::service::Method _m0{ _s, 0, ::bond::ext::grpc::detail::service::make_callback(&Service::foo11, _s) }; - ::bond::ext::grpc::detail::service::Method _m1{ _s, 1, ::bond::ext::grpc::detail::service::make_callback(&Service::foo12, _s) }; - ::bond::ext::grpc::detail::service::Method _m2{ _s, 2, ::bond::ext::grpc::detail::service::make_callback(&Service::foo12_impl, _s) }; - ::bond::ext::grpc::detail::service::Method _m3{ _s, 3, ::bond::ext::grpc::detail::service::make_callback(&Service::foo13, _s) }; - ::bond::ext::grpc::detail::service::Method _m4{ _s, 4, ::bond::ext::grpc::detail::service::make_callback(&Service::foo14, _s) }; - ::bond::ext::grpc::detail::service::Method _m5{ _s, 5, ::bond::ext::grpc::detail::service::make_callback(&Service::foo15, _s) }; - ::bond::ext::grpc::detail::service::Method _m6{ _s, 6, ::bond::ext::grpc::detail::service::make_callback(&Service::foo21, _s) }; - ::bond::ext::grpc::detail::service::Method _m7{ _s, 7, ::bond::ext::grpc::detail::service::make_callback(&Service::foo22, _s) }; - ::bond::ext::grpc::detail::service::Method _m8{ _s, 8, ::bond::ext::grpc::detail::service::make_callback(&Service::foo23, _s) }; - ::bond::ext::grpc::detail::service::Method _m9{ _s, 9, ::bond::ext::grpc::detail::service::make_callback(&Service::foo24, _s) }; - ::bond::ext::grpc::detail::service::Method _m10{ _s, 10, ::bond::ext::grpc::detail::service::make_callback(&Service::foo31, _s) }; - ::bond::ext::grpc::detail::service::Method _m11{ _s, 11, ::bond::ext::grpc::detail::service::make_callback(&Service::foo32, _s) }; - ::bond::ext::grpc::detail::service::Method _m12{ _s, 12, ::bond::ext::grpc::detail::service::make_callback(&Service::foo33, _s) }; - ::bond::ext::grpc::detail::service::Method _m13{ _s, 13, ::bond::ext::grpc::detail::service::make_callback(&Service::_rd_foo33, _s) }; - ::bond::ext::grpc::detail::service::Method _m14{ _s, 14, ::bond::ext::grpc::detail::service::make_callback(&Service::foo34, _s) }; - ::bond::ext::grpc::detail::service::Method _m15{ _s, 15, ::bond::ext::grpc::detail::service::make_callback(&Service::foo41, _s) }; - ::bond::ext::grpc::detail::service::Method _m16{ _s, 16, ::bond::ext::grpc::detail::service::make_callback(&Service::foo42, _s) }; - ::bond::ext::grpc::detail::service::Method _m17{ _s, 17, ::bond::ext::grpc::detail::service::make_callback(&Service::foo43, _s) }; - ::bond::ext::grpc::detail::service::Method _m18{ _s, 18, ::bond::ext::grpc::detail::service::make_callback(&Service::foo44, _s) }; - ::bond::ext::grpc::detail::service::Method _m19{ _s, 19, ::bond::ext::grpc::detail::service::make_callback(&Service::cq, _s) }; - ::bond::ext::grpc::detail::service::Method _m20{ _s, 20, ::bond::ext::grpc::detail::service::make_callback(&Service::foo11_type, _s) }; - ::bond::ext::grpc::detail::service::Method _m21{ _s, 21, ::bond::ext::grpc::detail::service::make_callback(&Service::MethodTemplate, _s) }; - ::bond::ext::grpc::detail::service::Method _m22{ _s, 22, ::bond::ext::grpc::detail::service::make_callback(&Service::service_type, _s) }; - ::bond::ext::grpc::detail::service::Method _m23{ _s, 23, ::bond::ext::grpc::detail::service::make_callback(&Service::input_type, _s) }; - ::bond::ext::grpc::detail::service::Method _m24{ _s, 24, ::bond::ext::grpc::detail::service::make_callback(&Service::result_type, _s) }; - ::bond::ext::grpc::detail::service::Method _m25{ _s, 25, ::bond::ext::grpc::detail::service::make_callback(&Service::metadata, _s) }; - ::bond::ext::grpc::detail::service::Method _m26{ _s, 26, ::bond::ext::grpc::detail::service::make_callback(&Service::method, _s) }; - }; - - ::boost::optional _data; - }; -}; - - - - -} // namespace tests - diff --git a/compiler/tests/generated/service_types.cpp b/compiler/tests/generated/service_types.cpp deleted file mode 100644 index 3541462feb..0000000000 --- a/compiler/tests/generated/service_types.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -#include "service_reflection.h" -#include - -namespace tests -{ - - const ::bond::Metadata dummy::Schema::metadata - = dummy::Schema::GetMetadata(); - - const ::bond::Metadata dummy::Schema::s_count_metadata - = ::bond::reflection::MetadataInit("count"); - - -} // namespace tests diff --git a/compiler/tests/generated/service_types.cs b/compiler/tests/generated/service_types.cs deleted file mode 100644 index b8008e5974..0000000000 --- a/compiler/tests/generated/service_types.cs +++ /dev/null @@ -1,36 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - -namespace tests -{ - using System.Collections.Generic; - - [global::Bond.Schema] - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public partial class dummy - { - [global::Bond.Id(0)] - public int count { get; set; } - - public dummy() - : this("tests.dummy", "dummy") - {} - - protected dummy(string fullName, string name) - { - - } - } -} // tests diff --git a/compiler/tests/generated/streaming_grpc.cs b/compiler/tests/generated/streaming_grpc.cs deleted file mode 100644 index 89079533de..0000000000 --- a/compiler/tests/generated/streaming_grpc.cs +++ /dev/null @@ -1,300 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - - -namespace tests -{ - using System.Collections.Generic; - - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public static class Foo - { - static readonly string ServiceName = "tests.Foo"; - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo31 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.ServerStreaming, - ServiceName, - "foo31", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo32 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.ServerStreaming, - ServiceName, - "foo32", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo33 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.ClientStreaming, - ServiceName, - "foo33", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo34 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.ClientStreaming, - ServiceName, - "foo34", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_foo35 = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.DuplexStreaming, - ServiceName, - "foo35", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_shouldBeUnary = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.Unary, - ServiceName, - "shouldBeUnary", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_shouldBeStreaming = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.DuplexStreaming, - ServiceName, - "shouldBeStreaming", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - public abstract class FooBase - { - public abstract global::System.Threading.Tasks.Task foo31(global::Bond.Grpc.IMessage request, Grpc.Core.IAsyncStreamWriter> responses, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task foo32(global::Bond.Grpc.IMessage request, Grpc.Core.IAsyncStreamWriter> responses, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo33(Grpc.Core.IAsyncStreamReader> requests, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> foo34(Grpc.Core.IAsyncStreamReader> requests, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task foo35(Grpc.Core.IAsyncStreamReader> requests, Grpc.Core.IAsyncStreamWriter> responses, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task> shouldBeUnary(global::Bond.Grpc.IMessage request, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task shouldBeStreaming(Grpc.Core.IAsyncStreamReader> requests, Grpc.Core.IAsyncStreamWriter> responses, global::Grpc.Core.ServerCallContext context); - } - - public class FooClient : global::Grpc.Core.ClientBase - { - public FooClient(global::Grpc.Core.Channel channel) : base(channel) - { - } - - public FooClient(global::Grpc.Core.CallInvoker callInvoker) : base(callInvoker) - { - } - - protected FooClient() : base() - { - } - - protected FooClient(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) : base(configuration) - { - } - - public virtual global::Grpc.Core.AsyncServerStreamingCall> foo31Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo31Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncServerStreamingCall> foo31Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo31, null, options, request); - } - - public virtual global::Grpc.Core.AsyncServerStreamingCall> foo32Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo32Async(global::Bond.Grpc.Message.Void, new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncServerStreamingCall> foo32Async(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo32, null, options, request); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo33Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo33Async(new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> foo33Async(global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_foo33, null, options); - } - - public virtual global::Grpc.Core.AsyncClientStreamingCall, global::Bond.Grpc.IMessage> foo34Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo34Async(new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncClientStreamingCall, global::Bond.Grpc.IMessage> foo34Async(global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncClientStreamingCall(Method_foo34, null, options); - } - - public virtual global::Grpc.Core.AsyncDuplexStreamingCall, global::Bond.Grpc.IMessage> foo35Async(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return foo35Async(new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncDuplexStreamingCall, global::Bond.Grpc.IMessage> foo35Async(global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncDuplexStreamingCall(Method_foo35, null, options); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> shouldBeUnaryAsync(stream request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return shouldBeUnaryAsync(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncUnaryCall> shouldBeUnaryAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncUnaryCall(Method_shouldBeUnary, null, options, request); - } - - public virtual global::Grpc.Core.AsyncDuplexStreamingCall, global::Bond.Grpc.IMessage> shouldBeStreamingAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return shouldBeStreamingAsync(new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncDuplexStreamingCall, global::Bond.Grpc.IMessage> shouldBeStreamingAsync(global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncDuplexStreamingCall(Method_shouldBeStreaming, null, options); - } - - protected override FooClient NewInstance(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) - { - return new FooClient(configuration); - } - } - - public static global::Grpc.Core.ServerServiceDefinition BindService(FooBase serviceImpl) - { - return global::Grpc.Core.ServerServiceDefinition.CreateBuilder() - .AddMethod(Method_foo31, serviceImpl.foo31) - .AddMethod(Method_foo32, serviceImpl.foo32) - .AddMethod(Method_foo33, serviceImpl.foo33) - .AddMethod(Method_foo34, serviceImpl.foo34) - .AddMethod(Method_foo35, serviceImpl.foo35) - .AddMethod(Method_shouldBeUnary, serviceImpl.shouldBeUnary) - .AddMethod(Method_shouldBeStreaming, serviceImpl.shouldBeStreaming) - .Build(); - } - } - - - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public static class Bar where T : class - { - static readonly string ServiceName = "tests.Bar"; - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_ClientStreaming = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.ClientStreaming, - ServiceName, - "ClientStreaming", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_ServerStreaming = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.ServerStreaming, - ServiceName, - "ServerStreaming", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - static readonly global::Grpc.Core.Method, global::Bond.Grpc.IMessage> Method_DuplexStreaming = new global::Grpc.Core.Method, global::Bond.Grpc.IMessage>( - global::Grpc.Core.MethodType.DuplexStreaming, - ServiceName, - "DuplexStreaming", - global::Bond.Grpc.Marshaller.Instance, - global::Bond.Grpc.Marshaller.Instance); - - public abstract class BarBase - { - public abstract global::System.Threading.Tasks.Task> ClientStreaming(Grpc.Core.IAsyncStreamReader> requests, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task ServerStreaming(global::Bond.Grpc.IMessage request, Grpc.Core.IAsyncStreamWriter> responses, global::Grpc.Core.ServerCallContext context); - - public abstract global::System.Threading.Tasks.Task DuplexStreaming(Grpc.Core.IAsyncStreamReader> requests, Grpc.Core.IAsyncStreamWriter> responses, global::Grpc.Core.ServerCallContext context); - } - - public class BarClient : global::Grpc.Core.ClientBase - { - public BarClient(global::Grpc.Core.Channel channel) : base(channel) - { - } - - public BarClient(global::Grpc.Core.CallInvoker callInvoker) : base(callInvoker) - { - } - - protected BarClient() : base() - { - } - - protected BarClient(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) : base(configuration) - { - } - - public virtual global::Grpc.Core.AsyncClientStreamingCall, global::Bond.Grpc.IMessage> ClientStreamingAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return ClientStreamingAsync(new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncClientStreamingCall, global::Bond.Grpc.IMessage> ClientStreamingAsync(global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncClientStreamingCall(Method_ClientStreaming, null, options); - } - - public virtual global::Grpc.Core.AsyncServerStreamingCall> ServerStreamingAsync(BasicTypes request, global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return ServerStreamingAsync(global::Bond.Grpc.Message.From(request), new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncServerStreamingCall> ServerStreamingAsync(global::Bond.Grpc.IMessage request, global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncServerStreamingCall(Method_ServerStreaming, null, options, request); - } - - public virtual global::Grpc.Core.AsyncDuplexStreamingCall, global::Bond.Grpc.IMessage> DuplexStreamingAsync(global::Grpc.Core.Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return DuplexStreamingAsync(new global::Grpc.Core.CallOptions(headers, deadline, cancellationToken)); - } - - public virtual global::Grpc.Core.AsyncDuplexStreamingCall, global::Bond.Grpc.IMessage> DuplexStreamingAsync(global::Grpc.Core.CallOptions options) - { - return CallInvoker.AsyncDuplexStreamingCall(Method_DuplexStreaming, null, options); - } - - protected override BarClient NewInstance(global::Grpc.Core.ClientBase.ClientBaseConfiguration configuration) - { - return new BarClient(configuration); - } - } - - public static global::Grpc.Core.ServerServiceDefinition BindService(BarBase serviceImpl) - { - return global::Grpc.Core.ServerServiceDefinition.CreateBuilder() - .AddMethod(Method_ClientStreaming, serviceImpl.ClientStreaming) - .AddMethod(Method_ServerStreaming, serviceImpl.ServerStreaming) - .AddMethod(Method_DuplexStreaming, serviceImpl.DuplexStreaming) - .Build(); - } - } - -} // tests diff --git a/compiler/tests/generated/streaming_types.cs b/compiler/tests/generated/streaming_types.cs deleted file mode 100644 index b576554feb..0000000000 --- a/compiler/tests/generated/streaming_types.cs +++ /dev/null @@ -1,26 +0,0 @@ - - -// suppress "Missing XML comment for publicly visible type or member" -#pragma warning disable 1591 - - -#region ReSharper warnings -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable RedundantNameQualifier -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -// ReSharper disable UnusedParameter.Local -// ReSharper disable RedundantUsingDirective -#endregion - -namespace tests -{ - using System.Collections.Generic; - - [global::Bond.Schema] - [System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] - public partial class stream - { - - } -} // tests diff --git a/compiler/tests/schema/service.bond b/compiler/tests/schema/service.bond index efdc68768e..007fb74a8c 100644 --- a/compiler/tests/schema/service.bond +++ b/compiler/tests/schema/service.bond @@ -38,7 +38,7 @@ service Foo bar foo43(BasicTypes); bar foo44(bar); - // test name conflict with gRPC++ cq parameter + // test name conflict with historical gRPC++ cq parameter BasicTypes cq(); // test name conflict with generated MethodTemplate struct names diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b45078e73a..15203f660b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -5,13 +5,8 @@ set (core_schemas set (schemas) list (APPEND schemas ${core-schemas}) -if (BOND_ENABLE_GRPC) - set(grpc-flag GRPC) -endif() - add_bond_codegen (${core_schemas} ENUM_HEADER - ${grpc-flag} OUTPUT_DIR ${BOND_GENERATED}/bond/core) # Generate again into intermediate dir so that we can build libraries @@ -23,7 +18,6 @@ add_bond_codegen (${core_schemas} # in a clean build, leading to collisions in multi-processor build. add_bond_codegen (${core_schemas} ENUM_HEADER - ${grpc-flag} OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bond/core) file (GLOB core_headers "inc/bond/core/*.h") @@ -65,19 +59,6 @@ list (APPEND headers ${protocol_detail_headers} ${stream_headers}) -# grpc-specific headers -if (BOND_ENABLE_GRPC) - file (GLOB ext_grpc_headers "inc/bond/ext/grpc/*.h") - source_group ("ext\\grpc" FILES ${ext_grpc_headers}) - - file (GLOB ext_grpc_detail_headers "inc/bond/ext/grpc/detail/*.h") - source_group ("ext\\grpc\\detail" FILES ${ext_grpc_detail_headers}) - - list (APPEND headers - ${ext_grpc_headers} - ${ext_grpc_detail_headers}) -endif() - source_group ("generated" FILES ${generated_files_types} ${generated_files_apply}) add_library (bond diff --git a/cpp/inc/bond/core/config.h b/cpp/inc/bond/core/config.h index 25673a2a3d..a103845513 100644 --- a/cpp/inc/bond/core/config.h +++ b/cpp/inc/bond/core/config.h @@ -82,11 +82,3 @@ #else #error BOND_DETAIL_HEADER_ONLY_INLINE is already defined #endif - -namespace bond { namespace ext -{ - namespace grpc {} - - namespace gRPC = grpc; - -} } //namespace bond::ext diff --git a/cpp/inc/bond/core/reflection.h b/cpp/inc/bond/core/reflection.h index 53174348a5..5a605e5931 100644 --- a/cpp/inc/bond/core/reflection.h +++ b/cpp/inc/bond/core/reflection.h @@ -144,70 +144,6 @@ const typename FieldTemplate::field = field_ptr; -template struct -method_pointer -{ - typedef void (Service::*type)( - const Input&, - const std::function&); -}; - - -template struct -method_pointer -{ - typedef void (Service::*type)(const Input&); -}; - - -/// @brief Method description in compile-time schema -template < - typename Service, - typename Input, - typename Result, - typename method_pointer::type method_ptr, - const Metadata* metadata_ptr> -struct MethodTemplate -{ - // Note: When introducing new names inside this scope, remember to - // update the methodTemplateReservedNames list in Grpc_h.hs - - /// @brief Type of the service - typedef Service service_type; - - /// @brief Type of the request - typedef Input input_type; - - /// @brief Type of the response - typedef Result result_type; - - /// @brief Static data member describing method metadata - static const Metadata& metadata; - - /// @brief Static data member representing the member pointer to the method - static const typename method_pointer::type method; -}; - - -template < - typename Service, - typename Input, - typename Result, - typename method_pointer::type method_ptr, - const bond::Metadata* metadata_ptr> -const bond::Metadata& - MethodTemplate::metadata = *metadata_ptr; - -template < - typename Service, - typename Input, - typename Result, - typename method_pointer::type method_ptr, - const bond::Metadata* metadata_ptr> -const typename method_pointer::type - MethodTemplate::method = method_ptr; - - // Metadata initializer for fields inline bond::Metadata MetadataInit(const char* name) diff --git a/cpp/inc/bond/ext/grpc/abstract_service.h b/cpp/inc/bond/ext/grpc/abstract_service.h deleted file mode 100644 index 9e73912623..0000000000 --- a/cpp/inc/bond/ext/grpc/abstract_service.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -namespace bond { namespace ext { namespace [[deprecated("Bond-over-gRPC will be removed in the next major version of Bond. See https://github.com/microsoft/bond/issues/1131")]] grpc -{ - namespace detail - { - class service; - - } // namespace detail - - /// @brief Base public class that all Bond grpc++ services inherit. - class abstract_service - { - public: - virtual ~abstract_service() = default; - - abstract_service(const abstract_service& other) = delete; - abstract_service& operator=(const abstract_service& other) = delete; - - private: - friend class detail::service; - - abstract_service() = default; - }; - -} } } // namespace bond::ext::grpc diff --git a/cpp/inc/bond/ext/grpc/basic_thread_pool.h b/cpp/inc/bond/ext/grpc/basic_thread_pool.h deleted file mode 100644 index 4e1c32eb14..0000000000 --- a/cpp/inc/bond/ext/grpc/basic_thread_pool.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -#include "exception.h" - -#if defined (__APPLE__) - // Work-around: 'OSMemoryBarrier' has been explicitly marked deprecated - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #include - #pragma GCC diagnostic pop -#elif defined (_MSC_VER) - #pragma warning(push) - #pragma warning(disable: 4242) // C4242: 'identifier' : conversion from 'type1' to 'type2', possible loss of data - #include - #pragma warning(pop) -#else - #include -#endif - -#include - -#include -#include - -namespace bond { namespace ext { namespace [[deprecated("Bond-over-gRPC will be removed in the next major version of Bond. See https://github.com/microsoft/bond/issues/1131")]] grpc -{ - /// @brief Basic thread pool implementation. - class basic_thread_pool - { - public: - /// @brief Constructs and starts a thread pool with number of threads equal - /// to CPU/cores available. - /// - /// @throws InvalidThreadCount when std::thread::hardware_concurrency returns 0. - basic_thread_pool() - : basic_thread_pool{ std::thread::hardware_concurrency() } - {} - - /// @brief Constructs and starts a thread pool with the specified number of - /// threads. - /// - /// @throws InvalidThreadCount when 0 is specified. - explicit basic_thread_pool(unsigned int numThreads) - { - if (numThreads == 0) - { - throw InvalidThreadCount{}; - } - - auto& service = *_service; - for (unsigned int i = 0; i < numThreads; ++i) - { - service.threads.emplace_back( - [&service] - { - service.run(); - }); - } - } - - /// @brief Schedules a callback for execution. - /// - /// @param callback: functor object to be scheduled. - template - void operator()(Callback&& callback) - { - _service->post(std::forward(callback)); - } - - /// @brief Get the underlying boost::asio::io_service - boost::asio::io_service& get_io_service() - { - return *_service; - } - - private: - struct service : boost::asio::io_service - { - service() - : work{ *this } - {} - - /// Working threads. - std::vector> threads; - /// Helper to keep io_service spinning. - boost::asio::io_service::work work; - }; - - std::shared_ptr _service{ std::make_shared() }; - }; - -} } } // namespace bond::ext::grpc diff --git a/cpp/inc/bond/ext/grpc/detail/client.h b/cpp/inc/bond/ext/grpc/detail/client.h deleted file mode 100644 index c17a1f3311..0000000000 --- a/cpp/inc/bond/ext/grpc/detail/client.h +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -#include "io_manager_tag.h" -#include "serialization.h" - -#include -#include -#include -#include - -#ifdef _MSC_VER - #pragma warning (push) - // warning C4100: unreferenced formal parameter - // - // warning C4127: conditional expression is constant - // - // warning C4702: unreachable code - // - // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) - #pragma warning (disable: 4100 4127 4702 4800) -#endif - -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER - #pragma warning (pop) -#endif - -#include -#include -#include - -#include -#include -#include - -namespace bond { namespace ext { namespace grpc { namespace detail -{ - /// @brief Helper base class Bond grpc++ clients. - /// - /// @note This class is for use by generated and helper code only. - class client - { - public: - client( - std::shared_ptr<::grpc::ChannelInterface> channel, - std::shared_ptr ioManager, - const Scheduler& scheduler) - : _channel{ std::move(channel) }, - _ioManager{ std::move(ioManager) }, - _scheduler{ scheduler } - { - BOOST_ASSERT(_scheduler); - } - - client(const client& other) = delete; - client& operator=(const client& other) = delete; - - client(client&& other) = default; - client& operator=(client&& other) = default; - - protected: -#if !defined(__GNUC__) || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) - using Method = ::grpc::internal::RpcMethod; -#else - // Workaround for a bug in GCC < 7.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67054. - struct Method : ::grpc::internal::RpcMethod - { - using ::grpc::internal::RpcMethod::RpcMethod; - Method(); - }; -#endif - Method make_method(const char* name) const - { - return Method{ name, ::grpc::internal::RpcMethod::NORMAL_RPC, _channel }; - } - - template - void dispatch( - const ::grpc::internal::RpcMethod& method, - std::shared_ptr<::grpc::ClientContext> context, - const std::function)>& cb, - const bonded& request); - - template - void dispatch( - const ::grpc::internal::RpcMethod& method, - std::shared_ptr<::grpc::ClientContext> context, - const std::function)>& cb, - const Request& request = {}) - { - dispatch(method, std::move(context), cb, bonded{ boost::ref(request) }); - } - - template - std::future> dispatch( - const ::grpc::internal::RpcMethod& method, - std::shared_ptr<::grpc::ClientContext> context, - const bonded& request) - { - auto callback = std::make_shared(unary_call_result)>>( - [](unary_call_result response) - { - return response.status().ok() - ? response - : throw UnaryCallException{ response.status(), response.context() }; - }); - - auto result = callback->get_future(); - - std::function)> copyableCallback = - [callback](unary_call_result response) - { - (*callback)(std::move(response)); - }; - - dispatch(method, std::move(context), copyableCallback, request); - - return result; - } - - template - std::future> dispatch( - const ::grpc::internal::RpcMethod& method, - std::shared_ptr<::grpc::ClientContext> context, - const Request& request = {}) - { - return dispatch(method, std::move(context), bonded{ boost::ref(request) }); - } - - private: - class unary_call_data; - - std::shared_ptr<::grpc::ChannelInterface> _channel; - std::shared_ptr _ioManager; - Scheduler _scheduler; - }; - - - /// @brief Implementation class that hold the state associated with - /// outgoing unary calls. - class client::unary_call_data - : public boost::intrusive_ref_counter, - io_manager_tag - { - public: - template - unary_call_data( - const ::grpc::internal::RpcMethod& method, - const ::grpc::ByteBuffer& requestBuffer, - std::shared_ptr<::grpc::CompletionQueue> cq, - std::shared_ptr<::grpc::ChannelInterface> channel, - std::shared_ptr<::grpc::ClientContext> context, - const Scheduler& scheduler, - const std::function)>& cb) - : _cq(std::move(cq)), - _channel(std::move(channel)), - _context(std::move(context)), - _responseReader( - ::grpc::internal::ClientAsyncResponseReaderFactory<::grpc::ByteBuffer>::Create( - _channel.get(), - _cq.get(), - method, - _context.get(), - requestBuffer, - /* start */ true)), - _scheduler(scheduler), - _responseBuffer(), - _status(), - _self(this) - { - BOOST_ASSERT(_scheduler); - - if (cb) - { - _invoke = std::bind(&unary_call_data::invoke, this, cb); - } - - auto self = _self; // Make sure `this` will outlive the below call. - _responseReader->Finish(&_responseBuffer, &_status, tag()); - } - - private: - template - void invoke(const std::function)>& callback) - { - // TODO: Use lambda with move-capture when allowed to use C++14. - _scheduler(std::bind( - [](decltype(callback)& cb, - ::grpc::ByteBuffer& responseBuffer, - ::grpc::Status& status, - std::shared_ptr<::grpc::ClientContext>& context) - { - cb(unary_call_result{ std::move(responseBuffer), status, std::move(context) }); - }, - callback, - std::move(_responseBuffer), - std::move(_status), - std::move(_context))); - } - - /// @brief Invoked after the response has been received. - void invoke(bool ok) override - { - if (ok && _invoke) - { - _invoke(); - } - - _self.reset(); - } - - /// The completion port to post IO operations to. - std::shared_ptr<::grpc::CompletionQueue> _cq; - /// The channel to send the request on. - std::shared_ptr<::grpc::ChannelInterface> _channel; - /// @brief The client context under which the request was executed. - std::shared_ptr<::grpc::ClientContext> _context; - /// A response reader. - std::unique_ptr<::grpc::ClientAsyncResponseReader<::grpc::ByteBuffer>> _responseReader; - /// The scheduler in which to invoke the callback. - Scheduler _scheduler; - /// @brief The response buffer received from the service. - /*::grpc::*/ByteBuffer _responseBuffer; - /// @brief The status of the request. - ::grpc::Status _status; - /// @brief Type-erased function to invoke user-callback for a response. - std::function _invoke; - /// A pointer to ourselves used to keep us alive while waiting to - /// receive the response. - boost::intrusive_ptr _self; - }; - - - template - void client::dispatch( - const ::grpc::internal::RpcMethod& method, - std::shared_ptr<::grpc::ClientContext> context, - const std::function)>& cb, - const bonded& request) - { - new unary_call_data{ - method, - Serialize(request), - _ioManager->shared_cq(), - _channel, - context ? std::move(context) : std::make_shared<::grpc::ClientContext>(), - _scheduler, - cb }; - } - -} } } } // namespace bond::ext::grpc::detail diff --git a/cpp/inc/bond/ext/grpc/detail/io_manager_tag.h b/cpp/inc/bond/ext/grpc/detail/io_manager_tag.h deleted file mode 100644 index 0569777775..0000000000 --- a/cpp/inc/bond/ext/grpc/detail/io_manager_tag.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -namespace bond { namespace ext { namespace grpc { namespace detail { - - /// @brief Interface for completion queue tag types that \ref io_manager - /// expects. - /// - /// Typically, a type inherits from this type, captures at construction - /// time in its locals the state of some operation, and resumes that - /// operation in its implementation of \ref invoke. - struct io_manager_tag - { - io_manager_tag() = default; - - io_manager_tag(const io_manager_tag& other) = delete; - io_manager_tag& operator=(const io_manager_tag& other) = delete; - - virtual ~io_manager_tag() = default; - - /// @brief Called when this instance is dequeued from a completion - /// queue. - /// - /// @param ok whether or not the initial operation succeeded - virtual void invoke(bool ok) = 0; - - /// @return Returns a %tag value suitable for passing to completion queue routines. - io_manager_tag* tag() - { - return this; - } - }; - -} } } } // namespace bond::ext::grpc::detail diff --git a/cpp/inc/bond/ext/grpc/detail/lazy_bonded.h b/cpp/inc/bond/ext/grpc/detail/lazy_bonded.h deleted file mode 100644 index 3f7a9694e3..0000000000 --- a/cpp/inc/bond/ext/grpc/detail/lazy_bonded.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -#include "serialization.h" - -#include -#include - -namespace bond { namespace ext { namespace grpc { namespace detail -{ - template - class lazy_bonded - { - public: - lazy_bonded() = default; - - explicit lazy_bonded(const ::grpc::ByteBuffer& buffer) - : _value{}, - _buffer{ buffer } - {} - - const bonded& get() const - { - TryDeserialize(); - BOOST_ASSERT(_value); - return *_value; - } - - bonded& get() - { - TryDeserialize(); - BOOST_ASSERT(_value); - return *_value; - } - - ::grpc::ByteBuffer& buffer() noexcept - { - return _buffer; - } - - private: - void TryDeserialize() const - { - if (!_value) - { - _value = Deserialize(_buffer); - } - } - - mutable boost::optional> _value; - /*::grpc::*/ByteBuffer _buffer; - }; - -} } } } //namespace bond::ext::grpc::detail diff --git a/cpp/inc/bond/ext/grpc/detail/serialization.h b/cpp/inc/bond/ext/grpc/detail/serialization.h deleted file mode 100644 index db90770037..0000000000 --- a/cpp/inc/bond/ext/grpc/detail/serialization.h +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace bond { namespace ext { namespace grpc { namespace detail -{ - /// @brief A helper wrapper to fix crashing copy .ctor in ::grpc::ByteBuffer - // - // After https://github.com/grpc/grpc/pull/15517 is merged and released, we can - // retire this class. - class ByteBuffer - { - public: - ByteBuffer() = default; - - ByteBuffer(const ::grpc::ByteBuffer& buffer) - { - _buffer = buffer; // The operator= is fine. - } - - ByteBuffer(const ByteBuffer& other) - : ByteBuffer{ other._buffer } - {} - - ::grpc::ByteBuffer* operator&() - { - return &_buffer; - } - - operator ::grpc::ByteBuffer&() - { - return _buffer; - } - - operator const ::grpc::ByteBuffer&() const - { - return _buffer; - } - - private: - ::grpc::ByteBuffer _buffer; - }; - - inline ::grpc::ByteBuffer to_byte_buffer(const OutputBuffer& output) - { - struct Buffers - : boost::intrusive_ref_counter, - boost::container::small_vector - {}; - - boost::intrusive_ptr buffers{ new Buffers }; - output.GetBuffers(*buffers); - - boost::container::small_vector<::grpc::Slice, 8> slices; - slices.reserve(buffers->size()); - - for (blob& data : *buffers) - { - data = blob_prolong(std::move(data)); - - slices.emplace_back( - const_cast(data.data()), // The buffer is not expected to be modified, but - // we have to const_cast because ::grpc::Slice ctor - // only takes void*. - data.size(), - [](void* arg) { intrusive_ptr_release(static_cast(arg)); }, - buffers.get()); - - intrusive_ptr_add_ref(buffers.get()); - } - - return ::grpc::ByteBuffer{ slices.data(), slices.size() }; - } - - template - inline ::grpc::ByteBuffer Serialize(const bonded& msg) - { - OutputBuffer output; - CompactBinaryWriter writer(output); - - msg.Serialize(writer); - - return to_byte_buffer(output); - } - - inline InputBuffer from_byte_buffer(const ::grpc::ByteBuffer& buffer) - { - std::vector<::grpc::Slice> slices; - - auto status = buffer.Dump(&slices); - if (!status.ok()) - { - throw GrpcException{ status }; - } - - const auto length = buffer.Length(); - auto buff = boost::make_shared_noinit(length); - - char* dest = buff.get(); - for (auto& s : slices) - { - std::memcpy(dest, s.begin(), s.size()); - dest += s.size(); - } - - // TODO: create a Bond input stream over ::grpc::ByteBuffer to avoid - // having to make this copy into a blob. - blob data{ buff, static_cast(length) }; - return InputBuffer{ data }; - } - - template - inline bonded Deserialize(const ::grpc::ByteBuffer& buffer) - { - return bonded{ CompactBinaryReader{ from_byte_buffer(buffer) } }; - } - -} } } } //namespace bond::ext::grpc::detail diff --git a/cpp/inc/bond/ext/grpc/detail/service.h b/cpp/inc/bond/ext/grpc/detail/service.h deleted file mode 100644 index 5a2cadac1b..0000000000 --- a/cpp/inc/bond/ext/grpc/detail/service.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -#include "io_manager_tag.h" - -#include -#include -#include - -#ifdef _MSC_VER - #pragma warning (push) - // warning C4100: unreferenced formal parameter - // - // warning C4127: conditional expression is constant - // - // warning C4702: unreachable code - // - // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) - #pragma warning (disable: 4100 4127 4702 4800) -#endif - -#include -#include -#include -#include - -#ifdef _MSC_VER - #pragma warning (pop) -#endif - -#include -#include - -#include -#include -#include - -namespace bond { namespace ext { namespace grpc -{ - class server; - -namespace detail -{ - /// @brief Base class that all Bond grpc++ services implement. - /// - /// @note This class is for use by generated and helper code only. - /// - /// Helper class that codegen uses to generate abstract service classes, - /// which a bond::ext::grpc::server then hosts multiple services. - class service : public abstract_service, private ::grpc::Service - { - class unary_call_data; - - public: - /// @brief Provides access to the raw ::grpc::Service type. - /// - /// @note This method is for use by generated and helper code only. - ::grpc::Service* grpc_service() - { - return this; - } - - Scheduler& scheduler() - { - return _scheduler; - } - - template - std::function)> - static make_callback(void (ServiceT::*callback)(unary_call), ServiceT& svc) - { - BOOST_STATIC_ASSERT(std::is_base_of::value); - return std::bind(callback, &svc, std::placeholders::_1); - } - - protected: - using Method = unary_call_data; - - service(const Scheduler& scheduler, std::initializer_list methodNames) - : _scheduler{ scheduler }, - _cq{ nullptr } - { - BOOST_ASSERT(_scheduler); - AddMethods(methodNames); - } - - private: - friend class grpc::server; - - /// @brief Starts the service. - /// - /// @note This method is for use by generated and helper code only. - /// - /// Typical implementations call queue_receive on all the methods in the - /// service to kick of the process of receiving messages. - virtual void start() = 0; - - /// @brief Starts the receive process for a method. - /// - /// @note This method is for use by generated and helper code only. - /// - /// When a request for the method has been received, \p tag will be - /// added to \p cq. - /// - /// @param methodIndex the index of the method (indices are assigned by - /// the order in which the methods are registered via calls to - /// AddMethod) - /// - /// @param context a fresh ::grpc::ServerContext for the call to populate - /// - /// @param request pointer to a request object to populate - /// - /// @param responseStream pointer to a response stream to populate - /// - /// @param tag the io_manager_tag to include with the completion queue - /// notification - template - void queue_receive( - int methodIndex, - ::grpc::ServerContext* context, - Request* request, - ::grpc::internal::ServerAsyncStreamingInterface* responseStream, - io_manager_tag* tag) - { - BOOST_ASSERT(_cq); - RequestAsyncUnary(methodIndex, context, request, responseStream, _cq, _cq, tag); - } - - void AddMethods(std::initializer_list names) - { - for (const char* name : names) - { - BOOST_ASSERT(name); - - // ownership of the service method is transfered to ::grpc::Service - ::grpc::Service::AddMethod( - new ::grpc::internal::RpcServiceMethod( - name, - ::grpc::internal::RpcMethod::NORMAL_RPC, - nullptr)); // nullptr indicates async handler - } - } - - void SetCompletionQueue(::grpc::ServerCompletionQueue* cq) - { - BOOST_ASSERT(!_cq); - _cq = cq; - } - - Scheduler _scheduler; - ::grpc::ServerCompletionQueue* _cq; - }; - - /// @brief Implementation class that hold the state associated with - /// receiving incoming calls for one method. - /// - /// There only needs to be one of these per method in a service, and it can - /// be re-used for receiving subsequent calls. A new detail::unary_call_impl - /// is created for each individual call to hold the call-specific data. Once - /// the invocation of the user callback along with the call-specific data - /// has been scheduled, unary_call_data re-enqueues itself to get the next call. - class service::unary_call_data : io_manager_tag - { - public: - template - unary_call_data( - service& service, - int methodIndex, - const std::function)>& cb) - : _service{ service }, - _methodIndex{ methodIndex }, - _invoke{ std::bind(&unary_call_data::invoke, this, cb) }, - _receivedCall{} - { - BOOST_ASSERT(cb); - queue_receive(); - } - - private: - template - void invoke(const std::function)>& callback) - { - // TODO: Use lambda with move-capture when allowed to use C++14. - _service.scheduler()(std::bind( - [](const decltype(callback)& cb, boost::intrusive_ptr& receivedCall) - { - cb(unary_call{ std::move(receivedCall) }); - }, - callback, - queue_receive())); - } - - void invoke(bool ok) override - { - if (ok) - { - BOOST_ASSERT(_invoke); - _invoke(); - } - } - - boost::intrusive_ptr queue_receive() - { - boost::intrusive_ptr receivedCall{ _receivedCall.release() }; - - // create new state for the next request that will be received - _receivedCall.reset(new unary_call_impl{}); - - _service.queue_receive( - _methodIndex, - &_receivedCall->context(), - &_receivedCall->request_buffer(), - &_receivedCall->responder(), - tag()); - - return receivedCall; - } - - /// The service implementing the method. - service& _service; - /// The index of the method. Method indices correspond to the order in - /// which they were registered with detail::service::AddMethod - const int _methodIndex; - /// @brief Type-erased function to invoke user-callback for a response. - std::function _invoke; - /// Individual state for one specific call to this method. - std::unique_ptr _receivedCall; - }; - -} } } } // namespace bond::ext::grpc::detail diff --git a/cpp/inc/bond/ext/grpc/detail/unary_call_impl.h b/cpp/inc/bond/ext/grpc/detail/unary_call_impl.h deleted file mode 100644 index 827180a56e..0000000000 --- a/cpp/inc/bond/ext/grpc/detail/unary_call_impl.h +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#pragma once - -#include - -#include "io_manager_tag.h" -#include "lazy_bonded.h" -#include "serialization.h" - -#include - -#ifdef _MSC_VER - #pragma warning (push) - // warning C4100: unreferenced formal parameter - // - // warning C4127: conditional expression is constant - // - // warning C4291: no matching operator delete found; memory will not be - // freed if initialization throws an exception - // - // warning C4702: unreachable code - // - // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) - #pragma warning (disable: 4100 4127 4291 4702 4800) -#endif - -#include -#include -#include -#include - -#ifdef _MSC_VER - #pragma warning (pop) -#endif - -#include -#include - -#include -#include - -namespace bond { namespace ext { namespace grpc { namespace detail -{ - /// @brief Implementation class that holds the state associated with a - /// single async, unary call. - /// - /// Potentually three different objects participate in shared ownership - /// of instances of this class: the user-facing \ref unary_call and \ref - /// shared_unary_call objects, as well as this object itself. - /// - /// To ensure that this instance stays alive while sending a response, - /// unary_call_impl creates itself with a ref count of 1, opposed to the - /// usual 0 that many boost::intrusive_ptr implementations use. When the - /// notification that the response has been sent is dequeued from the - /// completion queue, %invoke() calls %Release() on itself, decrementing - /// the ref count, and allowing the remaining unary_call and - /// shared_unary_call objects, if any, to control lifetime. - class unary_call_impl final : io_manager_tag - { - public: - unary_call_impl() = default; - - const ::grpc::ServerContext& context() const noexcept - { - return _context; - } - - ::grpc::ServerContext& context() noexcept - { - return _context; - } - - ::grpc::ByteBuffer& request_buffer() noexcept - { - return _requestBuffer; - } - - ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer>& responder() noexcept - { - return _responder; - } - - template - void Finish(const T& response = {}) - { - Finish(bonded{ boost::ref(response) }); - } - - template - void Finish(const bonded& response) - { - bool wasResponseSent = _responseSentFlag.test_and_set(); - if (!wasResponseSent) - { - _responder.Finish(Serialize(response), ::grpc::Status::OK, tag()); - } - } - - void Finish(const ::grpc::Status& status) - { - bool wasResponseSent = _responseSentFlag.test_and_set(); - if (!wasResponseSent) - { - _responder.FinishWithError(status, tag()); - } - } - - private: - void invoke(bool /* ok */) override - { - // The response has been sent, so we no longer need to keep - // ourselves alive: release the implicit initial refcount that - // this instance was constructed with. - Release(); - } - - void AddRef() noexcept - { - _refCount.fetch_add(1, std::memory_order_relaxed); - } - - void Release() - { - if (_refCount.fetch_sub(1, std::memory_order_acq_rel) == 1) - { - delete this; - } - } - - void TryFinishWithError() - { - if (_refCount.load(std::memory_order::memory_order_acquire) == 2) - { - // The last user reference has just gone away, but Finish was - // not called. In this case, we are responsible for sending - // an error response and decrementing the final ref - // count. Finish with ::grpc::Status will schedule the send of the - // error response, and notification of completion of the - // send via invoke() will decrement the final ref count. - // Since we hold the ref count ourselves, we will not - // get deleted until we're done sending. - // - // Even when multiple threads enter this case, at most one - // will succeed in sending error, thanks to _responseSentFlag. - - Finish({ ::grpc::StatusCode::INTERNAL, "An internal server error has occurred." }); - } - } - - friend void intrusive_ptr_add_ref(unary_call_impl* call) noexcept - { - call->AddRef(); - } - - friend void intrusive_ptr_release(unary_call_impl* call) - { - call->TryFinishWithError(); - call->Release(); - } - - // A pointer to the context is passed to _responder when - // constructing it, so this needs to be declared before _responder. - ::grpc::ServerContext _context{}; - ::grpc::ServerAsyncResponseWriter<::grpc::ByteBuffer> _responder{ &_context }; - ::grpc::ByteBuffer _requestBuffer; - std::atomic_flag _responseSentFlag = ATOMIC_FLAG_INIT; // Tracks whether any response has been sent yet. - // The ref count intentionally starts at 1, because this instance - // needs to keep itself alive until the response has finished being - // sent, regardless of whether there are any outstanding user - // references still alive. - std::atomic _refCount{ 1 }; - }; - - - template - class unary_call_base; - - template - class unary_call_impl_base; - - template - class unary_call_input_base; - - template - class unary_call_result_base; - - - template