snippets icon indicating copy to clipboard operation
snippets copied to clipboard

Transition rule incompatible with implicit output ".stripped"

Open deeglaze opened this issue 3 years ago • 0 comments

The native.cc_binary rule produces two extra labels that allow a user to build a version with debug symbols stripped by naming the label with ".stripped" added explicitly. This rule doesn't allow carrying forward such implicit outputs.

In an attempt to fix this, I changed the cc_binary macro to have an extra transition_rule definition for carrying through "_native_binary.stripped", but this produces an error.

generated file '...my_native_binary.stripped' is misplaced here (expected no files). Since this rule was created by the macro 'cc_binary', the error might have been caused by the macro implementation

Since this is a file and not a rule, I changed the transition_rule to copy through any other output files with extension "stripped" and name the output file ctx.label.name + ".stripped". This results in a target 'mytarget.stripped' not declared in package error. I'm guessing this behavior can't be fixed without changing Bazel because native.cc_binary is weird, but perhaps you know some other trick?

deeglaze avatar Aug 14 '21 03:08 deeglaze