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

Add secondary hook for rebar_prv_compile #1048

Merged
merged 2 commits into from
Feb 11, 2016

Conversation

soup-in-boots
Copy link

erlc_compile, for before/after compiling .erls to .beams, but before .app.src to .app

After discussing #1044 some on IRC with @tsloughter and @talentdeficit, we concluded something in this form would be viable.

My understanding is that it was originally intended for providers to have only two hooks: pre and post. However, the ability to define arbitrary hook points allows for greater flexibility with respect to scoping out the responsibilities of a given provider. We arguably shouldn't need to separate two closely related operations into different modules just so we can put hooks in between them.

The more I think about this, though, the less certain I am that there is an "optimal" solution. It feels dirty to be adding a "provider hook" for something that's not really a provider. Maybe there's some space in the lexicon for something like pseudo-providers, but it seems kludgy without a formal way for rebar3 to know of their existence.

I can and will write tests for this if it's accepted.

erlc_compile, for before/after compiling .erls to
.beams, but before .app.src to .app
@tsloughter
Copy link
Collaborator

I think we should go with this solution instead of your second.

@ferd @talentdeficit ?

@talentdeficit
Copy link
Contributor

i am ok with adding more hook points even if it is outside of providers. i can probably think of a few more that would be useful

@tsloughter
Copy link
Collaborator

@fauxsoup could you also add a hook around app compiling? I found this useful in a case I needed hooks to run before provider_hooks which isn't possible... But maybe that should change instead.

-define(APP_HOOK, app_compile).
...
    AppInfo4 = rebar_hooks:run_all_hooks(AppDir, pre, ?APP_HOOK, Providers, AppInfo3, State),
    case rebar_otp_app:compile(State, AppInfo4) of
        {ok, AppInfo5} ->
            AppInfo6 = rebar_hooks:run_all_hooks(AppDir, post, ?APP_HOOK, Providers, AppInfo5, State),

tsloughter added a commit that referenced this pull request Feb 11, 2016
Add secondary hook for rebar_prv_compile
@tsloughter tsloughter merged commit b8a590c into erlang:master Feb 11, 2016
@ferd
Copy link
Collaborator

ferd commented Feb 11, 2016

@tsloughter are you going to update the docs for hooks or you keep these hush hush? I can do it too otherwise.

@tsloughter
Copy link
Collaborator

Was going to update. You can if you are going to right now

@ferd
Copy link
Collaborator

ferd commented Feb 11, 2016

Nah, I'm on a call for work stuff, it'd have to go until tonight or something, go ahead if yoU're free.

@tsloughter
Copy link
Collaborator

I updated it.

Tristan Sloughter
t@crashfast.com

On Thu, Feb 11, 2016, at 12:11 PM, Fred Hebert wrote:

Nah, I'm on a call for work stuff, it'd have to go until tonight or something, go ahead if yoU're free.


Reply to this email directly or view it on GitHub[1].

Links:

  1. Add secondary hook for rebar_prv_compile #1048 (comment)

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.

4 participants