bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

[feature] Add repository rule for translation of "properties" file into a .bzl

Open eustas opened this issue 2 years ago • 3 comments

Context: https://github.com/bazelbuild/bazel/issues/18617; example: https://github.com/knik0/faad2/pull/162

Just asking if it is appropriate. If so, I'll prepare a PR.

Reasoning: normally to translate "properties" into skylark variables we have to

  1. add repository rule into e.g. workspace.bzl
  2. load and use that rule in WORKSPACE
  3. load resulting .bzl in target BUILD file

Step (1) could be removed if such a rule is a part of bazel-skylib. As a stretch goal, we could add more input formats alongside nearly-native JSON.

eustas avatar Jul 01 '23 08:07 eustas

I'm not sure if this would be best done as a repository rule or a module extension. (@Wyverald, are repository rules going away?)

tetromino avatar Jul 05 '23 19:07 tetromino

Repo rules are not going away. This seems appropriate as a repo rule -- pass a JSON file in, spit a .bzl file out.

Wyverald avatar Jul 05 '23 19:07 Wyverald

Thanks! In this case, a PR is welcome

tetromino avatar Jul 05 '23 20:07 tetromino