Skip to content

arizona-framework/arizona_rebar3_plugin

Repository files navigation

Arizona Rebar3 Plugin

An Arizona Framework plugin that integrates rebar3 functionality with the Arizona ecosystem for enhanced development workflows.

Features

Reloader Integration

  • Automatic rebar3 compilation when Erlang files change
  • Configurable rebar3 profiles (test, dev, prod, etc.)
  • Customizable file watching - directories, patterns, debounce timing
  • Hot code reloading - automatically reloads changed modules in the running system
  • Seamless integration with Arizona's reloader system

Installation

Add to your rebar.config:

{deps, [
    {arizona_rebar3_plugin, {git, "https://github.com/arizona-framework/arizona_rebar3_plugin",
                             {branch, "main"}}}
]}.

Usage

Configure the plugin in your sys.config:

[
    {arizona, [
        % ...

        % Configure the rebar3 plugin with reloader feature
        {plugins, [
            {arizona_rebar3_plugin, #{
                reloader => #{
                    profile => default,                 % rebar3 profile to use
                    directories => ["src"],             % directories to watch
                    patterns => [".*\\.erl$"],          % file patterns to match
                    debounce_ms => 100                  % debounce timing
                }
            }}
        ]}
    ]}
].

Configuration Options

Reloader Configuration

Option Type Default Description
profile atom() default Rebar3 profile to use for compilation (test, dev, prod, etc.)
directories [string()] ["src"] List of directories to watch for changes
patterns [string()] [".*\\.erl$"] Regex patterns for files to watch
debounce_ms integer() 100 Milliseconds to wait after file change before triggering reload

Plugin Configuration Structure

-nominal config() :: #{reloader => reloader_config()}.

-nominal reloader_config() :: #{
    profile => atom(),
    directories => [string()],
    patterns => [string()],
    debounce_ms => integer()
}.

How It Works

  1. File Watching: Monitors specified directories for file changes
  2. rebar3 Compilation: Runs rebar3 as <profile> compile when changes detected
  3. Hot Code Loading: Automatically reloads changed modules using code:purge/1 and code:load_file/1
  4. Development Feedback: Provides console output showing compilation results and reloaded modules

Example Output

$ rebar3 as test compile
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling myapp

===> Reloading src/my_module.erl
===> Reloading src/another_module.erl

Development

$ rebar3 compile
$ rebar3 dialyzer

Requirements

  • Erlang/OTP 27+
  • Arizona Framework
  • rebar3

License

Copyright (c) 2025 William Fank Thomé

Arizona is 100% open-source and community-driven. All components are available under the Apache 2 License on GitHub.

See LICENSE.md for more information.

About

A rebar3 plugin for Arizona Framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages