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

1231 Коммитов

Автор SHA1 Сообщение Дата
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
Ted Stein dfccf4f832 [travis] Add debugging info for gradle install failures 2018-03-02 19:20:17 -08:00
Ara Ayvazyan 183f339007 [c++] Remove is_blob/is_nullable traits
The blob and nullable types are not customizable. Also is_blob and
is_nullable traits are not part of container concept.

Closes https://github.com/Microsoft/bond/pull/805
2018-02-27 16:58:44 -08:00
Christopher Warrington 19988168cd [travis] Add garbage CI image clean up script
Every change (well, most every) to the master branch produces a new
Docker image (for our Linux CI builds). However, we don't use each new
image. Instead, occasionally someone updates .travis.yml to point to a
new image. Thus, there's a build up of Docker images in the repository
that aren't being used.

These images are garbage: garbage in the sense that they're not
reachable from any of the .travis.yml roots.

This commit adds a script that can be used to find and remove these
garbage images.

Given a set of filters to find root commits (e.g., we can specify all
tags and all commits in the past two weeks), the script finds all the
referenced Docker images in the various revisions to .travis.yml. It
then compares the referenced images to those present in the repository,
skips images that are too new to be collected, and--for now--prints the
`az` CLI command to remove that image.

The `az` CLI is implemented in Python, so Python is going to be
available wherever `az` is. Since this script was a bit too complicated
for a shell script, Python 3 was chosen as its implementation language.

This script is intended to be run inside a VSTS build using the Azure
CLI task [1]. However, it will work anywhere that `az login` has been
run and given credentials with read/write access to the
bondciimages.azurecr.io repository.

[1]: https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/AzureCLI/Readme.md
2018-02-27 16:01:51 -08:00
Ara Ayvazyan 92b2bfe928 [c++] Fix To::UnknownField to do not use ellipses 2018-02-27 13:28:36 -08:00
Ara Ayvazyan 4f4b9b1d90 [c++] Fix missing Protocols type arg in Merger 2018-02-20 17:54:09 -08:00
Ted Stein b6162e5cac Recommend to install the latest stack in README
Recommend curlbashing Stack instead of package management in the README. We
already do this for our CI image.
2018-02-20 17:51:42 -08:00
Christopher Warrington 6faa185444 [git] Make Linux scripts always use LF
Linux scripts need to always have LF. If not, things like building a
Docker image from Windows will result in un-runable scripts. Update
.gitattributes so these files are always checked out LF.
2018-02-16 14:05:04 -08:00
Christopher Warrington c7bb8f6385 [git] Update .gitattributes with new extensions
Since we've added Java, some new "known-to-be-text" files exist in the
repository.
2018-02-16 14:05:04 -08:00
Christopher Warrington 1da827d0e3 [git] Fix globs in .gitattributes
The globs in .gitattributes were missing the leading * to match files.
2018-02-16 14:05:04 -08:00
Christopher Warrington 230b341565 [travis java] Switch to openjdk-8-jdk-headless
Use the "headless" JDK in the Travis CI image to avoid installing a
bunch of X11 (and related) packages that we don't need. This also
reduces the size of the image.

After getting this commit into master, the next step is to wait for a
new image to be built and then consume that image in .travis.yml.

[skip ci]
2018-02-13 14:18:55 -08:00