summaryrefslogtreecommitdiff
path: root/src/rebar_base_compiler.erl
Commit message (Collapse)AuthorAgeFilesLines
* compiler behaviour (#1893)Tristan Sloughter2018-10-051-24/+9
| | | | | | | | | | | | | | | | * add compile type for dynamic project compilation * new rebar_compiler abstraction for running multiple compilers rebar_compiler is a new behaviour that a plugin can implement to be called on any ues of the compile provider to compile source files and keep track of their dependencies. * fix check that modules in .app modules list are from src_dirs * use project_type to find module for building projects * allow plugins to add project builders and compilers
* Friendlier output on include_lib errorsFred Hebert2018-08-031-3/+13
| | | | | | | | | | | | | | | | Turns output like this: ===> Compiling apps/c/src/c.erl failed apps/c/src/c.erl:3: can't find include lib "parse_trans/include/codegen.hrl" Into: ===> Compiling apps/c/src/c.erl failed apps/c/src/c.erl:3: can't find include lib "parse_trans/include/codegen.hrl"; Make sure parse_trans is in your app file's 'applications' list Which is likely going to help newcomers encountering issues.
* Unicode support in all the placesFred Hebert2017-08-061-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done through 3 main change groups: - replacing `~s` by `~ts` in format strings, so that strings that contain unicode are properly printed rather than crashing - adding the `unicode` argument to all function of the `re` module to ensure transformations on strings containing unicode data are valid instead of crashing (see issue #1302) - replacing `ec_cnv:to_binary/1` and `ec_cnv:to_list/1` with matching functions in `rebar_utils`. The last point has been done, rather than modifying and updating erlware commons, because binary and list conversions can be a contentious subject. For example, if what is being handled is actually bytes from a given binary stream, then forcing a byte-oriented interpretation of the data can corrupt it. As such, it does not appear safe to modify erlware commons' conversion functions since it may not be safe for all its users. Instead, rebar3 reimplements a subset of them (only converting atoms and chardata, ignoring numbers) with the explicit purpose of handling unicode string data. Tests were left as unchanged as possible. This may impact the ability to run rebar3's own suites in a unicode path, but respects a principle of least change for such a large patch.
* Extract code path formatting out of compilerFred Hebert2017-01-211-23/+1
| | | | | | | | This allows to reuse the code for any provider that formats source files out to the user. The option to configure it does remain compiler-centric for backwards compatibility
* Merge pull request #1391 from ferd/doc-and-typesFred Hebert2016-12-231-0/+108
|\ | | | | Type specifications and edocs improvements
| * Type specifications and edocs improvementsFred Hebert2016-11-271-0/+108
| | | | | | | | | | | | Includes improvments and function documentation for all modules (in alphabetical order) up to rebar_core, and may have included more in other modules as I saw fit to dig and understand more of the internals.
* | Fix regex match for ignored fileFred Hebert2016-12-091-1/+1
| | | | | | | | | | | | | | The regex mistakenly matched too many files (any character followed by an underscore) rather than only files starting in '._' This properly escapes the expressions to work in all cases.
* | Restrict regexp to match on files starting with '._'Roberto Aloi2016-12-061-1/+1
|/
* Fix opts check when compiler called with dict optsFred Hebert2016-07-221-1/+7
| | | | | | | | | | | | | | | | rebar_base_compiler allows to be called with two types of options: a dictionary, or a rebar_state record. In the later case, the options are taken out with a call from rebar_opts, which fetches options that have been inserted in the application via rebar_app_info as part of the app_discovery phase, and are a list. This yields a possibility that options used when formatting warnings can either be a list of a dict, and we only used lists when making checks. This ended up breaking 3rd party compiler users (i.e. LFE compile plugin) since they were calling us with a dict rather than our own internal records. This patch supports both types of lookups to avoid issues.
* Fix alternative path printing, default is relativeFred Hebert2016-06-091-2/+29
| | | | | | | This required moving the reporting functions to rebar_base_compiler but since this was already done for error_tuple, this seems to make sense. Paths are also reformatted for warnings in erlc files.
* Option to format compiler sourcesGarrett Smith2016-05-021-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default rebar3 displays compiler sources as absolute paths in their original location, which is under the build dir. This change introduces an option 'compiler_source_format' to format sources in two alternative ways: relative absolute When either 'relative' or 'absolute' are specified, the file is resolved to its original location when it is a link. When 'relative' is specified, the path is displayed relative to the current working directory. When 'absolute' is specified, the path is absolute. The default value is 'unchaged' which leaves the compiler source unchanged. This is arguably too flexible as I suspect most people would opt for 'relative' all the time - it's the most compact representation of the file and is sufficient to find the source given cwd. The change however is meant to introduce the change gradually, preserving existing behavior and giving users a choice for formats. In time perhaps the default can be changed to 'relative' - but still allowing users to revert to the other two options ('absolutel' and 'unchanged') as needed.
* update use of hooks and plugins with state in app_infoTristan Sloughter2015-08-311-4/+4
|
* remove uses of 'case catch'Tristan Sloughter2015-05-101-19/+14
|
* improve erlydtl source and out dir discoveryTristan Sloughter2015-04-191-1/+1
|
* merge rebar2's Refactor logic and optimizations in ↵Tristan Sloughter2015-04-071-12/+1
| | | | rebar_erlc_compiler:doterl_compile/4 #467
* get rid of compile workersTristan Sloughter2015-03-121-79/+1
|
* merge over rebar2 PR #401Tristan Sloughter2014-12-051-5/+1
|
* fix lock provider to work anytime it is runTristan Sloughter2014-11-291-7/+2
|
* fix warning/error compilation outputTristan Sloughter2014-11-081-4/+4
|
* handle throw by relxTristan Sloughter2014-11-081-17/+17
|
* improved dep handling and add package list taskTristan Sloughter2014-08-241-4/+4
|
* switched package index to dictTristan Sloughter2014-08-231-6/+6
|
* refactoring and remove unused providers for nowTristan Sloughter2014-08-231-9/+7
|
* only build unbuilt depsTristan Sloughter2014-08-181-2/+2
|
* start of moving to splitting state from config parsingTristan Sloughter2014-08-171-1/+1
|
* replace logging with ec_cmd_log from erlware_commonsTristan Sloughter2014-08-161-5/+5
|
* Fix OS X resource fork handling (Reported-by: Richard O'Keefe)Tuncer Ayaz2014-07-251-3/+6
| | | | | | | | | If you happen to fetch a zip archive of the git repo and try to build from that, you may, for example, ask erlc to build src/._rebar.erl. ._* are OS X resource forks and not real .erl files. This may also happen with network filesystems on OS X. To fix that, limit the files compiled by rebar to include only those which start with a letter or a digit.
* rebar_base_compiler: replace fixed size list with a tupleTuncer Ayaz2014-01-151-4/+3
|
* Fix basho/rebar#388Tuncer Ayaz2014-01-151-16/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the syntax error is in a .hrl file, then the reported error message is not as useful because it's not clear which .erl file was being compiled. We can fix that easily by first printing what source file was being processed. We don't change the actual error message, so this will still work with your editor of choice for jumping to the right line. Before ------ Success: Compiled src/foo.erl Failure: include/foo.hrl:10: syntax error [...] After ----- Success: Compiled src/foo.erl Failure: Compiling src/foo.erl failed: include/foo.hrl:10: syntax error [...]
* More error loggingmats cronqvist2013-04-121-0/+2
| | | rebar throws away some error messages, e.g. the ones generated if the yecc compiler is broken.
* Merge pull request #327 from saleyn/erlydtl_compilerDave Smith2012-11-101-2/+2
|\ | | | | Erlydtl compiler
| * Specify multiple locations of DTL template filesSerge Aleynikov2012-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a backward compartible feature to specify `erlydtl_opts' options for the DTL template compiler to allow inclusion of templates in different directories with different compilation settings for each. E.g.: {erlydtl_opts, [ [{doc_root, "src/view"}, {module_ext, "_dtl_vw"}] , [{doc_root, "src"}, {module_ext, ""}, {recursive, false}] , {out_dir, "ebin"} , {compiler_options, [verbose, debug_info]} ]}. The definition above is identical to this (the last two options are duplicated in each list): {erlydtl_opts, [ [{doc_root, "src/view"} ,{module_ext, "_dtl_vw"} ,{out_dir, "ebin"} ,{compiler_options, [verbose, debug_info]}] , [{doc_root, "src"} ,{module_ext, ""} ,{out_dir, "ebin"} ,{compiler_options, [verbose, debug_info]} ,{recursive, false}] ]}. In this case "src/view" and "src" directories containing template files will be compiled. A new `recursive' option tells rebar_erlydtl_compiler to search files recursively from a given doc_root. In the example above the "src" directory won't be scanned recursively, and the target template name for target beam modules won't have "_dtl_vw" suffix.
* | Fix rebar_base_compiler:format_errors/3 for errors in include filesMagnus Henoch2012-10-221-9/+11
|/ | | | | | | | | | | | Handle the case where the error didn't occur in the file being compiled. That is, if there is an error on line 9 of bar.hrl, instead of: /path/to/foo.erl:9: type foo() already defined print: /path/to/bar.hrl:9: type foo() already defined
* Only print absolute filename if not in base_dirTuncer Ayaz2012-08-051-14/+19
|
* Fix R13B03 build (Reported-by: Sergey Nartimov)Tuncer Ayaz2012-07-281-3/+3
|
* Do not use application:set_envTuncer Ayaz2012-07-231-1/+1
|
* Add support for errors without line numberYurin Slava2012-06-181-1/+4
|
* Remove gratuitous lists:append/1Tuncer Ayaz2012-06-121-1/+1
|
* Fix error/warning newlines (Reported-by: Tim Watson)Tuncer Ayaz2012-06-121-3/+3
|
* Refactor shared error reporting codeTuncer Ayaz2012-06-111-12/+18
|
* Add support for {Line,Column} in error reportsTuncer Ayaz2012-06-111-1/+4
|
* Report warnings as errors if -Werror is enabledTuncer Ayaz2012-06-111-2/+9
|
* Share format_errors/format_warnings functionsTuncer Ayaz2012-06-111-1/+16
|
* Manually report errors/warnings with absolute pathTuncer Ayaz2012-06-111-5/+31
|
* Remove ?FAIL in favor of ?ABORTDave Smith2012-06-081-2/+2
|
* Clean up codeTuncer Ayaz2011-02-061-2/+4
|
* Clean up emacs file local variablesTuncer Ayaz2011-01-311-1/+1
|
* Tidier improvementsKostis Sagonas2010-10-261-1/+1
|
* include source path in compiler errors, process commands separately (to make ↵Bob Ippolito2010-05-151-1/+2
| | | | get-deps compile work), ensure ebin dir, process iteratively to support transitive deps
* Implemented option to specify number of concurrent workers a command may useTuncer Ayaz2010-01-061-1/+3
|