summaryrefslogtreecommitdiff
path: root/src/rebar3.erl
Commit message (Collapse)AuthorAgeFilesLines
* fix compilation of global plugins (#1935)Tristan Sloughter2018-11-081-4/+7
|
* Optimize path handlingFred Hebert2018-10-111-1/+14
| | | | | | | | | | | | | | | | | - Only set paths that need to be put as a priority - Clean up paths before leaving API mode The first point accounted for some performance cost, but the latter one explains the 40% overhead in test runs: since rebar3 calls rebar3 a lot with a bunch of fake apps, and that the new mechanism for path handling by default does not _remove_ paths, it just _orders_ them, we would end up in a situation where as the tests ran, more and more fake paths would get added to the VM. By the time the run was over, all path handling would take longer since more paths needed filtering every time. By resetting paths at the end of an API run, we prevent a given 'project' from polluting another one's runtime and performance once the API successfully returns.
* compiler behaviour (#1893)Tristan Sloughter2018-10-051-1/+4
| | | | | | | | | | | | | | | | * 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
* support for hex v2, multiple repository fetching, private organizations (#1884)Tristan Sloughter2018-09-131-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
* Finish adding specs for private funs in rebar3.erlBryan Paxton2018-06-111-0/+5
| | | | | | | | | - added type specs for following private functions: - run/1 - set_options/2 - test_state/1 - safe_define_test_macro/1 - test_defined/1
* start at least one async thread in async thread poolGrigory Starinkin2018-05-081-1/+1
| | | | | fixes an issue when shell is terminated with an error "Bus error: 10", on attempt to run rebar shell with verbose logging
* Work around OTP-21 deprecation of get_stacktrace()Fred Hebert2018-05-031-11/+10
| | | | Based off a macro by @okeuday at https://github.com/erlang/otp/pull/1783
* Fix precedence rules of erl_opts for test profileFred Hebert2018-04-201-1/+5
| | | | | | | | | | | | | | When adding the 'TEST' macro to the test profile, we mistakenly sourced the erl_opts values from the base profile rather than the test profile itself. This means that in cases where the base profile set an option such as 'no_debug_info' and a profile overrode it with 'debug_info', the default options would get injected within the test profile, and broke the precedence rules, yielding incompatible values. This patch fixes things by adding the macro to the values sourced from the test profile itself, fixing the issue.
* Set unicode option for starndard_io at entry pointShunichi Shinohara2018-02-221-0/+1
|
* Fix recursive profile merging in umbrella appsFred Hebert2017-08-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a config file exists at the root of a project, defines a given configuration value for a given profile, and that a sub-application (umbrella app) also has the same profile defined with the same key (but different values), the configuration values of the sub-application's profile would get silently dropped. The problem being that when the function to merge profiles is applied recursively, it is applied to each profile (so it will merge on the keys test, prod, etc.) rather than to each of the values of each profile. This patch reworks the profile merging so that the current behaviour is respected overall (a profile cannot be cancelled by a subdep's non-existant profile since its value should have been ignored), but ensures that sub-deps' profiles are otherwise applied recursively with the proper rules: - dependencies favor prior values - plugins favor new values - erl_first_files combine the lists - relx uses the tuple merge algorithm - erl_opts has its own custom merge as well - otherwise the new value takes precedence A test has also been added. There is a risk of breakage in some applications that may have relied on the buggy behaviour to work, though at this time we are aware of none of them.
* Unicode support in all the placesFred Hebert2017-08-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Properly warn on missing rebar3 deps: add inetsCarlo Carraro2017-03-051-1/+1
|
* REBAR_CONFIG impacts file project root onlyFred Hebert2017-02-241-1/+1
|
* Merge pull request #1391 from ferd/doc-and-typesFred Hebert2016-12-231-15/+61
|\ | | | | Type specifications and edocs improvements
| * Type specifications and edocs improvementsFred Hebert2016-11-271-15/+61
| | | | | | | | | | | | 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.
* | 1394: added fix for rebar_utils, moved setting of http_options into ↵Artem Pervin2016-11-301-1/+2
|/ | | | init_config, added unit tests
* Always read REBAR_CONFIG env var when loading configEric Meadows-Jönsson2016-11-221-6/+1
|
* Get stacktrace only once and as soon as possible. Fixes #1347.Alexander Sedov2016-10-131-2/+3
| | | | | It turns out that pretty-printing uses throw-catch and thus garbages out the stack trace sometimes, so we should get it only once.
* Print stacktrace in a more conventional wayTuncer Ayaz2016-08-301-1/+1
| | | | | | Insert a newline before printing the stacktrace so that the term is easier to read and copy. This is a more conventional way to print traces, and is, for instance, the way it's done by make and python.
* Let DEBUG="" and QUIET="" mean disable the optionJon2016-06-181-2/+2
| | | | | Setting DEBUG/QUIET environment variable to the empty string now acts the same as unsetting it. Unsetting is not always easy/possible.
* Merge pull request #1080 from project-fifo/crashdumpFred Hebert2016-06-101-2/+4
|\ | | | | Write rebar3.crashdump on errors
| * Make sure not to dump in api modeHeinz N. Gies2016-04-161-3/+3
| |
| * Write rebar3.crashdump on errorsHeinz N. Gies2016-04-161-2/+4
| |
* | Handle control sequences in formatted errorsPéter Gömöri2016-06-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formatted errors can accidentally contain substrings which are control sequences for io:format/2. This is a naive attempt to handle such cases. One example is running xref on the following module (assuming module m does not exist) ``` -module(handle_error). -export([f/0]). f() -> m:'bobby~stables'(). ``` ``` $ rebar3 xref ===> Verifying dependencies... ===> Compiling myapp ===> Running cross reference analysis... escript: exception error: bad argument in function io:format/3 called as io:format(<0.23.0>, "\e[0;31m===> \e[1mWarning: handle_error:f/0 is unused export (Xref)\nWarning: handle_error:f/0 calls undefined function m:bobby~stables/0 (Xref)\n\n\e[0m\e[0m", []) in call from rebar3:handle_error/1 (/Users/gomoripeti/git/rebar3/_build/default/lib/rebar/src/rebar3.erl, line 279) ```
* | Read env var REBAR_CACHE_DIR on rebar3 only onceFrancisco Rojas2016-04-061-3/+10
|/ | | | | Instead of reading every time that rebar_dir:global_cache_dir/1 is called
* Revert "define the 'EUNIT' macro in the test profile"alisdair sullivan2016-03-031-11/+10
| | | | This reverts commit 4c32c52b557c66ac6e6764efb1ed9135c00a3c20.
* define the 'EUNIT' macro in the test profilealisdair sullivan2016-03-031-10/+11
|
* Merge branch 'state' of https://github.com/saleyn/rebar3 into saleyn-stateFred Hebert2016-03-011-4/+4
|\
| * Remove --state argument option per Tristan's commentSerge Aleynikov2016-02-081-2/+1
| |
| * Add a state display providerSerge Aleynikov2016-02-081-4/+5
| | | | | | | | | | | | | | The provider is used for debugging to help displaying current rebar's state. Usage: rebar3 state
* | add project_providers after initing default providers but allow overridesTristan Sloughter2016-02-221-3/+3
| |
* | give new opt project_plugins providers precedence over default providersTristan Sloughter2016-02-201-5/+7
| |
* | check top level config for minimum or blacklisted otps at startTristan Sloughter2016-02-031-0/+3
| |
* | install project app plugins after discovering them not beforeTristan Sloughter2016-01-101-1/+1
|/
* support temporary cdn change with HEX_CDN os varTristan Sloughter2015-12-191-9/+16
|
* move test profile bootstrap into corealisdair sullivan2015-10-301-1/+22
|
* fix dialyzer warningsTristan Sloughter2015-09-271-0/+1
|
* Properly warn on missing rebar3 depsFred Hebert2015-09-261-10/+23
| | | | | | | | | | | | The current code could not cope with missing dependencies, as they would prevent the rebar3 app from loading or properly building its config, which prevented the log state from being carried along with default values. This in turn would turn in an escript-level error that obfuscated the true source of failure. This patch bypasses the whole state setup and logging macros and logs an error message manually when a dependency such as crypto or SSL is missing from the Erlang install.
* add providers 'local upgrade' and 'local install' for installing/upgradingTristan Sloughter2015-09-071-2/+16
|
* add current_app attribute for setting before calling hooksTristan Sloughter2015-09-041-1/+0
|
* Revert "Revert "only load packages when needed""Fred Hebert2015-09-021-2/+0
|
* Revert "only load packages when needed"Fred Hebert2015-09-021-0/+2
|
* only load packages when neededTristan Sloughter2015-09-021-2/+0
|
* replace use of dict of packages and registry with single ets tableTristan Sloughter2015-08-211-3/+10
|
* fix no_return warningsTristan Sloughter2015-08-081-0/+1
|
* handle global config file that can't be readTristan Sloughter2015-07-191-19/+29
|
* Added rebar profile to httpc initialization and calls.CarlosEDP2015-07-031-1/+2
|
* Added support for proxy on rebar3 based on environment variables.CarlosEDP2015-07-031-10/+2
|
* setup hex httpc profile and http opts. needed also for proxyTristan Sloughter2015-06-291-1/+11
|
* plugins providerTristan Sloughter2015-06-181-4/+5
|