cue/load: better treatment for build tags with respect to modules
This implements a coherent approach to build attributes and tool files
across modules:
- tags in build attributes outside the main module are treated as unset
- tool files (`*_tool.cue`) are not considered except when they are in
packages explicitly mentioned on the command line.
This change required a bit of refactoring inside cue/load in order
that the tag logic could be made aware of which module a package
is part of. It also requires changes to the module tidy logic
so that it also respected the rules.
Fixes #3180.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I125655a9fba43f05f8d75d299d927e0ede566479
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197160
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>