Skylark lets you use templates in your output file name, e.g., this would create a file called target.timestamp:
touch = rule( outputs = {"date_and_time": "%{name}.timestamp"}, implementation = _impl, )
So if you had touch(name = "foo")
in a BUILD file and built :foo
, you’d get foo.timestamp.
I’d always used %{name}
, but I found out the other day that you can actually use other attributes, too. For example, you could have:
greet = rule( attrs = {"my_name": attr.string()}, outputs = {"greeting": "hi-there-%{my_name}"}, implementation = _impl, )
Then if you have greet(name = "a-greeting", my_name = "kristina")
and build :a-greeting
, you’ll get “hi-there-kristina” as an output file.
The entire source for this example is available as a GitHub gist (all four lines of implementation function not shown above).
This is a very interesting web page and I have enjoyed reading many of the articles and posts contained on the website, keep up the good work and hope to read some more interesting content in the future. http://ssapptricks.com/download-bhim-app/
LikeLike
I loved the way you discuss the topic great work thanks for the sharing this valuable info. Thank you for bringing more information to this topic for me. I’m truly grateful and really impressed. http://ssapptricks.com/download-bhim-app/
LikeLike