O Language

O Language project files

The library.olp manifest, dependency commands and which fields the current runtime actually uses.

O Language pagesManifests and dependencies
On this page

O Language project metadata is JSON stored in an .olp file. Most package commands default to library.olp in the current working directory.

{
  "package": "sample",
  "publisher": {
    "name": "Example",
    "email": "",
    "github": ""
  },
  "sources": "src",
  "main": "main.ola",
  "requires": [
    {
      "name": "library-name",
      "src": "https://example.org/library.git",
      "filename": ""
    }
  ],
  "compiled": "",
  "install": [],
  "watch": {
    "folder": "",
    "output": ""
  },
  "jobs": [
    {
      "name": "check",
      "command": "go version"
    }
  ],
  "type": "project"
}

Manifest fields

Field Shape Meaning in the source model
package string Project or library name.
publisher object name, email and github metadata.
sources string Source directory recorded in the manifest.
main string Main source path recorded for the project.
requires array Git dependencies with name, src and optional filename.
compiled string Compiled-output path field.
install array String-map entries recorded as install tasks.
watch object folder and output strings.
jobs array Named commands, each with name and command.
type string Project type recorded by the generator, usually library or project.

The manifest parser records several fields that the package commands do not implement. In this revision, olang install acts on requires; it does not build main, apply install tasks, run watch, or use compiled. The dependency’s filename field is not used by this install path.

Dependency commands

Generate a manifest interactively:

olang generate -f library.olp

Install or update its Git dependencies:

olang install -f library.olp

Add a dependency and install it:

olang get -f library.olp library-name https://example.org/library.git

The default library directory is /.olang/lib. The runtime also sets default /.olang/base, /.olang/bin and /.olang/tmp paths. Existing environment overrides are not consistently reflected by the current path helper; inspect the installed runtime if using custom locations.

When a dependency directory already exists, the source attempts to pull its origin remote; otherwise it clones the supplied URL. Dependency source is executable input when loaded into an application. Review the repository before using it.

Project creation and jobs

olang create –name NAME –repo URL clones a project repository. The current implementation removes selected Git and documentation files from the clone, then attempts to install dependencies from the project’s manifest. Use it only for a new disposable project directory.

A jobs entry is a local command. olang job NAME looks it up in the default library.olp and launches it. Inspect the command before running it. The current command accepts an advertised -f option but does not pass that value into the job runner.

The old top-level olang build implementation is commented out in this source revision. A populated compiled field is not evidence that this command exists.