All Projects → MASD-Project → Dogen

MASD-Project / Dogen

Licence: gpl-3.0
Reference implementation of the MASD Code Generator.

Projects that are alternatives of or similar to Dogen

autogenu-jupyter
An automatic code generator for nonlinear model predictive control (NMPC) and the continuation/GMRES method (C/GMRES) based numerical solvers for NMPC
Stars: ✭ 89 (+102.27%)
Mutual labels:  code-generator, code-generation
Xmlschemaclassgenerator
Generate C# classes from XML Schema files
Stars: ✭ 277 (+529.55%)
Mutual labels:  code-generation, code-generator
qm
QM model-based design tool and code generator based on UML state machines
Stars: ✭ 54 (+22.73%)
Mutual labels:  code-generator, code-generation
Kodgen
C++17 parser and code generator
Stars: ✭ 19 (-56.82%)
Mutual labels:  code-generator, code-generation
Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+8927.27%)
Mutual labels:  code-generation, code-generator
nunavut
Generate code from DSDL using PyDSDL and Jinja2
Stars: ✭ 23 (-47.73%)
Mutual labels:  code-generator, code-generation
Efdesigner
Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
Stars: ✭ 256 (+481.82%)
Mutual labels:  code-generation, code-generator
mr.boilerplate
Online app to generate Scala boilerplate
Stars: ✭ 32 (-27.27%)
Mutual labels:  code-generator, code-generation
Loopy
A code generator for array-based code on CPUs and GPUs
Stars: ✭ 367 (+734.09%)
Mutual labels:  code-generation, code-generator
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+7265.91%)
Mutual labels:  boost, osx
copygen
Go generator to copy values from type to type and fields from struct to struct (copier without reflection). Generate any code based on types.
Stars: ✭ 121 (+175%)
Mutual labels:  code-generator, code-generation
Laravel Code Generator
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
Stars: ✭ 485 (+1002.27%)
Mutual labels:  code-generation, code-generator
php-json-schema-model-generator
Creates (immutable) PHP model classes from JSON-Schema files including all validation rules as PHP code
Stars: ✭ 36 (-18.18%)
Mutual labels:  code-generator, code-generation
molicode
molicode
Stars: ✭ 75 (+70.45%)
Mutual labels:  code-generator, code-generation
GraphQL.Tools
GraphQL.Tools is a GraphQL to C# compiler (code-generator) which turns your GraphQL schema into a set of C# classes, interfaces, and enums.
Stars: ✭ 49 (+11.36%)
Mutual labels:  code-generator, code-generation
php-code-generator
PHP code generator library
Stars: ✭ 144 (+227.27%)
Mutual labels:  code-generator, code-generation
tiles
Programmatic code generation
Stars: ✭ 78 (+77.27%)
Mutual labels:  code-generator, code-generation
typed-astunparse
Python 3 AST unparser with type comments support.
Stars: ✭ 27 (-38.64%)
Mutual labels:  code-generator, code-generation
Fpp
Functional PHP Preprocessor - Generate Immutable Data Types
Stars: ✭ 282 (+540.91%)
Mutual labels:  code-generation, code-generator
Codemaker
A idea-plugin for Java/Scala, support custom code template.
Stars: ✭ 440 (+900%)
Mutual labels:  code-generation, code-generator

Dogen Logo

Licence FOSSA Status Status Gitter Issues Contributors PRs Welcome Github All Releases Code Quality: Cpp Codacy Badge Build Dashboard Report CI Build Status Build Status Releases Binaries (Stable) GitHub commits Binaries (Unstable) Language C++ gcc-9 clang-9 msvc2017 Project Stats Readme Score

Overview

Dogen is the reference implementation of the MASD Project code generator. MASD - Model Assisted Software Development - is a new methodology for the development of software systems based on MDE (Model Driven Engineering). The theoretical framework for MASD is under development as part of my PhD thesis, and is not yet ready for public review. However, the development of Dogen remains as it always was, an open source project available to all.

In lay terms, Dogen's objective is to automate the development process as much as possible: the user creates models in one of the supported codecs and respecting a set of predefined restrictions; Dogen then uses this input to generate a source code representation of the model. At present the main frontend is Org Mode, though there is also support for Dia and JSON. Depending on use cases and user demand, other frontends may follow.

The generated code contains most of the functionality required from a typical C++ domain object such as serialisation, hashing, streaming and so on. Whilst we intend for the application to be useful out of the box for most use cases, our end goal is to enable users to extend Dogen, adapting it to the vagaries of their specific needs. Note that Dogen has experimental C# support, but it is not in feature parity with C++ support.

Dogen provides a reference implementation for each supported language, available as a separate git repo:

These are designed to give you a feel for how the generated code will look like, and they attempt to exercise all of Dogen's functionality.

Status

