Skip to content

Project structure

Denis Zdorovtsov edited this page May 30, 2017 · 5 revisions

FlappyTools project is a directory containing configuration directory "flappy_conf". All the configuration files are common json files. Project configuration should contain general(base) configuration file with name general.json other configurations can have custom names and used optional.

Configuration

First I have to introduce such term as "Configuration chain". The idea of configuration chaining is simple. We just take several json files and merge them in predefined order. The idea is similar to OOP inheritance, but order or inheritance is defined outside of configuration files by user and generation logic similar to decorator pattern. Once all configuration files are merged, you have full configuration in order to generation of the target project.

All configuration files are merged in next order:

  • ~/.config/flappytools/global.json - generated during installation and contains global configuration for whole system. For example, path to java or Android SDK can be placed there.
  • template/default.json - every template has it's own predefinitions, that can be used as base for your configuration
  • project/flappy_conf/general.json - base project configuration
  • project/flappy_conf/ - custom config, overriding all previous and can be optional merged.

Template just uses merged config during generation and can substitute configurations to decried places.

Modules

Modules support in very important thing for sharing of code, testing. And, of course, mechanism of module generation for targets also supported. In most cases modules are compiled as shared or static libraries, but other options also possible, depending of target platform.

In FlappyTools modules are considered as usual projects and processed using same mechanism as other template dirs. Usually, project template stores module and project template separately and combines them during generation.

List of used modules is placed in the root of configuration file in array field "modules" consisting of json objects with references to modules. In order to refer to a module it's enough to enter relative path to it in "path" field. I'm thinking about to give user ability refer to repositories as it's implemented in npm (nodejs package manager).

Clone this wiki locally