Comments (4)
You can make a macro.
def wrapped_cxx_library(srcs=[], **kwargs):
srcs.append("file.hh")
native.cxx_library(srcs = srcs, **kwargs)
You don't need to return anything, rules don't return anything when you call them anyway (only the impl functions do). You can call multiple rules, and connect up the outputs of one to the inputs of the other, by constructing
whatever = "{}-whatever".format(name)
native.cxx_library(name = whatever, ...)
native.cxx_library(..., deps = kwargs.pop("deps") + [":{}".format(whatever)], **kwargs)
from buck2.
I'm using macros for this purpose right now, and it generally works ok but sometimes I wish I had access to some of the things in a rule impl's context structure.
from buck2.
The inner()
function is a function that declares a target (and does a bunch of other stuff). As the error message indicates, you cannot do that during analysis. You could, however, call the _inner_impl()
function if you wanted.
from buck2.
Yea, unfortunately I can't do that unless I have access to the impl. So I can't do it, for example, if I want to forward to cxx_library
. In any case, I can continue with just using macros, I can still solve the problem I was having, just not as nicely as if I had the full power of a rule.
from buck2.
Related Issues (20)
- genrule with output folder consumed by cxx_library HOT 17
- How do you read metadata from a bxl? HOT 8
- Symlinked source directories are wonky HOT 4
- Build cdylib with rust_library? HOT 3
- Golden testing? HOT 4
- Watchman/buck2 integration HOT 2
- How can you get a library's output path from bxl? HOT 7
- Why does bxl_actions require an execution platform? HOT 1
- Remote execution can't find executable HOT 13
- haskell_library fails on MacOS
- Feature Request: Shutdown buck2 server after some idle time
- --show-output (and related options show nothing in column 2) when using DefaultInfo with default_outs HOT 1
- Full rebuild after killing daemon HOT 8
- Suggestion: Use tar or zip for release artifacts
- Why can not Buck trigger Buildbarn's g++ using system_cxx_toolchain?
- 'buck2 build //tests:' can not find 'sh' when using case 'buck2/examples/remote_execution/buildbarn/tests'
- License details (for SPDX compliance) HOT 2
- Buck2 performance on single-file update in erlang project HOT 13
- `SRCDIR` is not absolute in genrule script HOT 2
- It should be possible to consume multiple `default_outputs` in an `attrs.list(attrs.source())` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buck2.