summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
Commit message (Collapse)AuthorAgeFilesLines
* Fix shell hook expansion on windowsFred Hebert2018-10-181-2/+2
| | | | | | | | | | | Dollar Variable expansion (`$VAR`) was inadvertently disabled for windows variables, although %VARIABLES% already worked. This reduced the portability of hooks in general. Additionally, tests would fail on windows due to bad quoting of paths: the path C:/a/b/c would fail when passed to the command `cmd /q /c C:/a/b/c` because it would interpret /a /b and /c as 3 options. Using quotes makes the tests pass.
* fix resolving versions from vcs (#1915)Tristan Sloughter2018-10-141-1/+10
| | | | | | app_info was turning any vsn into a binary which the vcs_vsn function interprets as being an actual version and not something like <<"git">>. original_vsn shouldn't be converted as it is then not longer "original".
* compiler behaviour (#1893)Tristan Sloughter2018-10-051-5/+82
| | | | | | | | | | | | | | | | * 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-30/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Reload logger config in shellFred Hebert2018-09-101-2/+51
| | | | | | | | | | | | | This requires some fancy dynamic work since the logger is started as part of the kernel and we lost the sys.config from users when working from there. We start conservatively by making it an optional thing, turning it on only where we know it to be safe. The changes are applied _after_ having loaded the rest of configs so if an inoffensive error happens, the shell works (with a bad error message) rather than plain exploding.
* Abort if erl_first_files is not a list of stringsBryan Paxton2018-06-081-1/+10
| | | | - resolves #1645
* Fix handling of loosely formatted OTP_VERSION fileFred Hebert2018-05-031-6/+5
| | | | see https://github.com/erlang/rebar3/issues/1774
* Handle Schemaless Proxy URLs in ENV varsFred Hebert2018-04-201-1/+9
| | | | | | | | | | We've had multiple tickets opened because of unclear PROXY settings when the scheme is missing form the URI. To be helpful, we instead add them dynamically whenever they're missing. Example issues: - https://github.com/erlang/rebar3/issues/1747 - https://github.com/erlang/rebar3/issues/1697
* export env expansionCarl-Johan Kjellander2018-02-231-18/+18
|
* Safer purge switchFred Hebert2017-12-061-5/+7
| | | | | | | | | Rather than the caller having to think of what to purge or not, use erlang:check_process_code/2 to detect if the caller (rebar3) may die because of the operation. If so, do a soft purge with a conditional delete instead of a hard purge with a mandatory delete.
* Run a soft purge while within the compiler stepFred Hebert2017-12-051-1/+5
| | | | Prevents the killing of a plugin with itself
* OTP-21 readiness, Full Unicode supportFred Hebert2017-11-161-7/+6
| | | | | | | | | | | | This replaces all deprecated function usage by alternative ones based on a version switch enacted at compile time, preventing all warnings. This will likely introduce some possible runtime errors in using a Rebar3 compiled on OTP-20 or OTP-21 back in versions 19 and earlier, but we can't really work around that. A bunch of dependencies have been updated to support OTP-21 without warnings as well.
* Prevent hard crash on duplicate plugin pathsFred Hebert2017-10-201-1/+1
| | | | | | | | | | | | | | | When a global plugin is used both locally and within the project, there are cases when the rebar3 program will hard crash (killed in do_boot). This has been traced to plugin-handling in compilation, where the same code path may be purged twice in a row without further reloading for the compile operation. This of course yields the result where the code handling on the VM kills all processes holding references to the module in memory, in this case the rebar3 process itself. By deduplicating the paths first, we ensure at most one purge before reloading plugins and paths, and this prevents a hard crash.
* Unicode support in all the placesFred Hebert2017-08-061-29/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* rebar_utils:escape_chars handles quotesVlad Dumitrescu2017-03-041-1/+1
| | | | | rebar_file_utils:cp_r uses rebar_utils:escape_chars to ensure that the file names are safe to use, but it doesn't escape double and single quotes. If the file name includes those characters, they disappear when the shell processes them and we get "file not found" errors. The main culprit here is eunit, that creates reports whose names are `TEST-file_"myfile.app".xml`, and I wish it didn't but I think escape_chars should still do its job all the way.
* Merge pull request #1391 from ferd/doc-and-typesFred Hebert2016-12-231-5/+18
|\ | | | | Type specifications and edocs improvements
| * Type specifications and edocs improvementsFred Hebert2016-11-271-5/+18
| | | | | | | | | | | | 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: refined export list and testsArtem Pervin2016-12-011-2/+2
| |
* | 1394: added fix for rebar_utils, moved setting of http_options into ↵Artem Pervin2016-11-301-3/+21
|/ | | | init_config, added unit tests
* Some post-review changes:Alexander Sedov2016-10-111-0/+2
| | | | | - restore path after loading applications, - helpful comments.
* Rereading system configuration sets up persistent options if possible.Alexander Sedov2016-10-111-1/+7
|
* add support for passing a sys_config to common testTristan Sloughter2016-06-111-1/+13
|
* Support ENV config for proxy valuesFred Hebert2016-06-111-1/+5
| | | | | - The configured stuff in rebar3 takes precedence over the ENV - The env is then chosen
* add user-agent to http request headersTristan Sloughter2016-02-011-1/+6
|
* check at runtime instead of compile time for presence of `file:list_dir_all/1`alisdair sullivan2016-01-131-5/+8
| | | | | | this is slower than the compile time check but i guess packaging rebars with repos is still a thing and i think only the eunit and ct providers call it anyways
* support temporary cdn change with HEX_CDN os varTristan Sloughter2015-12-191-0/+10
|
* Actually fix tuple merging.Fred Hebert2015-12-061-30/+53
| | | | Full rewrite, code should be understandable now.
* Fix tuple umergingFred Hebert2015-12-061-7/+18
| | | | | | | | | | | | - proper segregation of comparison between tuple terms and non-tuple terms. Guards weren't specific enough and that meant the wrong clauses of guards would be triggered - proper deduplication of entries in the list. An additional N passes are required (we co-opt the reverse step to be more efficient) because while the original lists:umerge easily removes dupes, this is requiring more logic here since `[a,{a,b},{a,b,c},a,{a,b,c}]` is a possible interleaving and we'd want `[a,{a,b},{a,b,c}]` -- comparison of direct neighbours isn't enough.
* add an option to soft purge rather than purge old codealisdair sullivan2015-11-011-8/+10
| | | | | at the cost of some SASL warnings this prevents rebar3 from terminating processes when reloading their code before running tests
* prevent rebar3 from reloading it's own path and terminating itselfalisdair sullivan2015-10-311-1/+7
| | | | | prevents code reloading by temporary marking of rebar3's ebin dir as sticky during code refresh
* refactor `rebar_erlc_compiler`alisdair sullivan2015-10-261-1/+8
| | | | | | | | | | | | | | | | | | | * modify compiler interface to work on either application objects or directories containing source files * compile all sources in `src_dirs` to the application `ebin` dir and all sources in `extra_src_dirs` to a directory mirroring it's position in the app's `_build` directory. for example, `apps/foo/more` would compile to `_build/default/lib/foo/more` for `extra_src_dirs` in the root of a project with multiple applications (so orphan directories that don't "belong" to an application) compile to `_build/default/extras/more` * copy directories specified in `extra_src_dirs` into the `_build` directory so tools like `ct` and `xref` that expect source to be in a particular location still work * clean compiled artifacts from all `extra_src_dirs` * alter `eunit`, `ct` and `cover` to work with the new directory structure * billions of new tests
* update erlware_commonsTristan Sloughter2015-09-191-0/+2
|
* Merge pull request #772 from tsloughter/eunit_fixFred Hebert2015-09-051-1/+6
|\ | | | | delete and prepend code path instead of replacing, fixes #770
| * delete and prepend code path instead of replacing, fixes #770Tristan Sloughter2015-09-021-1/+6
| |
* | move opts functions to new module rebar_optsTristan Sloughter2015-09-011-150/+2
| |
* | more cleanupTristan Sloughter2015-08-311-14/+20
| |
* | update use of hooks and plugins with state in app_infoTristan Sloughter2015-08-311-1/+92
| |
* | build on already created AppInfo instead of having to do copyTristan Sloughter2015-08-311-8/+8
| |
* | wip: move state into app_infoTristan Sloughter2015-08-311-5/+23
|/
* fix no_return warningsTristan Sloughter2015-08-081-0/+1
|
* fix dialyzer warnings, except 'no local return' warningsTristan Sloughter2015-08-081-1/+1
|
* add tree option to deps command that prints pkg deps treeTristan Sloughter2015-08-031-0/+26
|
* upgrade depends on the lock provider and lock prv sets stateTristan Sloughter2015-08-021-1/+8
|
* Merge pull request #652 from tsloughter/escape_andFred Hebert2015-07-291-3/+3
|\ | | | | escape & in paths
| * add ; to escaped chars in pathTristan Sloughter2015-07-281-3/+3
| |
| * escape & in pathsTristan Sloughter2015-07-261-3/+3
| |
* | Merge pull request #650 from tsloughter/upgrades_git_pkg_fixFred Hebert2015-07-261-0/+15
|\ \ | |/ |/| fix upgrade of newly added pkg dep from scm locked dep
| * fix upgrade of newly added pkg dep from scm locked depTristan Sloughter2015-07-251-0/+15
| |
* | Merge pull request #642 from tsloughter/validate-otp-versionFred Hebert2015-07-261-1/+51
|\ \ | |/ |/| Validate otp version
| * add support for old format otp versionsTristan Sloughter2015-07-251-15/+16
| |