Whilst we welcome users and contributors, we think its important to set clear expectations for the project. At the outset we must stress that Dogen is an academic project at present, with academic goals. That is, our objectives are not (yet) to produce a fully polished tool, ready for end users to work on industrial scale projects. If for whatever reason you decide to use it, bear in mind the following:

  • our goal at present is to work out the MASD conceptual model. We will continue to refactor the code internally until it is consistent with the conceptual model. It will take a long while to get there. This means that adding new features is not a priority for Dogen development (though of course we are gathering a long list of ideas in our product backlog).
  • in our quest for the conceptual model, we have broken and we shall continue to break the API many times. This will manifest itself in having to update user models or in changes in the generated code. Features that have been working thus far may also be deprecated. We provide no guarantees of forward or backward compatibility; there isn't even an effort not to break these - in fact, quite the opposite, if its not in agreement with the conceptual model it must be changed. We do try to highlight these in the release notes.
  • we do have an extensive suite of tests (both generated and handcrafted), but these focus only on Dogen's use cases. If you try any permutations outside these, it is likely you will find problems. The errors you will get will not be the most obvious.
  • there is little to no documentation on Dogen. This will not change until we publish the PhD thesis. Resources are limited and they are all directed to development at present.
  • for this tool to be useful in any way in its present state, you must have a good working knowledge of MDE.

These warnings can probably best summarised as follows: "if it breaks, you get to keep the pieces; and it will break, often". But if you find such things fun, proceed with caution.

Packages

Binary packages are available for each release on BinTray and GitHub (links at the end of each release note). The binaries cover Debian Linux, OSX and Windows - 64-bit only. Packages are also generated for each commit, and placed in BinTry only. Development is done from git master, so latest should always be greatest, but you may want to use packages from the previous sprint rather than what is currently under development (see badges above).


Notes

  • The OSX installer provides you with a DMG. Once you open it in Finder, it mounts under /Volumes/, e.g.:
/Volumes/dogen-${VERSION}-Darwin-x86_64/dogen.app/Contents/Resources/bin

Where ${VERSION} is your Dogen version such as 1.0.30.


Building

In order to build Dogen you will need a C++ toolchain. On Linux and OSX, you'll need a recent compiler with C++ 17 support, such as GCC 8 or Clang 7 - and Ninja or GNU Make. On Windows you'll need Visual Studio 2017. Older compilers may work, but we try to always use the most recent releases in MASD. So, if you can, please try using to those.

Dogen has the following additional dependencies, across all operative systems:

Name Type Version Description
CMake Mandatory 3.12 or later. Required to generate the build files.Earlier versions may also work.
Boost Mandatory 1.68 or later. Earlier versions may also work, but patches may be needed. Very Important: We link statically against Boost at present, so be sure to build and install the static libraries.
LibXml2 Mandatory 2.9.4 Earlier versions may work but haven't been tested.
DTL Mandatory 1.19 Earlier versions may work but haven't been tested.

Though Dogen should build fine with package manager supplied libraries - or even with hand-built dependencies - the easiest way to setup a development environment on all supported platforms is by using vcpkg. We have a vcpkg fork with a MASD Branch that is setup correctly to build both Dogen and the C++ Reference Implementation and is used/validated by our CI. If at all possible, please use this instead of the mainline vcpkg because it contains a few changes that cannot be easily mainlined (C++ 17 on all dependencies, ODB 2.5, etc).

Either way, you can compile vcpkg as per vcpkg documentation, and then install packages by running:

./vcpkg install libxml2 boost-system boost-serialization boost-date-time boost-log boost-filesystem boost-program-options boost-test boost-scope-exit boost-graph boost-uuid boost-di boost-spirit dtl

Notes

  • The default vcpkg triplet on Windows is 32-bit dynamic whereas we build with --triplet x64-windows-static (e.g. add this to the line above if you are on Windows). If you are experiencing weird and wonderful errors building Dogen, check your triplet.
  • If you are on OSX, you probably should rely on the system's LibXML2 (e.g. remove it from the vcpkg list above) or else you may see some interesting linking errors related to iconv.
  • Remember that the recommended compiler for vcpkg on OSX is Homebrew's GCC. If you do decide to use XCode Clang or LLVM Clang, be ready to handle some pain. In addition, beware that for some reason boost does not default to C++ 14. You'll need to add cxxstd=14. Our vcpkg repo has fixes for this.
  • Setting up ODB is not quite as simple as we would like. If you are using a stable version of ODB such as 2.4 you can just install the compiler and libraries from your distribution packages or download the compiler and libraries form the ODB downloads page or even install it from vcpkg (i.e., add libodb libodb-boost libodb-pgsql to the vcpkg line above). However, as ODB 2.4 has limited support for C++ 17, you will likely end up needing the beta version 2.5. This is not as trivial. If you definitely want to do this, follow the instructions in the ODB documentation and then ensure you place the installed files in the path (e.g. setup PATH, CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH accordingly).

