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

Don't use 'project_apps' #1

Closed
tsloughter opened this issue Jun 30, 2015 · 7 comments
Closed

Don't use 'project_apps' #1

tsloughter opened this issue Jun 30, 2015 · 7 comments

Comments

@tsloughter
Copy link

Use of project_apps is actually a special case for rebar3 providers or providers that are to only be run at the top level (like the todo list plugin). But since a plugin like this needs to also work when being used by a dependency it should work like the erlydtl plugin by using rebar_state:dir/1 to find what app/dir it is currently working on: https://github.com/tsloughter/rebar3_erlydtl_plugin/blob/master/src/rebar3_erlydtl_plugin.erl#L125

@carlosedp
Copy link
Owner

This does not work for example in my project where the root project dir is not an App dir so the "{true, AppInfo} = rebar_app_discover:find_app(Dir, all)" returns false and fails the match. My apps are in "apps" directory.

I implemented exactly the same logic but it does not work. Maybe I should concatenate the root dir with the project and deps dirs. What do you suggest?

The line below does a similar thing to what I do...
AllApps = rebar_state:project_apps(State) ++ rebar_state:all_deps(State),

@tsloughter
Copy link
Author

If you put the hook in the rebar.config of the app, as in put it in apps/<app>/rebar.config, then the dir will be correct. But yea it will break running at the top level of a project with apps. If you want to support both you can have it check if it is at the root and then run on all project_apps, but by default or as a fall back use the app in rebar_state:dir.

I'll have to work on documenting this on rebar3.org and maybe making some additions to the rebar_api module to ease usage...

@carlosedp
Copy link
Owner

I will have the plugin check if the rebar_state:dir is a project. If it is, then I run the compiler/cleaner on it. In case it is not, I search the deps and project_apps and run the plugin on them all.
Ok?

@tsloughter
Copy link
Author

Yup, sounds good.

@carlosedp
Copy link
Owner

Found a couple of problems with rebar recently. The new robocopy change does not move files correctly, only folders. I'm working on a fix.

In the meanwhile I submitted a pull request to support http proxy from environment variables for both bootstrap and rebar3. erlang/rebar3#579

carlosedp added a commit that referenced this issue Jul 1, 2015
@carlosedp
Copy link
Owner

Last commit just bumps version. Would you check so I can publish to Hex the new vsn.
Thanks for the help Tristan.

@carlosedp
Copy link
Owner

Fixed on vsn 0.2.0. Published to hex.pm.

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

No branches or pull requests

2 participants