Examples.EHotReload (gt_bridge v0.18.0)

Copy Markdown View Source

I test the hot-reload system end-to-end against a real dependency.

HotReloadTest is a path dep under fixtures/ with a struct (Config) and a struct caller (Builder). Examples modify its source, verify the change took effect, then revert. Running examples leaves no traces.

All mutation examples go through with_reload/3 which handles the write-compile-revert cycle. Each example only specifies what to change and what to observe.

Summary

Functions

I add a brand-new module and verify its beam lands in the app's ebin: a new module is in no app spec, so per-module app resolution skipped it and it existed only in memory until the next full mix compile. Reverting removes the module, which must delete the beam again. Returns the new module's beam exports.

I remove a module from a file and verify the reload purges it: the compile result is the file's full module set, so a module absent from it was deleted from the source. Message-driven - I wait on the broker's own events (no sleeps) and sync the projection with a get_state barrier before reading it. Returns the app's surviving module names.

Callback implementation for ExExample.Behaviour.copy/1.

Callback implementation for ExExample.Behaviour.rerun?/1.

Functions

__ex_example__new_module_beam_persisted__()

I add a brand-new module and verify its beam lands in the app's ebin: a new module is in no app spec, so per-module app resolution skipped it and it existed only in memory until the next full mix compile. Reverting removes the module, which must delete the beam again. Returns the new module's beam exports.

__ex_example__removed_module_purged__()

I remove a module from a file and verify the reload purges it: the compile result is the file's full module set, so a module absent from it was deleted from the source. Message-driven - I wait on the broker's own events (no sleeps) and sync the projection with a get_state barrier before reading it. Returns the app's surviving module names.

add_function()

@spec add_function() :: [{atom(), non_neg_integer()}]

beam_persisted()

@spec beam_persisted() :: [{atom(), non_neg_integer()}]

copy(item)

Callback implementation for ExExample.Behaviour.copy/1.

modify_function()

@spec modify_function() :: String.t()

new_field_propagates()

@spec new_field_propagates() :: String.t()

new_module_beam_persisted()

@spec new_module_beam_persisted() :: [{atom(), non_neg_integer()}]

removed_module_purged()

@spec removed_module_purged() :: [String.t()]

rerun?(_)

Callback implementation for ExExample.Behaviour.rerun?/1.

resolve_source()

@spec resolve_source() :: {String.t(), String.t()}

revert_clean()

@spec revert_clean() :: [{atom(), non_neg_integer()}]

standalone_module()

@spec standalone_module() :: keyword()