Bundlex v0.1.1 Bundlex.Project behaviour View Source

Link to this section Summary

Types

Type describing project configuration

Type describing NIF configuration keyword list. Configuration consists of fields:

  • sources - C files to be compiled (at least one must be provided),
  • includes - Paths to look for header files (empty list by default).
  • libs - Names of libraries to link (empty list by default).
  • pkg_configs - Names of libraries that should be linked with pkg config (empty list by default).
  • deps - Dependencies in the form {app_name, nif_name}, where app_name is the application name of the dependency, and nif_name is the name of nif specified in bundlex file of this dependency. Sources, includes, libs and pkg_configs from those nifs will be appended. Empty list by default.
  • export_only? - Flag specifying whether NIF is only to be added as dependency and should not be compiled itself. false by default.
  • src_base - Native files should reside in project_root/c_src/<src_base>. Current app name by default

Functions

Returns the bundlex project module of given application. If the module has not been loaded yet, it is loaded from project_dir/bundlex.exs file

Determines if a module is a bundlex project module

Callbacks

Callback returning project configuration

Link to this section Types

Link to this type config_t() View Source
config_t() :: [{:nifs, [{nif_name_t(), nif_config_t()}]}]

Type describing project configuration.

Link to this type nif_config_t() View Source
nif_config_t() :: [
  sources: [String.t()],
  includes: [String.t()],
  libs: [String.t()],
  pkg_configs: [String.t()],
  deps: [{Application.app(), nif_name_t()}],
  export_only?: boolean(),
  src_base: String.t()
]

Type describing NIF configuration keyword list. Configuration consists of fields:

  • sources - C files to be compiled (at least one must be provided),
  • includes - Paths to look for header files (empty list by default).
  • libs - Names of libraries to link (empty list by default).
  • pkg_configs - Names of libraries that should be linked with pkg config (empty list by default).
  • deps - Dependencies in the form {app_name, nif_name}, where app_name is the application name of the dependency, and nif_name is the name of nif specified in bundlex file of this dependency. Sources, includes, libs and pkg_configs from those nifs will be appended. Empty list by default.
  • export_only? - Flag specifying whether NIF is only to be added as dependency and should not be compiled itself. false by default.
  • src_base - Native files should reside in project_root/c_src/<src_base>. Current app name by default.
Link to this type nif_name_t() View Source
nif_name_t() :: atom()

Link to this section Functions

Link to this function get(application \\ MixHelper.get_app!()) View Source
get(application :: atom()) :: {:ok, module()} | {:error, any()}

Returns the bundlex project module of given application. If the module has not been loaded yet, it is loaded from project_dir/bundlex.exs file.

Link to this function project_module?(module) View Source
project_module?(module()) :: boolean()

Determines if a module is a bundlex project module.

Link to this section Callbacks

Callback returning project configuration.