Browse the documentation

AEL 1.0.0

Compiling

In AEL, the Agent Engineering Language, ael compile checks a project and turns every component into compiled AEL: the form a build, a package or another machine can use without your source.

Most of the time you do not need it: ael build and ael run compile as they go. Compile on its own when you want to keep the compiled form, for example to build on another machine without sending it your source.

Usage

ael compile --target <target> -o build/compiled
ael compile <path> --target <target> -o <dir>
Argument or optionMeaning
[path]The project folder. Without a path, the project in the current folder.
--target <target>The target to compile for, as for ael check. Compiled AEL is checked against its target again when it is built.
-o <dir>The folder to write compiled AEL into.
--jsonA machine-readable report, with any diagnostics.

What it produces

  • Every component. Each component file gets its compiled files, including components that main does not reach. Compiling keeps everything; only a build leaves out what the program does not use.
  • Your folder layout. Compiled files sit at the same relative paths as their source, so the output mirrors your project.
  • Extension files inside their component. An extension file's helpers are compiled into the component they belong to; they get no compiled files of their own.
  • The root files. main.ael, pack.ael and metadata.ael are compiled too, so the output carries the entry point, the package declarations and the project's settings that a build needs.

Compiled AEL holds no source text and no comments. Each compiled component carries a description of its public interface: its inputs and outputs, what it references and the permissions it needs. That lets a build, or a project that uses your package, check calls to it without the source.

What happens first

ael compile runs the same checks as ael check, and writes nothing if the project fails them. It uses only the packages already installed and pinned by your lock files, and it runs none of your code and no package code.

The output folder is never read back as source.

Building from compiled AEL

ael build builds a native program straight from compiled AEL, with no .ael files present:

ael compile --target <target> -o build/compiled
ael build build/compiled --target <target> -o build/support

The build does not take compiled files on trust. It checks each one against its description, rejects files built for another target or changed since they were compiled, and rebuilds the reference map from the compiled files themselves. The program still starts at the project's main: compiled files cannot name a different entry point.