derekdreery / depgraph

makefile-style dependency building in rust
5 stars 1 forks source link

feature request: implicit dependency on `build.rs`? #4

Open Dushistov opened 7 years ago

Dushistov commented 7 years ago

At now if you change something in build.rs, rust-lang/cargo automaticaly run build.rs, but rules run only you explicity add build.rs to dependency graph.

Of course explicity better then implicity, but I can not think of usage scenario where you not need dependency from build.rs?

So why not add implicity rule that any rule depend also from build.rs?

derekdreery commented 7 years ago

I need to think about this properly, but at the moment, this library could be used to build anything, including non-rust stuff. Might it be better to create another library that re-exports stuff from this library, and adds any useful rust stuff, like the above?

Dushistov commented 7 years ago

@derekdreery

I need to think about this properly, but at the moment, this library could be used to build >anything, including non-rust stuff.

Oh, I missed this point.

Might it be better to create another library that re-exports stuff from this library, and adds any useful rust stuff, like the above?

Is it too complicated, why not just add method like all_rules_depend_on_build_rs() to DepGraphBuilder?

derekdreery commented 7 years ago

ok I could do that.

Dushistov commented 7 years ago

@derekdreery

ok I could do that.

Great, I would like integrate depgraph into one of my opensource projects, to use this project you have to use build.rs, and users complain about its complexity, I hope with help of depgraph to make it little simplier.

derekdreery commented 7 years ago

I've added a function in commit e2009f3 that adds a dependency to all previously added files, so at the end of a chain, you can do

    .add_dep_to_all("build.rs")

Does this solve your problem?

Dushistov commented 7 years ago

@derekdreery

Yes, thank you.

Dushistov commented 7 years ago

@derekdreery

I did additional testing, and see one bad thing, depgraph gives build.rs as dependency to rule. Is it possible to not inform rules about this depedency?

Because of it is inconvinient in each rule add .filter_map to remove build.rs.

derekdreery commented 7 years ago

OK, so maybe instead of adding this file as a dependency, it could go into a separate global pool of files that will always trigger rebuilds, but don't inform the build functions of their presence.