- 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
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
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
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.
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>.
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
`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.
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]
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
* 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.
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.
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
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.
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.
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.
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.
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>"$(_BondExe)" $(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.
* 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.
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.
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.
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
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
* 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
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.
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.
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.
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