Rebar3 does not support the {clean_files, []}. option

rebar does support this option. Does Rebar 3 not support it? What’s a better alternative, I work on windows and linux

1 Like

if you are meaning clean compile file, I always rm -rf :rofl:

1 Like

I want to use rebar3 clean -a to clean up the project

1 Like

I’m not 100% sure if this is the equivalent but I use post hooks on clean to clean extra files. These support custom commands for different targets. For example:

{post_hooks, [
  {"(linux|darwin|solaris)", clean, "rm ./my_file"},
  {"(linux|darwin|solaris)", clean, "make -C c_src/ clean"},
]}.
3 Likes

What is rebar3 clean -a not doing, that you think it should be doing?

2 Likes

rebar can specify a clean list like {clean_files, ["*.dump", "rebar.lock", "log/*"]}. in rebar.config to clear the files or folders when the rebar clean command is executed

I don’t want to write Windows and linxu delete commands in the rebar.config

2 Likes

To avoid Windows / Linux specific code you could add your own ‘generic’ code in the rebar.config.script that calls out to the erlang file module that references your clean_files configuration. Like:

FilesToClean = lists:keyfind(clean_files, 1, CONFIG),
[file:delete(File) || File <- FilesToClean].

Might need add some logic to call out to filelib to get wild cards working though.

2 Likes

Thank you for both solutions

2 Likes