ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
580 stars 238 forks source link

Generated parser file not found when switching between test mode and non-test mode #802

Closed darkling closed 5 years ago

darkling commented 6 years ago
$ make
[... success ...]
$ make check            # The first time fails
 GEN    clean-app
 GEN    coverdata-clean
make[1]: Entering directory '/home/hrm/nightglass/software/childe/deps/erlsom'
[...]
 ERLC   childe.erl childe_app.erl childe_cell_formatter.erl childe_data_load.erl childe_instance.erl childe_lexer.erl childe_logger.erl childe_parser_tests.erl childe_pi.erl childe_pretty.erl childe_pretty_gen.erl childe_proc.erl childe_report_eval.erl childe_report_formatter.erl childe_roster.erl childe_semantic.erl childe_sup.erl childe_trace.erl childe_types.erl childe_parser.erl
src/childe_parser.erl: no such file or directory
make[1]: *** [erlang.mk:5228: ebin/childe.app] Error 1
make: *** [erlang.mk:5337: test-build] Error 2
$ make check            # The second time succeeds
 GEN    clean-app
 GEN    coverdata-clean
make[1]: Entering directory '/home/hrm/nightglass/software/childe/deps/erlsom'
[...]
 XYRL   childe_parser.yrl
[...]
 DEPEND childe.d
 ERLC   childe.erl childe_app.erl childe_cell_formatter.erl childe_data_load.erl childe_instance.erl childe_lexer.erl childe_logger.erl childe_parser.erl childe_parser_tests.erl childe_pi.erl childe_pretty.erl childe_pretty_gen.erl childe_proc.erl childe_report_eval.erl childe_report_formatter.erl childe_roster.erl childe_semantic.erl childe_sup.erl childe_trace.erl childe_types.erl
 APP    childe
 GEN    test-dir
[... success ...]

And similarly going in the other direction -- from this state, the first run of make fails with src/childe_parser.erl: no such file or directory. The second run succeeds.

Using the most recent erlang.mk.

Makefile.txt

essen commented 6 years ago

In that situation the actual clean should probably occur in a separate make invocation (erlang.mk can detect and act accordingly). Can you perform a small experiment where you put app:: ; $(MAKE) clean at the beginning of your Makefile when you switch from one to the other to see if it works like this?

darkling commented 6 years ago

No, that doesn't seem to help.

$ make distclean
[...]
$ make ct
[...]
$ make escript
make[1]: Entering directory '/home/hrm/nightglass/software/childe/deps/erlsom'
make[1]: Leaving directory '/home/hrm/nightglass/software/childe/deps/erlsom'
make[1]: Entering directory '/home/hrm/nightglass/software/childe/deps/argparse'
make[1]: Leaving directory '/home/hrm/nightglass/software/childe/deps/argparse'
make[1]: Entering directory '/home/hrm/nightglass/software/childe/deps/rset'
make[1]: Leaving directory '/home/hrm/nightglass/software/childe/deps/rset'
make[1]: Entering directory '/home/hrm/nightglass/software/childe/deps/tabular'
make[1]: Leaving directory '/home/hrm/nightglass/software/childe/deps/tabular'
make clean
make[1]: Entering directory '/home/hrm/nightglass/software/childe'
 GEN    clean-app
 GEN    clean-test-dir
 GEN    coverdata-clean
make[1]: Leaving directory '/home/hrm/nightglass/software/childe'
 GEN    clean-app
 GEN    clean-test-dir
 GEN    coverdata-clean
 ERLC   childe.erl childe_app.erl childe_cell_formatter.erl childe_data_load.erl childe_instance.erl childe_lexer.erl childe_logger.erl childe_parser_tests.erl childe_pi.erl childe_pretty.erl childe_pretty_gen.erl childe_proc.erl childe_report_eval.erl childe_report_formatter.erl childe_roster.erl childe_semantic.erl childe_sup.erl childe_trace.erl childe_types.erl childe_parser.erl
src/childe_parser.erl: no such file or directory
make[1]: *** [erlang.mk:5228: ebin/childe.app] Error 1
make: *** [erlang.mk:4988: app] Error 2

Makefile.txt for reference

essen commented 6 years ago

Hmm a bit surprising. OK well the easiest way to get this fixed would be for you to send a PR with a failing test case and then I can look in more details. I don't have an application doing this at the moment.

darkling commented 6 years ago

OK. I'll see what I can come up with.

crownedgrouse commented 6 years ago

See also #710

essen commented 6 years ago

I knew I heard about this one before. I'll take a look tomorrow.

essen commented 5 years ago

I've fixed this.