facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.49k stars 215 forks source link

Allow load to take variable string or functions that returns string #709

Open izissise opened 2 months ago

izissise commented 2 months ago

Hello,

In buck2 load statements can only take constant string as parameters, it would be nice if it could take anything that resolve to a string. This would allow to reduce refactoring pain when moving a directory:

# buck2/utils.bzl
def local_repo(file):
  return f'buck2/plugins/{file}'

# BUCK
load(local_repo('xxx'))

Thanks, Hugues

izissise commented 1 month ago

Maybe it can be gated being a config flag, so it would still be forbidden for orgs that don't want this.

A similar issue exist for declaring function in BUCK files.