Questions tagged [starlark]

Starlark is a dialect of Python intended for use as a configuration language. Developed for the Bazel build tool and previously called Skylark.

Starlark is a dialect of Python intended for use as a configuration language. Developed for the Bazel build tool and previously called Skylark.

42 questions
1
vote
0 answers

Bazel get full path of bazel-out/workspace in Skylark

I want to integrate checkstyle with bazel following this SO thread: What is the best way to invoke Checkstyle from within Bazel? which works perfectly as long as I provide the full harcoded path when building the classpath checkstyle.bzl for file in…
KeykoYume
  • 2,497
  • 6
  • 24
  • 48
1
vote
1 answer

Telegraf Starlark processor - how to convert date time to Unix epoch format

I followed the tutorial https://www.influxdata.com/blog/json-to-influxdb-with-telegraf-and-starlark/ to get started with Telegraf and Starlark. I get data in JSON format, but following tutorial and treating the input as String and then parsing using…
Devang Thakkar
  • 49
  • 1
  • 1
  • 5
1
vote
1 answer

Is there a way to improve starlark's unittest error reporting?

I'm writing analysis-time tests for my project as per https://docs.bazel.build/versions/master/skylark/testing.html and I'm wondering what the most useful way of reporting failures is. Using the unittest.bzl module, I am using asserts.equals,…
MHStag
  • 61
  • 6
1
vote
1 answer

Bazel: Referencing a file inside an output directory in a genrule

I am trying to reference an output of a rule that is nested inside an output directory of another rule in a genrule. For example, I use rules_foreign_cc to build boost: boost_build( name = "boost", lib_source = "@boost//:all", linkopts =…
Dig-Doug
  • 91
  • 8
1
vote
1 answer

Toolchain not downloading the tool

Hi I'm trying to set up a toolchain for the Fn project. The approach is to set up a toolchain per binary available in GitHub and then, in theory use it in a rule. I have a common package which has the available binaries: default_version =…
mrk
  • 75
  • 8
1
vote
2 answers

Loading performance

For (incremental) loading performance I want to split a huge (believe me), generated BUILD.bazel into smaller .bzl files. In each .bzl I then plan to have a Macro foo, which contains the actual rule calls: def foo(): foorule("a") …
abergmeier
  • 13,224
  • 13
  • 64
  • 120
0
votes
0 answers

Is it possible to create a drop-in replacement for cc_library that generates test targets in bazel?

I have certain build targets which need to be build in two ways - one for my production application and one for my test code. I would like it if I only had to specify which targets had this requirement one time. For example, I have a macro that does…
Andrew King
  • 145
  • 10
0
votes
1 answer

Unable to use py_binary target as executable in a custom rule

I have a py_binary executable target, and want to use this from a custom rule. I am able to get this to work, but only by duplicating the dependencies of my py_binary target with my custom rule. Is there any way to avoid this duplication and…
Steve Vermeulen
  • 1,406
  • 1
  • 19
  • 25
0
votes
1 answer

Declaring both directory and inner files in a Bazel rule

I want a Bazel rule which creates a directory, takes a bunch of files, and creates an ISO out of that directory (the ISO is the intended output here, the other files are just byproducts). # Declare root directory root_directory =…
Omer Lubin
  • 551
  • 2
  • 8
  • 24
0
votes
1 answer

How to write content to local disk for starlark

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
0
votes
0 answers

Telegraf Starlark - How to pass configuration file?

My telegraf receives messages from eventhub where the tag has "A". Now i want to transform from "A" to "B", "C", "D" using a loopup configuration file which i have. I see Processor.Enum can apply only update at a time also it doesn't take…
KNDM
  • 47
  • 7
0
votes
1 answer

Why doesn't this rule create a file every time it is built?

I write the below bazel rule for incremental test. This rule(foo_library) has a dependency property. When there are no dependencies, it creates a file with its own name, filling the contents of the file with its own name. When there is a dependency,…
Grrrr
  • 7
  • 2
0
votes
1 answer

When use Pants to build Django it raise "ModuleNotFoundError: No module named"

I configured Pantsbuild for our Django project, and everything worked neatly. Here is my BUILD file: python_requirement( name="django", requirements=["django==4.1.1"], ) python_sources( name="lib", dependencies=[ …
Xurvan
  • 179
  • 2
  • 14
0
votes
1 answer

How can I pass an alias value to a bazel function?

I have the following alias defined in a BUILD file: alias( name = "platform", actual = select({ ":macos_x86_64": "macos_x86_64", ":linux_x86_64": "linux_x86_64", ":linux_aarch64": "linux_aarch64", }), …
qwerty
  • 188
  • 4
0
votes
1 answer

Bazel Question: `filegroup` to `declare_directory`

I have a general question about how to make filegroup into a declare_directory. So what I can think about is like, filegroup -> pkg_tar -> untar_to_dir(A rule to untar the tarball into the declare_directory). It would work, and I already proved it.…