[英]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. 这似乎是Rebar插件的理想选择,所以我创建了一个具有pre_compile
函数的插件,将其放在Git存储库中,并将其作为依赖rebar.config
在其他应用程序的rebar.config
中列出。
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. 但是,必须先编译插件,然后才能加载它,因此,当我运行rebar compile -v
我发现rebar抱怨找不到插件,然后编译了依赖项,然后由于头文件未编译而无法编译我的应用程序已生成。
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? 是否可以通过Rebar插件来完成我要实现的目标,还是需要找到另一种方式来实现?
The plugin_dir
option is your friend: plugin_dir
选项是您的朋友:
{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. 如果Rebar在代码路径中找不到插件,则Rebar将尝试从该源目录编译该插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.