-
Notifications
You must be signed in to change notification settings - Fork 519
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
fix hooks and plugins usage when cleaning build artifacts for deps #1698
Conversation
Hm, could you include a test? Pretty sure I understand what the issue is but maybe the how the fix work will make more sense to me with a test. |
Like why is |
Oh and did you run I assumed the issue was that the deps weren't including their hooks in their config when running clean and thus each app had an empty hook list. But instead is it that you are running |
Sure, I'll try and make a test. The reason why install_deps there is because of dep rebar.configs like this one:
Anyway, if I the way I figured that out was that as soon as I fixed the first bug, our builds started failing in the repo I was using the new rebar3 code. |
The problem with using |
I agree, but how are you going to run the So what is the intent of a
I'm gonna add a test case, I have it ready. |
That test fails on master, but not in my branch. |
I'm gonna see if fails on my first commit as well, cause if it passes on my first commit, the test does not test deep enough. |
Oh, and to answer tsloughter's question, yes, we run |
Ok, the test is deep enough, if you remove the dependency |
57cb7ad
to
5c5432b
Compare
I fixed a typo in the commit message. |
I can't figure out why it failed a test in a random module that I haven't touched. |
is it possible to rerun the travis? |
I haven't given it a lot of thought (still coming back from holidays) but I would expect that Like there's a very clear expectation that we don't require to compile the beam files just to remove them either, so downloading deps just to get rid of them is weird. Additionally what we're needing to build here specifically are not deps, but plugins. Right now they're all intertwined though. Like this just sounds like we've messed up the design for |
So this is what I have discovered so far. We could make We could do a separate The reason I did the one-liner was that it actually makes the examples of |
So there's a lot here
I think we have juggled with some ideas in the past, one being a 'discover_deps' step that discovers currently installed deps and plugins and loads them, but does not install them if they're not there yet. I think that was in the context of allowing offline builds though, so I'm not sure what is appropriate here. Top-level plugins should however be in path and accessible at this point, since those should be fetched on any run, even if only to call I however am not surprised if the dependencies' own plugins do not work with Before fixing the behaviour of |
I still think this should be merged until a better solution is coded. It is the path of least surprise. Sure if you clone a new repo and do a clean, it will download the deps first. Confusing, maybe, but it won't break your build. As it stands with this bug in place, it actually breaks your build and in our case leaves .so files that shouldn't be there after a clean. In our company we use both Mac and Linux machines, but all our servers run Linux, and when we compile inside docker we want all Mac compiled .so files to be gone so they can be compiled for Linux inside the docker container. This of course doesn't happen, and we have to work around it with Makefiles doing the cleaning. |
5c5432b
to
22a9b9c
Compare
find_apps didn't read config files so no hooks were in the app_infos, and now that hooks are being done rebar needs plugins to be able to run clean plugin hooks in deps.
22a9b9c
to
fee322e
Compare
I think that I still think this should be merged as is so we can fix the bug until we have a better solution. |
Sorry, life has been super hectic for me lately and I haven't had enough time to give to all of this. Unless @tsloughter has oppositions to revert this, I'll merge the pull request since I've had no time to spend on it and the current patch, while unintuitive, at least allows proper cleanup to take place for build steps. As such I'll be including it as a bug fix and we can always revisit the behaviour later for a more optimal running mechanism. Those who want to get rid of the deps can still use rm -rf _build as they likely do today. |
Great news! However, I think we should put up a release note if we can. There are lots of repos out there that use hooks that never have been run. I was hit by this one this morning: https://github.com/deadtrickster/prometheus.erl/blob/084616996c4cd6d499ade1fd925dbbdfb88cac90/rebar.config#L22 I was building this as a dep inside docker using ubuntu:xenial and it turns out that that post hook needs 'ed' and that wasn't installed. So it might be confusing for people that we fix this bug. So where do we do release notes? |
I'll put them when we cut a release. But yeah, if that breaks too many builds, then we're gonna be in a tough stop of breaking backwards compat by fixing bugs that turned out to be essential in making things work. We'll probably want to make the notice very visible, or otherwise take it up on ourselves to go and submit patches to well-known libraries that are known to break before we cut the next release. |
We are using a dependency that compiles a NIF, but it never clean up its .so-files.
I tried following this example:
https://github.com/blt/port_compiler
And also:
https://www.rebar3.org/v3/docs/building-cc
Turns out, hooks or plugins are never run during clean for any dep.
find_apps didn't read config files so no hooks were in the app_infos,
and now that hooks are being done rebar needs plugins to be able
to run clean plugin hooks in deps.