简体   繁体   中英

Is there a way to directly access the built-in types of starlark language in Bazel?

For example, is there a way to call the constructor of File class to create an instance of it?

Generally it just depends on the thing you want. Some things like File you have to go through an API, for example to create a file object in a rule function, you would use ctx.actions.declare_file(filename)

See this for examples: https://docs.bazel.build/versions/master/skylark/lib/actions.html#declare_file

Other things you can create directly, like depset has depset() . See global functions here https://docs.bazel.build/versions/master/skylark/lib/skylark-overview.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM