# `mix compile.mojoler`
[🔗](https://github.com/thanos/mojoler/blob/v0.1.0/lib/mix/tasks/compile/mojoler.ex#L1)

Builds the Mojo NIFs into `priv/native`.

This is the `Mix.Task.Compiler` callback `c:Mix.Task.Compiler.run/1`.
Mix calls it because `mix.exs` appends `:mojoler` to the compiler list.
A second run with the same sources, headers, and compiler returns `{:noop, []}`.

The callback receives the compiler argv and ignores it. It returns one of:

  * `{:ok, []}` after a build
  * `{:noop, []}` when the fingerprint and the libraries are unchanged
  * `{:error, [diagnostic]}` when the VM has already loaded a library that
    would be replaced, or when `mojo build` fails

`diagnostic` is a `Mix.Task.Compiler.Diagnostic`. The fields this task sets
are:

  * `:file` — `priv/native` or `scripts/build-native.sh`
  * `:severity` — `:error`
  * `:message` — the build or load failure
  * `:position` — `0`
  * `:compiler_name` — `"mojoler"`

## Examples

    iex> Mix.Tasks.Compile.Mojoler.run([])
    {:noop, []}

# `run`

```elixir
@spec run([String.t()]) ::
  {:ok, []} | {:noop, []} | {:error, [Mix.Task.Compiler.Diagnostic.t()]}
```

Runs the native build.

`args` is the compiler argv. It is ignored. There is no optional argument
beyond that ignored list.

See the module docs for the return values and the diagnostic fields.

## Examples

    iex> Mix.Tasks.Compile.Mojoler.run(["--force"])
    {:noop, []}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
