Current section

13 Versions

Jump to

Compare versions

4 files changed
+43 additions
-16 deletions
  @@ -1,6 +1,20 @@
1 1 # Changelog
2 2
3 - ## [0.8.7](https://github.com/clojerl/rebar3_clojerl/tree/0.8.7)
3 + ## [0.8.8](https://github.com/clojerl/rebar3_clojerl/tree/0.8.8)
4 +
5 + [Full Changelog](https://github.com/clojerl/rebar3_clojerl/compare/0.8.7...0.8.8)
6 +
7 + **Closed issues:**
8 +
9 + - Verification that checks if file should be compiled fails [\#120](https://github.com/clojerl/rebar3_clojerl/issues/120)
10 + - Sort files that are going to be compiled [\#118](https://github.com/clojerl/rebar3_clojerl/issues/118)
11 +
12 + **Merged pull requests:**
13 +
14 + - \[\#120\] Search the target files in all directories currently in the code path [\#121](https://github.com/clojerl/rebar3_clojerl/pull/121) ([jfacorro](https://github.com/jfacorro))
15 + - \[\#118\] Sort files to be compiled [\#119](https://github.com/clojerl/rebar3_clojerl/pull/119) ([jfacorro](https://github.com/jfacorro))
16 +
17 + ## [0.8.7](https://github.com/clojerl/rebar3_clojerl/tree/0.8.7) (2021-08-07)
4 18
5 19 [Full Changelog](https://github.com/clojerl/rebar3_clojerl/compare/0.8.6...0.8.7)
6 20
  @@ -18,6 +32,7 @@
18 32
19 33 **Merged pull requests:**
20 34
35 + - Update changelog [\#117](https://github.com/clojerl/rebar3_clojerl/pull/117) ([jfacorro](https://github.com/jfacorro))
21 36 - \[\#14\] Add `--config` flag for the REPL [\#116](https://github.com/clojerl/rebar3_clojerl/pull/116) ([arpunk](https://github.com/arpunk))
22 37 - \[\#114\] Bump versions in templates [\#115](https://github.com/clojerl/rebar3_clojerl/pull/115) ([arpunk](https://github.com/arpunk))
23 38 - \[\#112\] Remove unnecessary mod attribute [\#113](https://github.com/clojerl/rebar3_clojerl/pull/113) ([arpunk](https://github.com/arpunk))
  @@ -30,4 +30,4 @@
30 30 {<<"GitHub">>,<<"https://github.com/clojerl/rebar3_clojerl">>}]}.
31 31 {<<"name">>,<<"rebar3_clojerl">>}.
32 32 {<<"requirements">>,[]}.
33 - {<<"version">>,<<"0.8.7">>}.
33 + {<<"version">>,<<"0.8.8">>}.
  @@ -1,6 +1,6 @@
1 1 {application,rebar3_clojerl,
2 2 [{description,"Compile clojerl projects"},
3 - {vsn,"0.8.7"},
3 + {vsn,"0.8.8"},
4 4 {registered,[]},
5 5 {applications,[kernel,stdlib]},
6 6 {env,[]},
  @@ -182,13 +182,12 @@ compile(AppInfo0, Config0, Providers, State) ->
182 182 false;
183 183 SrcFiles ->
184 184 rebar_api:info("Clojerl Compiling ~s", [AppName]),
185 - rebar_api:debug("Files to compile: ~p", [SrcFiles]),
185 + rebar_api:debug("Candidate files to compile: ~p", [SrcFiles]),
186 186 EbinDir = rebar_app_info:ebin_dir(AppInfo),
187 - ProtoDir = maps:get(protocols_dir, Config1),
188 187 Config2 = Config1#{ebin_dir => EbinDir},
189 188 [ compile_clje(Src, Config2#{src_dir => SrcDir})
190 189 || {SrcDir, Src} <- SrcFiles,
191 - should_compile_file(Src, SrcDir, EbinDir, ProtoDir, Graph)
190 + should_compile_file(Src, SrcDir, Graph)
192 191 ],
193 192 store_graph(AppInfo, Graph),
194 193 rebar_hooks:run_all_hooks( AppDir
  @@ -293,9 +292,11 @@ find_files_to_compile(AppInfo) ->
293 292 maps:get(X, CljeFirst, -1) > maps:get(Y, CljeFirst, -1)
294 293 end,
295 294
296 - [ X || {_, Src} = X <- lists:sort(SortFun, AllFiles),
297 - not lists:member(Src, CljeExclude)
298 - ].
295 + FilesToCompile = [ X || {_, Src} = X <- lists:sort(SortFun, AllFiles),
296 + not lists:member(Src, CljeExclude)
297 + ],
298 +
299 + lists:sort(FilesToCompile).
299 300
300 301 -spec find_files(file:name()) -> [{file:name(), file:name()}].
301 302 find_files(SrcDir) ->
  @@ -303,18 +304,16 @@ find_files(SrcDir) ->
303 304 [{SrcDir, remove_src_dir(Source, SrcDir)} || Source <- SrcFiles].
304 305
305 306 -spec should_compile_file( file:name()
306 - , file:name()
307 - , file:name()
308 307 , file:name()
309 308 , digraph:graph()
310 309 ) -> boolean().
311 - should_compile_file(Src, SrcDir, EbinDir, ProtoDir, Graph) ->
310 + should_compile_file(Src, SrcDir, Graph) ->
312 311 %% Check if the target file is either in the ebin directory or the
313 312 %% protocols directory.
314 313 FullSrc = filename:join(SrcDir, Src),
314 + rebar_api:debug("Checking if ~s should be compiled...", [Src]),
315 315 Fun = fun(Target) ->
316 - should_compile(filename:join(ProtoDir, Target), FullSrc) andalso
317 - should_compile(filename:join(EbinDir, Target), FullSrc)
316 + should_compile(FullSrc, Target, code:get_path())
318 317 end,
319 318 case digraph:out_neighbours(Graph, Src) of
320 319 [] ->
  @@ -326,8 +325,21 @@ should_compile_file(Src, SrcDir, EbinDir, ProtoDir, Graph) ->
326 325 lists:any(Fun, Targets)
327 326 end.
328 327
329 - -spec should_compile(binary(), file:name()) -> boolean().
330 - should_compile(Target, Source) ->
328 + -spec should_compile(file:name(), binary(), [file:name()]) -> boolean().
329 + should_compile(_FullSource, _Target, []) ->
330 + true;
331 + should_compile(FullSource, Target, [Dir | Dirs]) ->
332 + FullTarget = filename:join(Dir, Target),
333 + case should_compile(FullSource, FullTarget) of
334 + false ->
335 + rebar_api:debug("Should NOT be compiled because of ~s.", [FullTarget]),
336 + false;
337 + true ->
338 + should_compile(FullSource, Target, Dirs)
339 + end.
340 +
341 + -spec should_compile(file:name(), binary()) -> boolean().
342 + should_compile(Source, Target) ->
331 343 not filelib:is_file(Target)
332 344 orelse filelib:last_modified(Target) < filelib:last_modified(Source)
333 345 orelse not is_clojerl_compiled(Target).