eproxus / meck

A mocking library for Erlang
http://eproxus.github.io/meck
Apache License 2.0
811 stars 231 forks source link

Compilation results in files under deps/meck being updated #235

Closed deepankar-j closed 2 years ago

deepankar-j commented 2 years ago

When using meck as a dependency and running compilation on our application, we've noticed that meck compilation results in files under deps/meck being updated, along with files under _build//lib/meck. This causes an issue for caching prebuilt dependencies (especially in Docker) because it's not obvious that artifacts need to be preserved from under deps/meck. Once I noticed this issue, I worked around it by caching the deps/meck folder. However, I'm sure others will be tripped up by this problem as well.

Reproduction Steps

  1. Use meck as a dependency
  2. Run mix deps.compile
  3. Observe timestamps on deps/meck/* files.

Expected behavior

All generated files should be under _build/<env>/lib/meck.

Observed behavior

The following files/folders are modified/created within deps/meck.

./deps/meck/_build
./deps/meck/_build/default
./deps/meck/_build/default/lib
./deps/meck/_build/default/lib/.rebar3
./deps/meck/_build/default/lib/.rebar3/rebar_compiler_erl
./deps/meck/_build/default/lib/.rebar3/rebar_compiler_erl/source.dag
./deps/meck/ebin
./deps/meck/ebin/meck_history.beam
./deps/meck/ebin/meck_code.beam
./deps/meck/ebin/meck_expect.beam
./deps/meck/ebin/meck.beam
./deps/meck/ebin/meck_util.beam
./deps/meck/ebin/meck_code_gen.beam
./deps/meck/ebin/meck_cover.beam
./deps/meck/ebin/meck_matcher.beam
./deps/meck/ebin/meck_args_matcher.beam
./deps/meck/ebin/meck_proc.beam
./deps/meck/ebin/meck_ret_spec.beam
./deps/meck/ebin/meck.app

Versions

Mac OS X 11.6

eproxus commented 2 years ago

Not sure what tooling you use here (only normal Mix? Which version?) but I don't think Meck is involved in putting any files anywhere (that's the department of Rebar and Mix).

It looks like an interaction between Mix and its building of Rebar-based software. Perhaps check with the Elixir community? I would imaging any Rebar-based dependency to have this problem in your setup. Meck is not special in this way.

deepankar-j commented 2 years ago

Okay, thanks @eproxus. Yes, I'm using normal mix (v1.12.2). I'll check elsewhere.

eproxus commented 2 years ago

@deepankar-j Let me know if you need any further assistance.