Mix compiler integration for Roux languages.
Discovers source files, updates inputs, dispatches compile queries, and
persists state across VM restarts via a manifest. The incrementality
logic lives in Roux's validation pipeline — this module orchestrates
the top-level compile flow, on a Roux.Session: the files are synced
into the :source_text input by Roux.Sources (a file whose stamp
held is not read; one rewritten with the same content changes
nothing), and a run that changed nothing writes nothing.
Configuration
Add :roux to your project's compilers list and configure languages
via the :roux key in project/0:
def project do
[
compilers: [:roux] ++ Mix.compilers(),
roux: [
languages: [MyLang, AnotherLang],
source_dirs: ["lib", "src"] # optional, defaults to ["lib"]
],
# ...
]
endLanguages compiled after it
The compiler runs before :elixir, so the project's Elixir code can
call what it compiles; but a language is Elixir code, and often the
project's own, compiled by :elixir. It runs only languages compiled
against this roux (Roux.Query.format/0): one not compiled yet (a
cold build), or compiled against a roux of another definition format
(an upgrade, after which Mix recompiles what uses roux), is compiled
only once :elixir has run. When :elixir follows :roux in the
project's compilers, the run waits for it
(Mix.Task.Compiler.after_compiler/2), and compiles the sources then;
a language still not ready then is an error. Otherwise a language not
compiled yet compiles nothing, and one of another format is an error.
Summary
Functions
Removes the manifest file.
Compiles with the given Roux configuration.
Returns the list of manifest file paths managed by this compiler.
Runs the Roux compiler.
Functions
@spec clean() :: :ok
Removes the manifest file.
@spec compile(keyword()) :: {:ok, [Mix.Task.Compiler.Diagnostic.t()]} | {:error, [Mix.Task.Compiler.Diagnostic.t()]} | {:noop, []}
Compiles with the given Roux configuration.
Accepts a keyword list with :languages and :source_dirs keys.
Returns {:ok, diagnostics}, {:error, diagnostics}, or {:noop, []}.
@spec manifests() :: [String.t()]
Returns the list of manifest file paths managed by this compiler.
@spec run(list()) :: {:ok, [Mix.Task.Compiler.Diagnostic.t()]} | {:error, [Mix.Task.Compiler.Diagnostic.t()]} | {:noop, []}
Runs the Roux compiler.
Reads configuration from the :roux key in Mix.Project.config/0 and
delegates to compile/1.