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

1441 Коммитов

Автор SHA1 Сообщение Дата
Eduardo Salinas 3c7bdb9738 [c#] Migrate to VS 2017 csproj
- This change will consolidate the .Net Core into the csproj
- The new csproj is only supported by VS2017 and the .Net Core SDK tooling
- Added new test project coreNS10 to test the Net Standard 1.0 binaries
2018-05-10 09:24:28 -07:00
Christopher Warrington 950c22b9a8 [gbc] Treat Haskell warnings as errors 2018-05-10 00:05:58 -07:00
Christopher Warrington e14543e416 [gbc] Fix some Haskell warnings 2018-05-10 00:02:38 -07:00
Bertus Greeff 6f028f08dd [c# gbc] Add support to generate constructors with parameters
This provides a codegen supported way to construct and initialize C#
classes generated with the --preview-readonly-properties option.

Closes https://github.com/Microsoft/bond/pull/857
2018-05-09 16:36:43 -07:00
Ara Ayvazyan 155d2393bd [c++ grpc] Simplify service_unary_call_data
The change avoids the explicit call to
`service_unary_call_data::queue_receive` in the generated code.
2018-05-09 13:14:02 -07:00
Ara Ayvazyan 6625f63c46 [c++ grpc] Move bond/ext/detail to test/grpc
This change moves all utility types located at bond/ext/detail to test/grpc since they are used only in tests.
2018-05-08 21:18:49 -07:00
Ara Ayvazyan 12e3b4c43d [c++ grpc] Add helper io_manager_tag::tag
This function encapsulates the `static_cast<io_manager*>(thing)` pattern
that was used throughout the codebase.
2018-05-08 21:18:11 -07:00
Christopher Warrington 73f1861e0a [travis] Handle ACR manifest fractional seconds
ACR manifests have started using fractional seconds in their timestamps.
This has broken the fixed format string parsing.

The [%f format specifier][1] will not work in this case, as it accepts
up to 6 digits, but ACR is sometimes sending 7 or more digits. It is
difficult to install Python modules in the environment where the clean
up script runs, so we're limited to vanilla Python 3.

Therefore, this change adds a method that strips out the fractional
seconds. We don't need fractional second precision for deciding whether
or not to prune an old image.

[1]: https://docs.python.org/3.5/library/datetime.html#strftime-and-strptime-behavior
2018-04-25 12:03:06 -07:00
Ara Ayvazyan 101a8f5b7d [gbc c++] Apply export attribute to enum functions
Resolves https://github.com/Microsoft/bond/issues/861
2018-04-24 19:16:52 -07:00
Christopher Warrington 52deb69ded [c++] Use a "variant" for SimpleJsonReader state
A SimpleJsonReader either has an input buffer and an associated stream
or it is a child of some other SimpleJsonReader that will use its
parent's already parsed document. This logic is now more explicit:

* A SimpleJsonReader now either has an input stream XOR a parent
  pointer. This logic is implemented in the helper StreamHolder class.
* detail::RapidJsonInputStream now owns its input buffer instead of
  having a reference to its input buffer.
    * Before, when child SimpleJsonReader instances had their own
      detail::RapidJsonInputStream instances, we needed to be able to
      make cheap copies of detail::RapidJsonInputStream. But, the
      children didn't actually use their stream except to sometimes make
      a deep copy. Since they now just have a pointer to their parent
      which can be used to make a deep copy,
      detail::RapidJsonInputStream can own its buffer: we only copy
      detail::RapidJsonInputStream instances when we need a deep copy.

Also, minor refactoring like the removal of boost::call_traits in favor
of using rvalue references where appropriate.
2018-04-23 16:10:00 -07:00
Christopher Warrington fbe003db85 [c++] Rename scoped_allocator example
Rename the scoped allocator example from "scoped_allocator" to
"scoped_alloc" so that it doesn't conflict with the "scoped_allocator"
header from the C++ standard library.

When `--scoped-alloc` is passed to `gbc`, the generated _types.h header
has a `#include <scoped_allocator>`.

When using CMake to generate Makefiles, the directory where the _types.h
generated file is placed is the same directory where the final
executable is placed.

When rebuilding the scoped_allocator example, the preprocessor tries to
`#include` the previous generated executable.

Implementations of the preprocessor differ in how they handle "file" vs.
<file>. Some will search in the current directory for <file>, while some
will not.

Renaming avoids this problem instead of relying on the behavior of
<file>.
2018-04-19 22:33:12 -07:00
Christopher Warrington f9654f53c6 [c++] Initialize SimpleJsonWriter._count to 0
Avoid any issues with default initialization.
2018-04-19 22:29:12 -07:00
Christopher Warrington c94334232b [appveyor] Use Boost from NuGet packages if needed
The AppVeyor builder images contain some versions of Boost, but not all
the versions that Bond supports for all the compilers that it supports.

This commit:

* Switches to a minimum Boost of 1.61, the minimum supported version as
  of this commit.
* Adds a script to easily find the pre-installed Boost library.
* Adds a script to install a given version of Boost from NuGet.org
  packages.
* Updates the AppVeyor build to install missing versions of Boost from
  NuGet.org.
* Refactors the AppVeyor build to base the MSVC compiler off of the
  `BOND_VS_VERSION` or the `APPVEYOR_BUILD_WORKER_IMAGE` variable, which
  should set us up to add MSVC 2017 to the build later.

This is the AppVeyor side of https://github.com/Microsoft/bond/issues/771
2018-04-19 22:28:08 -07:00
Christopher Warrington 0ee5285d7b [c++] Overhaul bond::maybe
`bond::maybe` now has better support for rvalue-references and allocator
propagation.

This implementation also avoids default initializing an instance of `T`
when creating an maybe that holds nothing

`bond::maybe` is now implemented in terms of `boost::optional`. We should be
able to `std::optional` with minimal effort when Bond requires a minimum
of C++17.

Additional changes:

* Removed a dangerous implicit conversion operator from `bond::maybe<T>`
  to `const T&`. To access a `bond::maybe<T>` value, use
* Added `noexcept` variants of `bond::maybe<T>::value`.
* Added `bond::maybe<T>::emplace` to construct a maybe's value in place.
* Added various rvalue-reference and allocator-aware constructors and
  assignment operators.
* Added `bond::maybe<T>::operator==(const T&)` to compare directly to
  instances of `T`.
* Improved test coverage of `set_value()`: it was only effectively
  constructing a new `T` the first time.
* Added tests for moved-from `bond::maybe` instances.
* Added tests for allocator propagation.
2018-04-18 15:57:52 -07:00
Christopher Warrington 5b41d6141e [travis] Add Boost 1.67.0 to Travis image 2018-04-16 20:26:39 -07:00
Christopher Warrington a256dbc319 [c++] Remove Boost min version from CHANGELOG
This change has not yet been made, as it breaks the current AppVeyor
build.

Issue https://github.com/Microsoft/bond/issues/845 has been opened to
remind us to bump the minimum version later.

[skip ci]
2018-04-10 09:57:45 -07:00
Christopher Warrington 31d7393b14 Update CONTRIBUTION.md with current workflow 2018-04-06 09:31:58 -07:00
Christopher Warrington 2a049104b3 [travis] Consume image with only Boost 1.61+
This image was built from commit 3dc9704e. This image is 0.32 GiB
smaller than the previous one.
2018-04-05 22:09:12 -07:00
Christopher Warrington 3dc9704e9c [travis] Test Boost 1.61+ with clang & g++
Drops support for versions of Boost older than two years. Boost 1.61+ or
newer is now required. (Bond will likely continue to work with older
versions of Boost, but we'll no longer actively test against them.)

Using cron jobs, add coverage for all supported versions of Boost with
both Clang and G++.

This is the Travis-side fix for:
* https://github.com/Microsoft/bond/issues/666
* https://github.com/Microsoft/bond/issues/771
2018-04-05 20:25:17 -07:00
Christopher Warrington 286a400d04 [c++ c#] Remove lingering references to Bond Comm
There were a few lingering references to Bond Comm in the C++ and C#
manuals. They've now been deleted.
2018-04-05 17:21:02 -07:00
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
gwishnie 0a2a76dc65
Merge pull request #843 from chwarr/chwarr/sec-report
Add guidance for reporting security issues
2018-04-05 16:03:28 -07:00
Christopher Warrington e47b30d9a0 Add guidance for reporting security issues 2018-04-05 11:52:41 -07:00
Ara Ayvazyan 4d351d04fa [c++ grpc] Avoid data coping during serialization
* Add `blob_prolong` function.
* Minimize copies when serializing for gRPC
2018-04-04 11:16:21 -07:00
Ara Ayvazyan 8f1b835822 [c++ grpc] Use grpc::ByteBuffer in Serialize 2018-03-30 11:39:02 -07:00
Christopher Warrington 3b829ea850 [travis] Build gRPC++ using latest gRPC master
This build flavor builds Bond with the latest gRPC master branch so we
can detect potential breaks faster than when we upgrade our submodule.

This build flavor isn't needed on every commit or pull request, so it's
only enabled for Travis's cron builds.
2018-03-23 14:09:57 -07:00
Ted Stein 61ec996172 [java travis] Pull down git tags before starting the build
Without this, Java may automatically configure a version string equal to
the checked-out hash prefix, which has a 6/16 chance of starting with a
letter instead of a number. Gradle doesn't seem to resolve dependencies
properly when this happens.

We need the full history so that we have an unbroken chain from the
current commit to the most recent tag.

Fixes https://github.com/Microsoft/bond/issues/835
2018-03-23 11:51:33 -07:00
Christopher Warrington a4e6ca99e4 [travis] Refresh Travis CI image
This uses an image built on 2018-03-22.
2018-03-22 14:48:26 -07:00
Christopher Warrington a747cf0555 [c++ travis] Split C++ build into its own scripts
Splits the C++ build into its own set of scripts, like the other
flavors. This is in preparation for adding another C++ flavor: one that
builds with the gRPC master code instead of the current submodule
version.
2018-03-22 13:51:08 -07:00
Christopher Warrington 7e1f4ad2f5 [travis] Consume image built with headless JDK
This image is a little bit smaller, so should download marginally
faster. It will also help assure we don't take dependencies of libraries
that need an X server.
2018-03-22 13:23:33 -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 eca53e2278 [c#] Handle gbc from path on macOS
On macOS (and likely Linux), when gbc was not found under
BOND_COMPILER_DIRECTORY--typically when it was found on $PATH--the
output directory for the generated C# files ended up having inconsistent
directory separator translation applied to it.

gbc was invoked with an output directory like
`--output-dir="obj/Debug/net45/\."`, which placed the generated files in
a directory *under* `net45` named `\.`. However, when csc was invoked,
it was given generated file paths like `obj/Debug/net45//foo_types.cs`,
which did not exist, causing compilation to fail.

This inconsistency occurred because when the command line for gbc from
$PATH was constructed, none of the elements look like a path, so MSBuild
didn't translate the trailing `\.` added to the output-dir argument:

    <_BondCommand>&quot;$(_BondExe)&quot; $(BondCodegenMode) $(_BondImportDirs) --jobs=-2 --namespace=bond=Bond --output-dir="$(BondOutputDirectory)\."</_BondCommand>

The `\.` was added to guard against $(BondOutputDirectory) ending with a
slash and then having CMD treat a string like
`--output-dir="obj\Debug\net45\"` as having an escaped double-quote in
it.

When gbc came from BOND_COMPILER_PATH, it looked like a path, so the
added `\.` got translated to `/.`

As a fix, the codegen targets now use $(_BondOutputDirectoryNormalized),
which always has a trailing slash and always uses forward slashes.
Windows, macOS, and Linux can all handle forward slashes for paths.
2018-03-12 16:34:42 -07:00
Christopher Warrington 3831969d4b [c#] Automatically find and run C# examples
* Comm examples are excluded, as Comm will be deleted soon.
* The gRPC shared-type-assembly examples are excluded, as they require
  starting two processing in a specific order and console input.
2018-03-12 16:28:59 -07:00
Christopher Warrington 403fb38450 [c#] Split into lines to avoid newline issues
In the protocol_transcoding example, if the source code is checked out
with \n instead of \r\n, it won't match the serialized XML
byte-for-byte. We split both into lines and then compare each line to
avoid this issue.
2018-03-12 16:28:59 -07:00
Christopher Warrington 43a8fcccb1 [c#] Throw instead of Debug.Assert in examples
Switch the C# examples to throw when the conditions they are
demonstrating are violated instead of using Debug.Assert.

Debug.Assert often pops up a UI dialog with the details. The example are
all console applications, and this UI dialog caused them to stall
instead of exiting with a non-zero exit code.
2018-03-12 16:28:59 -07:00
Christopher Warrington 4e201572b2 [c#] Add missing examples to solution
Some newer examples never made it into the cs.sln and weren't being
built.
2018-03-12 16:28:59 -07:00
Christopher Warrington 05b4ee170a [c#] Fully strong-name sign .NET Core assemblies
Previously, we were just [public signing][1] the .NET Core assemblies.
We intended to fully strong-name sign them, so this commit removes the
"publicSign": true entry from the project files.

[1]: ca61bad288
2018-03-12 16:24:18 -07:00
Christopher Warrington b9950c40f5 [cs] Remove implementation-specific behavior
In a [recent commit][1] the contract for the RemoveDuplicates task was
strengthened. So, we're no longer relying on implementation beahvior but
contractual behavior.

[1]: a050dde415
2018-03-08 12:03:39 -08:00
Christopher Warrington a8821da808 [c#] Add automatic codegen for .NET Core projects
* Enabled automatic codegen when implicit inclusion is turned on via the
  MSBuild property EnableDefaultCompileItems
* Added Visual Studio CPS UI integration so that .bond files appear in
  the Visual Studio 2017+ UI.

Fixes https://github.com/Microsoft/bond/issues/636
2018-03-07 14:11:00 -08:00
Christopher Warrington f92e31a209 [c# grpc] Upgrade to gRPC v1.10.0
Fixes https://github.com/Microsoft/bond/issues/812
2018-03-07 12:43:00 -08: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
Christopher Warrington b9b1ff73ed [c++ grpc] Don't ignore dirty grpc submodule
The grpc submodule itself now marks it's zlib submodule as "ignore =
dirty", so we no longer have to do that for grpc just to ignore zlib.
2018-03-07 09:44:23 -08:00
Ara Ayvazyan ddc4855038 [c++] Fix bond::value's move ctor
The change fixes the `bond::value`'s move constructor to actually move
the underlying reader, unless it is a reference type. Also, fixes the
`noexcept` condition for `bond::bonded`'s move constructor that was
missed in 5131a950.
2018-03-06 23:11:02 -08:00
Ara Ayvazyan d679996611 [c++] Fix value::Deserialize of non-mathcing types
The following code does not compile on clang. The issue does not occur
on MSVC and GCC due to active bugs.

    bond::InputBuffer input;
    bond::CompactBinaryReader<bond::InputBuffer> reader{ input };
    bond::value<uint32_t, decltype(reader)&> value{ reader };
    uint8_t var;
    value.Deserialize(var); // Deserialize into a non-matching type

The issue is that all the SFINAE-enabled overloads of `Deserialize`
inside of the base `bond::value_common` and derived `bond::value` have
the same signature (e.g. all use the return type for SFINAE check and
the rest of the signature is identical), so the one in the base class
cannot be found because it will be shadowed by the ones in the derived
ones. The fix is to change the signature of the base `Deserialize` by
using a default parameter for a SFINAE check rather than a return type
so that the function will not be shadowed by derived ones.
2018-03-06 13:51:57 -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
Ara Ayvazyan 5131a95042 [c++] Broken move .ctor of bonded<Reader&>
When moving a bonded<> backed by a reference to a reader, the bonded<>
move ctor wasn't building with Clang and newer versions of MSVC. This
fixes that error by not calling std::move on the reference.
2018-03-05 17:40:05 -08:00
Ara Ayvazyan 391a4c9093 [c++] Add detail::Field helper function
Lifts common code into detail helper functions.

Closes https://github.com/Microsoft/bond/pull/808
2018-03-05 17:40:04 -08:00
Christopher Warrington 067082913b [travis] Delete garbage Docker images for real
Now that the garbage collector script has been running successfully for
a few days and we've validated its results, we can change it to actually
delete images instead of just printing which ones it would delete.

Fixes https://github.com/Microsoft/bond/issues/800
2018-03-05 15:48:35 -08:00