CS1591 is "Missing XML comment for publicly visible type or member".
Emit a 'pragma warning disable' line in generated C# code so that
projects that build will all warnings enabled don't have to add XML
documentation comments to their Bond-generated files.
Update the codegen golden master test files.
Add the test/codegen/no-warnings target that has all warnings enabled
and warnings as errors so that a new warning will fail to build.
Closes#82.
A temporary workaround until `exceptions` can be built with
`transformers` 0.5. The work is already in progress but it depends on
some bigger changes in transformers-compat
(see https://github.com/ekmett/exceptions/pull/51).
Redefine the Protocol to specify the full type name of protocol reader
and writer, rather than hard-coding bond::Input/OutputBuffer in the
ccodegen template.
The word 'Schema' is a reserved name in Bond lexer because it conflicts
with the Schema struct in the generated C++ code. In order to support
some legacy schema definitions we are relaxing the restriction, allowing
the word to be used as part of namespace identifiers. The word Schema in
a namespace identifier does not conflict with the Schema struct in the
generated C++ code.
Running:
gbc schema --runtime-schema example.bond
will generate SchemaDef for each non-generic struct defined in the .bond
file(s). The SchemaDef(s) will be serialized using Simple JSON protocol
into file(s) named <source-file-name>.<struct-name>.json.
Fixes#75.
The C++ codegen failed to detect the need to generate #include <blob.h>
when the only use of blob was a field with default `nothing`.
For aliases of types that require extra header files the trigger should
be the alias usage rather than alias declaration.
Types of fields of base schema should not be considered.
Unfortunately the conflict between optparse-applicative, which sets an
upper bound on the version the process package dependency and cmdargs
which only has a lower bound is going to reappear on every release of
process.
The problem happens when gbc dependencies are first installed in the
sandbox and then we try to build gbc-tests using the same sandbox.
When generating C++ code with custom allocator (--allocator compiler
flag) two cases resulted in invalid code:
- If the only field that required allocator ctor argument was of a
struct type then the allocator parameter name in the ctor of
containing struct was omitted.
- A field of type alias of a struct type was not initialized with custom
allocator.
In the JSON representation of schema AST the fieldModifier and
fieldAttributes properties can be omitted, simplifying field
representation in the common case.
Add to the documentation an example of AST in JSON format.
CMake uses the `FOLDER` property to group the generated Visual Studio
projects into solution folders.
Removed bond_ and documentation_ prefix from project names. The prefixes
were intended to group projects by name which is no longer necessary.
Incorrect [Type] attribute annotation on fields with default `nothing`
lead to failure to find the type converter for type aliases with a
custom type mapping.
The gbc-tests dependencies require process < 1.3 leading to dependency
conflicts if the sandbox has been first populated with dependencies of
Bond library before configuring the test suite.
This is a (hopefully) temporary workaround until
pcapriotti/optparse-applicative#150 is merged.
- Add support for type mapping specific annotated type name and
declaration type name.
- Rename collection interfaces type mapping.
- Clean up white spaces in the generated _types.cs.
- Allow omitting [Bond.Default] attribute for scalar properties on
interfaces.
Make each generated file comparison into a goldenTest case. Golden files
can be updated/added for changes in codegen/tests using --accept command
line switch.
1) Add custom allocator variant for all C++ cases.
2) Add collection interfaces variant for all C# cases.
3) Generated _apply.h/cpp is not schema content specific so it is
sufficient to test for one schema file.
Some of the functions are used only internally by the parser while
others are used by the built-in codegen templates but are to specific to
expose them as public APIs. If a custom codegen needs similar
functionality it can be easily implemented using the more generic
helpers.
1) When running the generated makefile with multiple jobs the `cabal
install` could start before `cabal sandbox` finished initializing the
sandbox leading to packages being installed globally and not available
during `cabal build` which expects dependencies in the sandbox.
2) Tarvis CI build sometimes would fail because nuget couldn't reach the
online repository. Added `travis_retry` to mitigate the problem.
The cmdargs library silently skips short names for options if more than
one option starts with the same letter. This can lead to inadvertent
breaks when a new option is added, like happened with adding
`--no-banner` option, breaking the short name -n for the `--namespace`
option.
Prelude changes implementing the Functor/Applicative/Monad-Proposal as
well as the Foldable/Traversable-Proposal cause unused import
warnings on GHC 7.10.
Parser:
- map<Alias, T> should be valid for type aliases of the string
type.
C# codegen:
- nullable<Alias> should generate Type? for aliases of scalar
types.
C++ codegen:
- Fields of an alias type can have default value if the aliased type
allows explicit defaults.
- The allocator constructor had unused allocator parameter in some
cases.
The tests compare checked-in generated files with code generated using
the current compiler.
Discrepancy indicates a change in the generated code which may be a
bug or an intentional change. In the latter case the generated file(s)
should be re-generated and updated in the same commit as the change.
Note that the checked-in files are generated with --no-banner option.
AppVeyor:
1. Work around memory limitations in Haskell build
2. Run subset of C# test matrix if the sandbox wasn't in cache
Travis CI
1. Change project type to C++
2. Install Mono manually in Linux
3. Use Clang as C++ compiler
4. cabal install happy
File(s) with the `.json` extension are assumed to contain the JSON
representation of schema abstract syntax tree in the format produced by
`gbc schema`
The Generic instance is needed only to derive generic implementations of
FromJSON and ToJSON typeclasses so we move the declarations to
Schema/JSON.hs and only derive Generic for data types that need it.
Derived show typeclass for schema types in order to support QuickCheck.
Added custom ShowPretty typeclass for printing Declarations in parser
error messages. Implemented custom JSON parsing for types that had
custom JSON serialization.
The schema AST is written in JSON format. We foresee two classes of
scenarios that will use it.
Tools that need to process Bond schema files using languages other than
Haskell can avoid recreating Bond parser. Example might be schema
repositories, lints, etc.
The schema AST will also be used to allow users to inject schema
transformations into codegen process. This in many cases can be a
lightweight alternative to custom codegen.
In some scenarios the hierarchy of schemas may be very interconnected
and redundant parsing of the same imported files is a huge performance
overhead for code generation (this change showed 20x improvement when
compiling a sample set of ~900 interconnected schemas).
When compiling multiple .bond files at once, the `--jobs=[NUM]` command
line option can be used to specify how many jobs should be run
concurrently. When used without arguments, the default is to run as many
jobs as there are processors. The option also accepts negative numbers
to specify fewer jobs than the number of processors. Often the optimal
performance is achieved by leaving one or more cores for other processes
on the machine.
Made the following changes for the open source AppVeyor plan which
runs on very slow and memory limited VMs:
- Limit ghc heap size to 192MB when installing dependencies
- Use `appveyor DownloadFile` instead `Start-Download`
- Download Boost in the smaller 7Zip format
- Cache cabal sandbox and boost download
- Disable C++ build
The cabal version 1.20+ was required only for the --required-sandbox
flag. However since the make files are setting up the sandbox we know
that we are always building using sandbox. The current Haskell Platform
comes with cabal 1.18 so this way installing cabal update is not needed.
This change fixes a bug in lookup of an unqualified symbol from an
imported schema file when one of the files is using a language specific
namespace. Language specific namespaces are not documented and their
use is not recommended, but the compiler supports them for backward
compatibility with legacy code.
The bug in the parser caused it to interpret any default value starting
with the letter L as a string literal, resulting in a parsing error for
constructs like:
struct Foo
{
0: Verbosity verbosity = Low;
}
CMake Visual Studio generator translates add_custom_command into a batch
file embedded in Visual Studio project. Batch files have problems with
paths that contain non-ascii characters because they are limited to DOS
encoding. It so happens that cabal is quite likely to be installed in
such a path because by default cabal installs into a directory under
%APPDATA% which contains user name. As a workaround we execute cmake
scripts as a custom commands and depend on CMake cache to get access to
variables set during configuration. This way embedded batch files are
free of non-ascii characters.