mrdomino / sandstorm-bazel

Starter repo for building Sandstorm apps in bazel
3 stars 1 forks source link

capnproto code is inlined #1

Open mrdomino opened 8 years ago

mrdomino commented 8 years ago

"You should use an external for it!" you say.

Sure, that'd be nice, but then how do I get capnproto.bzl to be available from that external? Keep in mind that you can't reference Skylark rules in the //external namespace for some reason.

Don't even say the word "submodule." This issue is for constructive discussion only.

mrdomino commented 8 years ago

Incidentally, the way https://github.com/bazelbuild/rules_closure does this seems like a good approach: filegroups inside the external, reference into the filegroups from the main repo.

mrdomino commented 8 years ago

rules_closure appears to differ from this case in that they don't need to generate files that are functions of paths of srcs.

I'm currently computing the output filenames the dumb way: just appending '.h' and '.c++' to the input srcs. This doesn't work when srcs is a label. What it seems I'd like to do is have _capnp_gen figure out the output filenames, then pass those to the cc_library.

But from my capnp_cc_library, I don't know how to get at the struct returned by the implementation of the _capnp_gen rule. If I just say gen = _capnp_gen(...), then gen is of type Rule, which has only a name and label. And if I change capnp_cc_library from a function definition to a rule(), I don't know how to create a native.cc_library.