Closed weberc2 closed 5 years ago
This is largely addressed by cb8a0eb0e999f09e0fa1bca863c7d274c958438a. There is now a distinction between loading packages (BUILD files) and loading libraries (.star
files). Libraries must be loaded via load("lib://path/to/lib", ...)
where the path must point to a .star
file. Libraries may also load other libraries but not targets, and libraries may also not invoke mktarget directly. This may change in the future, especially concerning libraries that would like to add a dependency (e.g., the py_test
function creates Python test targets which should each depend on the pytest
target).
Rather than using
reftarget()
to address other targets from BUILD files, we should allow importing/loading them and referencing them using their symbols in the starlark language.Considerations
name = ...
field and only use they name of the symbol in the defining package?mktarget()
doesn't actually mutate the list of targets, but maybe we collect targets by scanning the globals output from each package?a = mktarget(...); b = a
? Area
andb
two distinct targets (identical in everything but name)?