Contexted.Tracer (contexted v0.3.0)

The Contexted.Tracer module provides a set of functions to trace and enforce separation between specific modules, known as "contexts".

This is useful when you want to ensure that certain modules do not reference each other directly within your application.

Link to this section Summary

Functions

To support automatic docs and specs generation in delegated functions inside contexts, all of the modules have to be compiled first.

Trace events are emitted during compilation.

Link to this section Functions

Link to this function

after_compiler(arg)

@spec after_compiler(tuple()) :: tuple()

To support automatic docs and specs generation in delegated functions inside contexts, all of the modules have to be compiled first.

Because of that, we need to run this operation in after compiler callback in two steps:

  1. Remove all contexts beam files.
  2. Generate contexts beam files again.

This is an opt-in step, so in order to enable it, you will have to set this config:

config :contexted,
  enable_recompilation: true
Link to this function

trace(arg1, env)

@spec trace(tuple(), map()) :: :ok

Trace events are emitted during compilation.

trace function verifies if the provided event contains cross-references between two contexts.

If so, raises an error with an appropriate message.