简体   繁体   中英

How can I load a Rebar plugin for 'pre-compile' from a dependency?

I have a number of applications that need a header file to be generated before compilation. This seemed to be a perfect candidate for a Rebar plugin, so I created a plugin with a pre_compile function, put it in a Git repository, and listed it as a dependency in rebar.config in the other applications.

However, the plugin must be compiled before it can be loaded, so when I run rebar compile -v I find that rebar complains about not finding the plugin, then compiles the dependency, and then fails to compile my application because the header file has not been generated.

Is there a way to accomplish what I'm trying to achieve with a Rebar plugin, or do I need to find another way to do it?

The plugin_dir option is your friend:

{plugin_dir, "deps/my_plugin/src"}.

That makes Rebar try to compile the plugin from that source directory if it can't find it in the code path already.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM