NebulaAPI.CompilerCheck (NebulaAPI v0.6.0)

Copy Markdown View Source

Pure decision logic for the :nebula Mix compiler (Mix.Tasks.Compile.Nebula).

Kept separate from the compiler so it can be unit-tested without touching Mix or .beam files: it works on already-extracted module attributes.

Summary

Functions

Verifies an app's modules. modules_attrs is a list of {module, attributes} where attributes is the persisted attribute keyword list (as returned by module.__info__(:attributes) or the :attributes beam chunk).

Functions

verify(modules_attrs)

Verifies an app's modules. modules_attrs is a list of {module, attributes} where attributes is the persisted attribute keyword list (as returned by module.__info__(:attributes) or the :attributes beam chunk).

Returns one of:

  • {:error, local_modules} — modules with local methods on this build exist, but no module wired a server via nebula_api_server/0 (those RPC workers would never start).
  • {:warn, :server_without_methods} — a server is wired but the app defines no defapi methods at all, so it can never serve anything (likely a leftover nebula_api_server()). Node-independent: an app whose methods are all remote on this build still has defapi, so it does NOT warn.
  • :ok — otherwise.

The caller formats the human message; this stays pure decision logic.