Reputation: 43
Hi I would like to read a content of local file in .bzl file.
print(onefile.basename)
#content = ctx.read
#content=ctx.file.onefile
#print(onefile.content)
Upvotes: 3
Views: 8928
Reputation: 4271
.bzl
code cannot read files, and can't make decisions based on contents of files.
You must create actions (e.g. ctx.actions.run
), make the file an action input, and have the action read the file.
.bzl
code can load other .bzl
files though, you might find that useful.
Upvotes: 5