Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only eval config scripts and apply overrides once per app #1879

Merged
merged 3 commits into from
Sep 11, 2018

Conversation

tsloughter
Copy link
Collaborator

Sending to hex_core for now since it fits better in those overall changes to dep handling.

Plus it will be good to keep this out of master and get it tested by people first since it could have unintended consequences.

@tsloughter tsloughter requested a review from ferd September 10, 2018 19:19
is_available(#app_info_t{is_available=IsAvailable}) ->
IsAvailable.

%% @doc sets whether the app is a available app or not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add a bit of doc there to mention that "an app should only be declared available once profiles/overrides have been applied" I guess?

case Upgrade orelse rebar_app_info:is_lock(AppInfo) of
true ->
case rebar_fetch:needs_update(AppDir, Source, State) of
case rebar_fetch:needs_update(AppInfo, rebar_app_info:source(AppInfo), State) of
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this going to crash custom resource handlers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, yea :(. I couldn't think of a better way to do the needs_update for pkg deps that didn't do a disk search like it currently does. Hm.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How bad would things be if both forms were supported (in say a 3-4 arguments forms) and in case one doesn't work we shift to the other one? From the diff, git and hg resource handlers needed no further context anyway so that it seems safe to fallback to the old form.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it would work. I can just do a check on if it is exported.

Tho really, I think the resource should take an AppInfo instead of a directory and source in all those functions (lock, download, make_vsn). Even if, like is the case with hg and git, they simply pull out the dir and source and use them it seems cleaner to pass the AppInfo record and let the resource do what it needs.

There can't be that many custom resources. I think it might be better to switch all of the functions to take an AppInfo and I can try finding the custom resources to tell them to update.

Though, I just had an idea. I can do that but make it rebar_resource_v2. Then the functions that use the resource can check Resource:module_info() if it has the attribute rebar_resource_v2 use the new functions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing the behaviour check instead of exported check since then they can have the same arity.

@tsloughter tsloughter force-pushed the eval-config branch 2 times, most recently from 6ac1756 to 55afb5a Compare September 11, 2018 20:57
@tsloughter tsloughter merged commit 5c08535 into erlang:hex_core Sep 11, 2018
tsloughter added a commit to tsloughter/rebar3 that referenced this pull request Sep 13, 2018
* 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
tsloughter added a commit to tsloughter/rebar3 that referenced this pull request Sep 13, 2018
* 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
tsloughter added a commit that referenced this pull request Sep 14, 2018
…ns (#1884)

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants