Browse the documentation

Early preview

Creating a project

In the Open Engineering Language, one command creates a ready-to-build project: oel init.

Usage

oel init <name>
oel init <name> --template <template>
Argument or optionMeaning
<name>The project's name. It becomes the name of the new folder and is recorded in metadata.oel.
--template <template>Start from a template instead of the minimal project.
--jsonA machine-readable report of what was created.

What it creates

oel init support creates a folder named support in the current folder, holding the three files every project has at its root:

support/
  main.oel        # main support(): the program's entry point
  pack.oel        # the packages the project uses; empty
  metadata.oel    # the project's name and settings
  • main.oel declares a main that carries the name you gave and does nothing, so the new project checks, builds and runs as it is:
# main.oel
main support() {
    return;
}
  • pack.oel declares no packages. It stays in the project even while it is empty:
# pack.oel
pack { schema = 1; dependencies = []; }
  • metadata.oel records the name you gave, which names main and the program that oel build writes, and the source profile of the project:
# metadata.oel
metadata {
    schema = 1;
    name = "support";
    source_profile = "oel-source/1";
}

The new project is a console program. It opens no network port and adds no server; you add the HTTP package and declare routes only when you want it to serve an API, as Services and APIs shows. A new project has no pack.lock and no .package folder: they appear beside pack.oel when you add the first package with oel pack add.

Every other folder and file is your choice. Project layout shows a larger project.

Names

A project name is an identifier:

  • letters, digits and _, not starting with a digit;
  • at most 64 characters;
  • not a keyword, not _ on its own and not the reserved name print;
  • not main: the name follows main in main.oel, and oel init main is refused, as an entry named main is.

Names are case-sensitive, but oel init refuses a folder name that differs only in letter case from one already beside it, and names that some operating systems reserve for devices, so the new folder means the same thing on every operating system.

It never overwrites

  • If a file or folder with the project's name already exists, oel init stops and changes nothing.
  • The files are prepared beside the new folder, and the folder appears only when all three are complete. You never find a project with one of its root files missing.
  • If it is interrupted, it reports anything it left behind, so you can remove it.

A project for a package

The same project layout serves a package. To build one with oel package, the name in metadata.oel has to be a package name, such as acme/billing: lower case and slash-separated. The package's main then takes the last segment of that name, as in main billing(). Building a package describes the rules.

Next