I wrote a library xxx, bootstrapped with rebar3 new lib xxx,
I added an escript to xxx, which I generate with rebar3 escriptize.
The idea is to be able to use the library directly from the command line.
In another project yyy, bootstrapped with rebar3 new app yyy,
I added xxx as a dependency. Is there a way to include the xxx escript
as well?
Right. You said you had an application yyy. You can add that to the application so it copies the xxx script when the library is built as part of the application build process.
Rebar3 does not automatically expose the escript from a library dependency. Escript is a compiled artifact (a standalone .beam-bundle with a main/1 function) and is not automatically propagated via dependencies and it does not copy or build the escript because escriptize is not part of the standard build lifecycle of a library dependency.
Maybe I could try with a custom rebar3 plugin that will run rebar3 escriptize inside the dependency folder and then links the escript to the app bin folder.