Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
475 lines (318 sloc) 17.4 KB

Configuration

Configuration is specified in the :file:`metaborg.yaml` file at the root of the project.

Format

The configuration is written in YAML, a human-friendly textual data format. YAML is indentation sensitive, be sure to properly indent nested elements with 2 spaces.

We use the commons-configuration2 framework to process configuration, which supports variables, nesting, and lists.

Variables

Any existing configuration option can be used as a variable with the ${var} syntax, for example:

id: org.metaborg:org.metaborg.meta.lang.sdf:${metaborgVersion}
metaborgVersion: 2.0.0-SNAPSHOT

Here, the ${metaborgVersion} variable reference is replaced with 2.0.0-SNAPSHOT when reading the id configuration option. Note that the order in which configuration options and variable references occur does not matter.

The ${path:root} builtin property can be used to point to the root of the language specification. Paths in the configuration must be absolute unless stated otherwise. Use ${path:root}/ to make paths absolute, relative to the project root, where required.

Furthermore, environment variables can be used through ${env:}, for example ${env:PATH}. See the documentation on variable interpolation for more detailed informations on how variables work.

Nesting

Configuration options can be nested by nesting YAML objects, for example:

language:
  sdf:
    version: sdf2

results in the language.sdf.version option being set to sdf2, and can be referenced with a variable using ${language.sdf.version}. The same option can be set in the following way:

language.sdf.version: sdf2

Lists

Lists are supported using the YAML list syntax, for example:

dependencies:
  compile:
  - org.metaborg:org.metaborg.meta.lang.esv:${metaborgVersion}
  - org.metaborg:org.metaborg.meta.lang.nabl:${metaborgVersion}
  - org.metaborg:org.metaborg.meta.lang.test:${metaborgVersion}

results in the dependencies.compile option being set to a list with elements:

  • org.metaborg:org.metaborg.meta.lang.esv:${metaborgVersion}
  • org.metaborg:org.metaborg.meta.lang.nabl:${metaborgVersion}
  • org.metaborg:org.metaborg.meta.lang.test:${metaborgVersion}

Options

All supported configuration options for projects are listed here.

End-user project configuration

An end-user project is a project that contains programs of languages, intended to be developed by an end-user of those languages. The configuration for an end-user project specifies dependencies.

Language specification project configuration

A language specification projectis a project that contains a languages specification, which contain programs of meta-languages, intended to be developed by a language developer. It is a specialization of an end-user project, so all configuration options from end-user projects listed above, can also be used in language specification projects.

The following configuration options are mandatory:

The following configuration options are optional and revert to default values when not specified:

Examples

Our meta-languages and meta-libraries have configuration files which can be used as examples: