Commit graph

1706 commits

Author SHA1 Message Date
Fred Hebert
b557e5fedc Merge pull request #467 from kejv/support-parse-transforms2
Refactor logic and optimizations in rebar_erlc_compiler:doterl_compile/4
2015-04-07 16:33:05 -04:00
David Kubecka
e17d30a2dd append myself to THANKS 2015-04-06 22:11:57 +02:00
David Kubecka
d62624c86d Raise version of erlcinfo
Its format was (repeatedly) changed in previous commits.
2015-04-06 22:11:57 +02:00
David Kubecka
07a4a14af6 Fix error when processing non-existent include_lib file
Since process_attr/3 searches source code for attributes, it can
happen that it finds an attribute which is eventually not needed
by the compilation, e.g. hidden by ifdef macro - see enclosed test.
Such attribute can reference a file which is not in the path or
which even doesn't exist at all, and current code doesn't expect
such a situation.  We fix things by simply ignoring such files.
2015-04-06 22:11:57 +02:00
David Kubecka
ee5a75cb33 Remove obsolete way of generating target ebin subdirectories
As per @tuncer: "That's most likely a vestige of package module support".
2015-04-06 22:10:15 +02:00
David Kubecka
c7a2b450bb Store also max modified times in erlcinfo
These times already contain max modified info of their
dependencies.  Therefore we no longer have to check in
internal_erl_compile whether the file really needs
recompiling, which simplifies the flow somewhat, because
the work with dependency graph is now localized to much
smaller space then before.
2015-04-06 22:10:15 +02:00
David Kubecka
bd29560ce1 Use toposort of erlcinfo to decide the order of compilation
The precise algorithm is now following:
- Decide which files need to be compiled first (ErlFirstFiles).
- Split AllErlFiles which are not in ErlFirstFiles into two groups,
  one consisting of files some other file depends on (DepErls)
  and the rest (OtherErls).
- Final FirstErls are obtained as ErlFirstFiles (in original order)
  plus toposorted DepErls. OtherErls are left as is since they can
  be compiled in any (random) order.

Also create the erlcinfo graph as acyclic, since otherwise the
toposort could not work and we don't want to have cycles among
dependencies anyway.
2015-04-06 22:10:15 +02:00
David Kubecka
a25932ba6a Compress erlcinfo file less agressively
Optimizing for best compression could be very slow for large
projects, so optimize rather for the speed.  erlcinfo file
isn't that huge anyway and moreover difference between levels
2 and 9 isn't that big in practice (although there's quite big
difference between level 2 and no compression at all).
2015-04-06 22:10:15 +02:00
David Kubecka
9e33daa6fa Additional minor refactor in erlcinfo
- use filelib:last_modified/1 instead of date/0 and time/0 combo
  in source file vertices
- simplify store_erlcinfo/2
- document init_erlcinfo/2
2015-04-06 22:10:15 +02:00
David Kubecka
462962ebab Delete existing out-edges before adding new ones in modify_erlcinfo
When the source file changes it could happen that some of its
dependecies get removed.  In that case we should remove these
former dependencies from the graph, so that they don't influence
recompilation of the source file anymore.
2015-04-06 22:10:15 +02:00
David Kubecka
13fe77d3f5 Avoid extra list traversal when checking for modified source files 2015-04-06 22:10:15 +02:00
David Kubecka
22acf8db67 Assemble Dirs passed to update_erlcinfo in one place
Current separation of part of the logic into include_path
obscures the purpose of Dirs (see expand_file_names).
Moreover for each particular Erl its source file was included
twice in Dirs, which is now corrected.

Also InclDirs (specified in erl_opts) as part of erlcinfo
since they can affect resulting graph, which needs to be
therefore regenerated when InclDirs change.  See added
test as an example.
2015-04-05 00:46:34 +02:00
David Kubecka
df97a49ce7 Sanitize erlcinfo checking
As erlcinfo is only an internal optimization mechanism, user
should be only minimally bothered by issues with it.  Especially
it shouldn't ever cause a fatal error and if it cannot be restored
properly, only a warning (not error) message should be emitted (if
any).  Also it probably doesn't make sense for this warning message
to be too detailed - just state that something went wrong and
silently delete the erlcinfo file.
2015-04-05 00:16:56 +02:00
David Kubecka
ccdfc1a270 Extract common pattern from rebar_erlc_compiler:process_attr 2015-04-05 00:16:56 +02:00
David Kubecka
d61b51bcf8 Stop silently supressing errors from process_attr/2
Otherwise the code cannot be safely refactored, since
potential new erros slip unnoticed.
2015-04-05 00:16:56 +02:00
David Kubecka
fd482b661a Stop passing useless Config into erlcinfo_file
Also pas only InclDirs into init_erlcinfo as this is the only
thing from Config/ErlOpts needed there.
2015-04-05 00:16:56 +02:00
David Kubecka
b0320ce058 Basic test for erlc (re)compiling and erlcinfo 2015-04-05 00:16:50 +02:00
David Kubecka
f61ca47b23 Remove useless compile/3
Its case statement is noop.
2015-04-05 00:15:07 +02:00
David Kubecka
eb79622903 Allow running specific retest suites 2015-04-05 00:15:07 +02:00
Fred Hebert
c3b09ba170 Merge pull request #354 from vladdu/compiler_keep_going
compiler respects 'keep_going' flag
2015-04-02 18:32:33 -04:00
Vlad Dumitrescu
797d2b6937 add tests for 'compiler keep_going' 2015-04-02 16:55:48 +02:00
Vlad Dumitrescu
ae79184555 compiler and xref respect 'keep_going' flag 2015-04-02 16:53:24 +02:00
Fred Hebert
99f8580678 Merge pull request #471 from tuncer/formatting-fixes-2
Fix whitespace errors
2015-04-02 10:27:11 -04:00
Tuncer Ayaz
fe4a62cb18 Fix whitespace errors 2015-04-02 16:21:20 +02:00
Fred Hebert
e7bac0a03d Merge pull request #470 from tuncer/formatting-fixes
Fix whitespace errors
2015-04-02 10:14:44 -04:00
Tuncer Ayaz
6127f528b9 Fix whitespace errors 2015-04-02 16:10:31 +02:00
Fred Hebert
65b0f917b8 Merge pull request #456 from glyphrider/master
Generate json output from cover
2015-04-02 09:43:58 -04:00
Fred Hebert
e747bfac5d Merge pull request #469 from tuncer/fix-dialyzer-warnings
Fix dialyzer warnings
2015-03-31 13:06:14 -04:00
Tuncer Ayaz
e0ee7373e9 Fix 17.x Dialyzer warnings 2015-03-31 19:03:54 +02:00
Tuncer Ayaz
8f317965eb Fix a Dialyzer warning in the recently introduced rebar_otp_appup.erl 2015-03-31 19:03:54 +02:00
Fred Hebert
0d79645c2d fix comment typo 2015-03-29 13:47:30 -04:00
Fred Hebert
9b69740fa1 Merge pull request #466 from kejv/improve-makefile
Improve test targets in Makefile
2015-03-26 09:04:51 -07:00
David Kubecka
f3f8f29920 Improve test targets in Makefile
- enable running eunit and retest tests separately
- add neccessary dependencies to each test target so that
  one can just do 'make test' without recompiling changed files
  manually
- enable overwriting retest's log level
- use retest's own Makefile instead of invoking rebar manually
2015-03-26 11:28:37 +01:00
Brian H. Ward
f19c7d0785 Add 'cover_export_json' option 2015-03-11 06:09:07 -04:00
Fred Hebert
02de46d01f Merge pull request #463 from tuncer/profiler-msg
Print more info when profiling
2015-03-08 20:00:59 -04:00
Tuncer Ayaz
e8fe6c33ad Print more info when profiling
* profiler= is preliminary and will be replaced with a
  different interface
* fail gracefully if unknown profiler is passed
2015-03-08 18:48:59 +01:00
Fred Hebert
223d762f0d Merge pull request #461 from lrascao/fix/crash_empty_appup
Fix OTP .appup.src processing on empty lists
2015-03-02 10:22:00 -05:00
Luis Rascao
2ebd804e1e Fix OTP .appup.src processing on empty lists
Expand test cases to handle .appup.src with
empty upgrade from and downgrade to lists, lift
larger .appup.src file from OTP's
lib/dialyzer/test/r9c_SUITE_data/src/asn1/asn1.appup.src
2015-03-02 11:47:36 +00:00
Tristan Sloughter
e7933d83b9 Merge pull request #459 from cmeiklejohn/emu-64
Remove -m64 flag.
2015-02-26 12:03:03 -06:00
Christopher Meiklejohn
3bc43753e5 Remove -m64 flag.
On 64-bit Linux, remove the emulation mode flag, given -m64 is an
invalid emulation mode on 64-bit Linux.

Example compilation from Basho's erlang_js on Linux:

```
ld: unrecognised emulation mode: 64
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om i386pep i386pe
make[4]: *** [Linux_All_OPT.OBJ/libjs.so] Error 1
```
2015-02-26 12:34:29 -05:00
Fred Hebert
d4675a5b06 Merge pull request #458 from manderson26/ma/improve_variable_expansion
Change env var delimiter to match non-word
2015-02-25 14:22:26 -05:00
Mark Anderson
e211afdce6 Change env var delimiter to match non-word
If I pass an expression like: "$PWD/deps/local/lib" in the port env
string, it expands to "/deps/local/lib", (variable is expanded to the
empty string) but if I pass "${PWD}/deps/local/lib" it expands
properly. I found that confusing.

This was because we require environment vars to end with whitespace,
while I think requiring a non-word character would be sufficient, since
the variables can only contain word characters.

This changes the expansion system to recognize variables that are
terminated by non word characters.

This includes some fixes as per some comments by tuncer.

Fixes rebar/rebar#457
2015-02-23 19:11:51 -08:00
Fred Hebert
f56268383a Merge pull request #452 from yannayl/patch-1
added 'shell' command to bash-completion
2015-02-15 11:23:31 -05:00
yannayl
da7d413fb0 Add 'shell' sub-command to shell-completion 2015-02-13 09:05:33 +00:00
Fred Hebert
7f73b8d365 Merge pull request #449 from lrascao/feature/support_appup_src_files
Support .appup.src files
2015-02-05 08:12:43 -05:00
Luis Rascao
53fbb7cf8e Support .appup.src[.script] files
Similar to how .app.src are being handled, all files in directory
.src ending with .appup.src are processed, checked for
correctness and copied to ebin without the .src extension.

By way of using rebar_config:consult_file/1, .appup.src.script
files are automatically supported in exactly the same manner
as in .app.src.script.
2015-02-04 22:33:16 +00:00
Fred Hebert
0eecd4d050 Merge pull request #378 from irpab/remove_last_dot_in_deps_dir
deps: fix delete-deps if deps_dir ends with dot
2015-02-04 14:48:19 -05:00
Pavel Baturko
703a9dae9e deps: fix delete-deps if deps_dir ends with dot
Remove possible last dot from deps dir path by calling
dirname on base_dir, deps_dir and dummy path part.
With this fix delete-deps command deletes dependencies
properly in case of deps dir path ended with dot.
Examples of deps_dir config value that triggers error:
".", "some/path/.".
Code that triggers error: rebar_deps:'delete-deps'/2,
code line lists:prefix(DepsDir, D#dep.dir).
If deps_dir = ".", cwd = "/root", dependency name = "app"
then DepsDir = "/root/." and D#dep.dir = "/root/app" so
prefix fun returns false but should be true.
Dependency app will not be removed because of this.
2015-02-03 23:21:46 +03:00
Fred Hebert
c051530b3c Merge pull request #445 from norton/norton-erlc-order
rebar doesn't respect the order of erl_first_files given in the rebar.conf file
2015-02-02 11:06:12 -05:00
Fred Hebert
7811c1f335 Merge pull request #447 from lrascao/feature/support_custom_proto_dir
Support custom protobuf directory
2015-02-02 11:05:47 -05:00