[erlang-questions] Question about per file compile options

Michael Kokich mkokich@REDACTED
Wed Feb 22 21:05:04 CET 2017


Hi everyone

I'm hitting up against against how Erlang passes compile options to parse_transform and was wanting some guidance.

I'm making changes to lager's parse_tranform and I'm making eunit tests to check these changes. The changes involve setting compile options to add extra metadata to logging calls, such as the example below.

{erl_opts, [
  {parse_transform, lager_transform},
  {lager_function_transforms, [
    {metadata_value, {module_name, function_name}}
  ]}
]}.

One of these tests involves calls to a undefined Module:Function and I need to apply the transform only to the specific test file since this will break all the other tests.

If I set lager_function_transforms in lager's rebar.config eunit_compile_opts it applies the transforms to all  the tests with -compile([{parse_transform, lager_transform}]). If I supply these options to the -compile, they don't appear in the options provided to the parse_transform.

-compile([
  {parse_transform, lager_transform}, % If you don't supply this to the test file it won't transformed
  {lager_function_transforms, [ % But these options seem to be ignored
    {metadata_value, {module_name, function_name}}
  ]}
]).

Is there a way a to compile these new tests with my specific settings without applying them globally, or having to compile them separately?

Thank you
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170222/0e291e7b/attachment.htm>


More information about the erlang-questions mailing list