Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve source when building with deterministic option #8632

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/compiler/src/compile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2588,6 +2588,8 @@ compile_info(File, CompilerOpts, Opts) ->
case paranoid_absname(File) of
[_|_] = Source when not IsSlim, not IsDeterministic ->
[{source,Source} | Info0];
[_|_] = Source when IsDeterministic ->
[{source,filename:basename(Source)} | Info0];
_ ->
Info0
end,
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/test/compile_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ file_1(Config) when is_list(Config) ->
%% Test option 'deterministic'.
{ok,simple} = compile:file(Simple, [deterministic]),
{module,simple} = c:l(simple),
[{version,_}] = simple:module_info(compile),
[{version,_},{source,"simple.erl"}] = simple:module_info(compile),
true = code:delete(simple),
false = code:purge(simple),

Expand All @@ -172,7 +172,7 @@ file_1(Config) when is_list(Config) ->
{DetPath, DetTarget} = get_files(Config, Det, "det_target"),
{ok,Det,DetCode} = compile:file(DetPath, [binary]),
{module,Det} = code:load_binary(Det, "", DetCode),
[{version,_}] = Det:module_info(compile),
[{version,_},{source,"deterministic_module.erl"}] = Det:module_info(compile),
true = code:delete(Det),
false = code:purge(Det),

Expand Down
Loading