Once you have all dependencies set up, you can then clone the repository and create the build directory:

git clone https://github.com/MASD-Project/dogen.git
cd dogen/build
mkdir output
cd output

On Linux and OSX, you can build using GNU Make as follows:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${PATH_TO_VCPKG_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake ../..
make -j${CORES}

Where PATH_TO_VCPKG_DIR is the directory in which you've downloaded and built vcpkg and CORES is the number of cores available on your machine. Alternatively, you can use Ninja:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${PATH_TO_VCPKG_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake ../.. -G Ninja
ninja -j${CORES}

On Windows, the incantation is slightly different:

cmake -DCMAKE_TOOLCHAIN_FILE=${PATH_TO_VCPKG_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static ../.. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15 2017 Win64"
cmake --build . --config Release --target ALL_BUILD

Notes

  • If you are not using vcpkg, you can omit -DCMAKE_TOOLCHAIN_FILE and -DVCPKG_TARGET_TRIPLET. However if the dependencies are not on the standard paths, you must then set CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH accordingly, e.g.:
CMAKE_INCLUDE_PATH=/my/boost/include/path CMAKE_LIBRARY_PATH=/my/boost/lib/path cmake ../..
  • If you are using vcpkg in Windows, make sure you are targeting the right triplet. As explained above. We tend to use x64-windows-static. If you have installed all the libraries (or you are using our export) but somehow CMake just doesn't seem to be able to find them, the likely cause is the wrong vcpkg triplet.
  • Note that we are targeting 64-bit builds (e.g. "Visual Studio 15 2017 Win64"). If you want to do a 32-bit build, you will need to have a vcpkg export built for 32-bits. Note also that if you forget to set the generator, it will default to 32-bits and you'll experience weird and wonderful linker errors.

Testing

If you'd like to run the project tests, execute the target run_all_tests or its abbreviation rat. This is sufficient if you just need to gain some confidence on the code generator as we perform tests against Dogen's own models. However, if you are trying to submit a PR that changes the behaviour of the code generator, you must also run the tests against the C++ and C# reference implementation models, as well as a "Frozen" version of Dogen. For this you need to download the zips or clone the repositories locally:

Then, point the corresponding environment variables to the respective projects directory, e.g.:

export FROZEN_PROJECTS_DIRECTORY=${DIR}/frozen/projects
export MASD_CPP_REF_IMPL_PROJECTS_DIRECTORY=${DIR}/cpp_ref_impl/projects
export MASD_CSHARP_REF_IMPL_PROJECTS_DIRECTORY=${DIR}/csharp_ref_impl/Src

Where DIR is set to the local directory where you placed the repositories. You should then ensure Dogen correctly recognises the additional models (${DIR} being the local directory):

...
-- CMake Version: 3.13.4
-- DOGEN_PROJECTS_DIRECTORY=${DIR}/dogen/projects
-- FROZEN_PROJECTS_DIRECTORY=${DIR}/frozen/projects
-- CPP_REF_IMPL_PROJECTS_DIRECTORY=${DIR}/cpp_ref_impl/projects
-- CSHARP_REF_IMPL_PROJECTS_DIRECTORY=SOME_PATH/csharp_ref_impl/Src
...

Executing the run_all_tests target will now also include the reference implementations. Make sure your changes do not break these models.

Generation

If you'd like to run Dogen to regenerate all of its models, you can do so by using the target generate_all_org or its abbreviation gao. This is useful, for example, to update the models to the latest version of Dogen, or just to see how Dogen works. By default Dogen uses the current built version, but you can also use another. For this you may need to tell CMake of its location by setting CMAKE_PROGRAM_PATH:

CMAKE_PROGRAM_PATH=/path/to/dogen/binary cmake ../..

After regeneration, you can then use git diff to inspect the differences produced by regeneration, if any. The build directory contains all of the logs, under the directory log.

Videos

A number of videos are now available discussing Dogen, gathered under "themed" playlists:

Posts

Over time, a number of assorted blog posts have been published on Dogen, mainly covering its development process:

The release notes are also worth perusing as contain quite a lot of material about Dogen's internals.

Reporting Problems

If you have encountered a failure building Dogen or running its unit tests, please submit a bug report. It must include:

  • the error messages;
  • the versions of all dependencies (compiler, Boost etc);
  • the operative system name and version;

If you find a bug whilst using Dogen with one of your models, please also include:

  • a small model reproducing the problem, called the MWE (Minimum Working Example).
  • the compressed log. By default, dogen creates a directory structure for all of its byproducts, in the folder it was executed from. It has the form dogen.byproducts/cli.generate.MODEL, where MODEL is the file name and extension of the generated model. The log file is stored in this directory, with a name such as cli.generate.MODEL.log.

Bugs can be submitted using github Issues.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].