0

I want to know how to dump something (say, some string) to local disk. I found there's actions.write API , but seems it only creates an action, but not executes it.

I'm wondering how I could execute an action in starlark?

Tinyden
  • 524
  • 4
  • 13
  • What problem are you trying to solve specifically? I'd love to help, but without more context I'm not sure my answer would be useful – Scott Minor May 16 '23 at 13:40
  • 1
    @ScottMinor Thanks for reply! The problem I met is oversized arguments, my intuition is to dump it to local disk, and use parameter file to load it. But later I discovered bazel already supports it (https://bazel.build/rules/lib/builtins/Args#use_param_file). – Tinyden May 18 '23 at 06:46
  • Good find! Do you want to write an answer to your own question so that I can upvote it? – Scott Minor Jun 08 '23 at 00:26
  • @ScottMinor Sure posted. – Tinyden Jun 08 '23 at 20:59

1 Answers1

1

Bazel supports dumping parameters into a parameter file. Doc reference: https://bazel.build/rules/lib/builtins/Args#use_param_file

Example code:

args.use_param_file("@%s", use_always = False)
args.set_param_file_format("multiline")
Tinyden
  • 524
  • 4
  • 13