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

Match on dep name in overrides #2287

Merged

Conversation

pablocostass
Copy link
Contributor

This patch aims to make rebar3 delete a dependency by first looking for
its name (fixing del on hex dependencies) and if that isn't found
remove it as always, keeping its current behaviour with the del override.

Closes #2126.

This patch aims to make rebar3 delete a dependency by first looking for
its name (fixing `del` on hex dependencies) and if that isn't found
remove it as always, keeping its current behaviour with the `del` override.
@tsloughter
Copy link
Collaborator

Thanks, could you add a test for this?

@tsloughter
Copy link
Collaborator

I know the deps tests can be confusing but I think override tests might be easy enough to add a test for this that just checks the configuration in the state ends up right after running the overrides on a config.

@pablocostass
Copy link
Contributor Author

Pinging just in case @tsloughter :)

{deps, TopDeps},
{overrides, [
{del, some_dep, [
{deps, [other_dep]}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this inner part? Are you sure you need this? Shouldn't it just be {del, some_dep}?

Copy link
Collaborator

@ferd ferd Jun 16, 2020

Choose a reason for hiding this comment

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

This allows to only override one entry in the deps tuple as defined in some_dep. Seemed right to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I did the test with the inner part to, as Fred said, override one the other_dep from some_dep, since in the issue the example you gave with eredis_cluster and ex_doc is the same.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I completely misread this. It is kinda confusing to read...

So it is saying "delete dep 'other_dep' from 'some_dep's list of deps"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. A real example would be the one you mentioned in the issue:

The eredis_cluster hex package includes ex_doc which can't be built with rebar3 so it fails. The solution is to override all deps but really this should work too:

{overrides, [{del, eredis_cluster, [{deps, [ex_doc]}]}]}.

If you prefer the override in the test to be a one-liner too I can change that :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, no, this is good.

@tsloughter tsloughter merged commit aa546d2 into erlang:master Jun 16, 2020
@pablocostass pablocostass deleted the 2126_match_on_dep_name_in_overrides branch June 16, 2020 18:52
@pablocostass pablocostass restored the 2126_match_on_dep_name_in_overrides branch August 29, 2020 08:20
@pablocostass pablocostass deleted the 2126_match_on_dep_name_in_overrides branch August 29, 2020 08:20
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.

Match on dep name in overrides
3 participants