bazelbuild / bazel-skylib

Common useful functions and rules for Bazel
https://bazel.build/
Apache License 2.0
387 stars 180 forks source link

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

Open eustas opened 1 year ago

eustas commented 1 year ago

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.

tetromino commented 1 year ago

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

Wyverald commented 1 year ago

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

tetromino commented 1 year ago

Thanks! In this case, a PR is welcome