Граф коммитов

279 Коммитов

Автор SHA1 Сообщение Дата
Christopher Warrington cc399e2e6d [c# grpc] Add support for streaming methods
* Parser understands the contextual keyword `stream` to indicate whether
  an input or response is a stream of messages.
    * Methods like `stream stream()` and `stream stream stream()` are
      handled properly (the first is a unary method and the second is a
      server stream).
* JSON AST augmented with streaming cardnality.
* C# codegen generates the right code for streaming methods.
* Added streaming and generics C# gRPC examples.
2018-04-05 16:31:47 -07:00
Christopher Warrington e9a9b7c51e [c#] Restore gRPC golden tests for gbc
In commit 3221200462, the gRPC golden tests for gbc were accidentally
removed, as they were being done in a function called
`verifyCsCommCodegen`. This commit restores them.
2018-03-22 09:45:45 -07:00
Christopher Warrington 3221200462 [c++ c#] Remove Bond Comm 2018-03-20 15:42:42 -07:00
Christopher Warrington b8e40d8e7f [gbc] Add debug/release Haskell configurations
We were always building gbc with GHC optimizations turned on. We can get
faster build times for things like CI if we don't build with optimizations.

To do that, we now pass different stack & gbc options for the various
CMake build types. The MSBuild Compiler.csproj project translates
MSBuild configurations into CMake configurations.
2018-03-14 15:44:19 -07:00
Christopher Warrington 4117c04db8 [c++ grpc] Switch to grpcpp include path
The gRPC++ headers were moved from grpc++ to grpcpp as part of [gRPC
proposal L22, "gRPC C++ Public Header Directory Change"][1].

Fixes https://github.com/Microsoft/bond/issues/813

[1]: https://github.com/grpc/proposal/blob/master/L22-change-grpc%2B%2B-dir-name.md
2018-03-07 09:47:09 -08:00
Greg Ravikovich 11904de593 [c++] Upgrade gRPC to version 1.10.0
Fixes https://github.com/Microsoft/bond/issues/810
Closes https://github.com/Microsoft/bond/issues/811
2018-03-06 13:28:38 -08:00
Ted Stein a9167d7ccc [cmake] Print out errors from failed stack steps
Per [cmake docs](https://cmake.org/cmake/help/v3.0/command/execute_process.html), if you set both `OUTPUT_VARIABLE` and `ERROR_VARIABLE` to the same var, it will contain both streams' lines, merged in the order they were printed.
2018-02-13 09:18:07 -08:00
Christopher Warrington 524921206a
[c# grpc] Allow [Bond.Attribute] on methods
* This fixes broken C# codegen when a service method has attributes.
* Add both C++ and C# unit test to make sure that service and method
  attributes are properly generated and accessible.

Fixes https://github.com/Microsoft/bond/issues/617
2017-12-07 17:38:40 -08:00
Christopher Warrington 95c4f9d6e4 [c++ grpc] Fix includes when bond::Void is used
When a service contains events or parameter-less methods, the generated
code uses `bond::Void` as the request/result type. To serialize
`bond::Void`, bond_reflection.h needs to be included.

The generated service code now includes bond_reflection.h if any service
contains an event or a parameter-less method.

Fixes https://github.com/Microsoft/bond/issues/735
2017-12-05 18:07:41 -08:00
Ara Ayvazyan 48c4d43011 [gbc c++] Use Pass0 instead of private counter 2017-12-04 18:06:30 -08:00
Eduardo Salinas 5f82bc68b1 [gbc] Switch from Parsec to Megaparsec
- gbc can only be built with GHC >= 8.0.1
- stack resolver has been updated
- improve error messages
- add a comment about parser ordering to avoid regression
- added python script to compare gbc outputs
2017-12-04 18:00:37 -08:00
Eduardo Salinas ce95a54265 [gbc] Improve parsing of import statements
* [gbc] Improve parsing of import statements
* add optional semi colon after an import statement
2017-11-21 16:30:03 -08:00
Ara Ayvazyan 77424c7ab2 [gbc] Remove redundant import 2017-11-17 15:42:05 -08:00
Ara Ayvazyan 55ca8fa7d1 [c++] Support custom types for enum name/value maps
Currently C++ enum's name-to-value and value-to-name maps use a `std::map`
and are always constructed, even when not used. This change:

- allows the user to provide custom map type (e.g.
  `boost::container::flat_map`)
- lazily constructs the map on first access
- changes the default generated conversion functions to use
  `std::unordered_map`
2017-11-17 11:28:46 -08:00
Ara Ayvazyan 91c3991bb9 [gbc c++] Use init. list for populating attr. map
Currently, `boost::assign::map_list_of` is used to initialize C++ metadata
attribute maps. This change makes use of [list initialization][1] available
in C++11 which is more appropriate and removed the dependency on a Boost
header.

[1]: [http://en.cppreference.com/w/cpp/language/list_initialization
2017-11-16 15:41:50 -08:00
Ara Ayvazyan cfbd4170e0 [gbc c++] Do not apply export attrib. to generics
Currently, the `--export-attribute` is used to mark all static
`bond::Metadata` fields in a compile-time `Schema` object, including when
the type is a template, which is not correct. This change has `gbc` skip the
attribute in such cases.
2017-11-15 14:26:20 -08:00
Ara Ayvazyan 6dadd6cac9 [gbc c++] Use init. list for populating enum maps
Currently, `boost::assign::map_list_of` is used to initialize C++ enum maps.
This change makes use of list initialization[1] available in C++11 which is
more appropriate and avoids an extra dependency on template-heavy Boost
headers.

[1]: http://en.cppreference.com/w/cpp/language/list_initialization
2017-11-15 13:46:10 -08:00
Ara Ayvazyan c88289c242 [gbc c++] Move ToEnum/FromEnum functions to .cpp
The slightly reduces the size of the header that gets included everywhere.
2017-11-10 18:59:30 -08:00
Ara Ayvazyan 653567edc4 [gbc c++] Add option for scoped_allocator_adaptor
C++ codegen now can use std::scoped_allocator_adaptor for strings and
containers when custom allocator is used and the --scoped-alloc flag is
passed to gbc.
2017-11-09 11:32:25 -08:00
Ara Ayvazyan a1e09c49a0 [gbc c++] Add generation of type aliases 2017-11-08 19:03:52 -08:00
Ara Ayvazyan 2e80c74a36 [gbc] Update generated test files 2017-11-03 17:23:13 -07:00
Eduardo Salinas 5131299aa2 [gbc] Add unit tests that covers negative values
- Missing unit tests that cover negative hex and oct values are added
2017-11-03 11:30:11 -07:00
Ara Ayvazyan 8a11835d07 [c++] Generate copy/move ctors with allocator arg
Add the ability to generate copy and move constructors with an allocator
argument. This is behind the gbc flag --alloc-ctors, as the generated copy
and move constructors pass the allocator to the constructors for collection
fields, among others. Not all STL implementations in use by users of Bond
provide these C++11 constructors yet for all collection types. In order to
avoid breaking existing code, these constructors are opt-in.
2017-11-03 11:29:48 -07:00
Ara Ayvazyan 92304051d4 [c++] Cleanup C++11 allocator traits checks 2017-11-02 16:09:40 -07:00
Ara Ayvazyan bae8b6f94e [c++ gbc] Cleanup the use of key comparer ctors
As of C++11, all the standard containers have a constructor that takes just
an allocator. The expectation is that custom containers will also provide
one.
2017-11-02 15:58:15 -07:00
Ara Ayvazyan d9afd92433 [build gbc] Add custom options for Stack 2017-10-31 11:11:46 -07:00
Ted Stein eaf8b3507b Update golden files for Java. 2017-10-30 15:39:01 -07:00
Ted Stein f746ec47ab Merge remote-tracking branch 'ara/docker_use_src_build_script' into jvm_docker 2017-10-30 15:35:25 -07:00
Ara Ayvazyan fa02289f11 [c++] Cleanup C++11 feature checks
Since Bond now requires a C++11 compiler, many of the feature checks for
C++11 can be removed. Bond still supports MSVC 2013, which has some
limitations in its C++11 support, so checks for it to enable work-arounds
are still present.
2017-10-30 13:11:16 -07:00
Christopher Warrington 2f3b7a718b [gbc] Update maintainer in bond.cabal 2017-10-26 17:57:35 -07:00
Ara Ayvazyan 0d911ca9f0 [gbc c++] Add missing move assignment operator
Also handle MSVC 2013, which doesn't support `= default` for move
assignment operators.
2017-10-26 12:34:21 -07:00
Ted Stein 0aa8e6ca79 [java] Implement Serializable for concrete types
The actual serialization is CBv1 marshalling. Attempting to put a
generic Bond-generated type through an API expecting a Serializable will
throw.
2017-10-24 14:45:53 -07:00
Ara Ayvazyan d8d581f177 [gbc c++] Use std::allocator_traits to rebind
C++ codegen now uses C++11's `std::allocator_traits` for rebinding allocator
types instead of the allocator's rebind.
2017-10-24 14:27:55 -07:00
Christopher Warrington a27009c9c3 [c++ grpc] Add shared_unary_call and example 2017-10-23 14:05:36 -07:00
Christopher Warrington 8f275f9a33 [c++] Support non-default-constructable allocators
- Now the generated type's default ctor is only compiled when it is
  actually used. This permits non-default-constructible allocators to be
  used. Ideally, the default ctor would be = default, but that doesn't
  work with MSVC 2013, so this workaround is needed.
- An additional defaulted `_bond_vc12_ctor_workaround_` parameter is
  used as a workaround for a bug in MSVC 2013 which fails to call the
  ctor in some cases.

Closes https://github.com/Microsoft/bond/pull/639
2017-10-16 14:52:42 -07:00
Christopher Warrington f1aa163eb1 [c# grpc] Fix codegen for generic collection args
If a service use a generic type like bond.Box<T> with a collection type
argument as a parameter/return type, the generated code was missing an
import of System.Collections.Generic. This has been fixed.

An example, demonstrating how to use bond.Box to wrap scalar service
arguments has been added. This also serves to test the fixed codegen.

A helper method Bond.Box.Create() has been added to enable creation of
Bond.Box<T> instances via type deduction.

Fixes https://github.com/Microsoft/bond/issues/623
2017-09-29 13:59:59 -07:00
Chad Walters f96af1ffe1 Fix service/method attributes in C# and C++
In C#, attributes are now carried across to the service class and its
member methods. In C++, gRPC-based services now have compile-time metadata
with appropriate attribute support.

Fixes https://github.com/Microsoft/bond/issues/617
Closes https://github.com/Microsoft/bond/pull/618
2017-09-27 16:51:30 -07:00
Simon Gansky def03dcd97 [Java] Changed gbc to output fully qualified String class name 2017-09-26 16:39:22 -07:00
Chad Walters 5f8058753e Add service attribute codegen tests for C# 2017-09-22 11:15:00 -07:00
Simon Gansky 5880d6f349 [Java] Flattened package hierarchy 2017-09-15 14:46:01 -07:00
Ted Stein 6e7c8e2086 java core: Remove RuntimeSchema. 2017-09-14 08:49:31 -07:00
Chad Walters eae2c9aba2 [Java] Add RuntimeSchema untagged deserialization 2017-09-14 08:49:31 -07:00
Christopher Warrington d017dc4403 [gbc] Enable NX and limited ASLR for Windows builds
For Windows builds, pass linker flags to enable NX and as much of ASLR
as we can.
    * We cannot move the base address above 4GiB, as the GHC runtime
      libraries are not compiled to support this.
    * The linker used by GHC doesn't support keeping reloc information
      when emitting PE32+ executables. This will end up limiting the
      effectiveness of ASLR, but we're doing what we can.
2017-09-12 15:03:26 -07:00
Chad Walters eb8276ece4 [Java] Fix SchemaDef struct full name in Java
Make the full name use the IDL namespace (as in C++ and C#). Previous
attempt [https://github.com/Microsoft/bond/pull/567] was broken during CR.
2017-09-05 15:29:43 -07:00
Chad Walters 63cac28afe Add codegen tests for namespace mapping 2017-09-05 15:29:43 -07:00
Ted Stein a08163e546 java codegen: Don't emit backslashes in comments. 2017-08-31 16:44:35 -07:00
Ted Stein 88427c9e16 Move Java world to org.bondlib. 2017-08-23 12:00:46 -07:00
Chad Walters 644fd25380 [Java] Add Blob wrapper class around byte [] 2017-08-21 16:53:07 -07:00
Chad Walters 9e4c9e4241 [gbc] Update SchemaDef struct full name in Java
Make the full name use the IDL namespace (as in C++ and C#).
2017-08-21 15:00:21 -07:00
Ted Stein ecccc90723 java core: Codegen .equals() and .hashCode(). 2017-08-15 16:32:25 -07:00