question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

genrule's deps are missing

See original GitHub issue

So, according to the existing docs, every buildrule has a set of deps. But why genrule’s deps have had considered useless and had been removed in the first place ?

I’d personally love using back as an asset processor via genrule with deps so I could chain optipng commands, or even use it to rebuild and refresh docker images. There are multiple generic use cases for the genrule stanza.

I simply don’t get it. As for me, it’s an inconsistency.

Maybe there’s some other way ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Conekocommented, Jun 6, 2017

Note that due to Buck’s caching model, thinking of when targets are being run or executed and how to control that using dependencies doesn’t map intuitively to how it actually works. It’s simpler if you think of inputs and outputs.

This is one of the reasons we removed deps from genrule: some users were used to the task based mental model that other build systems use, for example ant, and were using genrules with deps to replicate that but then hitting all sorts of issues with the caching.

The location macros make it much more explicit that you’re passing the output of certain rules as inputs, so it’s less surprising when the output is retrieved from cache and the genrule is never executed.

1reaction
mikekapcommented, Jun 5, 2017

@yuriy-yarosh you mean like:

genrule(name='foo', out='foo_out', cmd='echo foo > $OUT')
genrule(name='bar', out='bar_out', cmd='echo bar > $OUT')
genrule(name='baz', out='baz_out', cmd='cat $(location :foo) $(location :bar) > $OUT')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bazel dependency on genrule from cc_library doesn't build
I am porting some Makefiles for a very complex embedded system to Bazel, and I'm running into some problems with some weird dependencies...
Read more >
genrule/genrule_test.go - platform/build/soong - Git at Google
package genrule. import ( ... name: "srcs allow missing dependencies", ... inputs, but only if $(in) is not referenced in the genrule cmd....
Read more >
Easier Debugging of Sandbox Failures - Bazel Blog
You can now debug the failure, e.g. you can explore the sandbox: look for any missing file, check for possible errors in your...
Read more >
What's better than a genrule? - Aspect Blog
Sadly, the "canonical" genrule bazel.build/reference/be/general#genrule is pretty lacking, and requires that you give it a bash one-liner or ...
Read more >
Assembly and generate script - Google Groups
ERROR: /Users/paulo/Developer/workspaces/cpp/djinni/generator/BUILD:1:8: Executing genrule //generator:generator failed: missing input file ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found