Analyzer: Look for bazel BUILD file before .packages files
Analyzer: Look for bazel BUILD file before .packages files

Also move local function packageRootedHere outside of a while loop.

Change-Id: Ie900a36507934038a7bace23e6241a9c91080943
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178640
Commit-Queue: Samuel Rawlins <5cf2cac5eec2ad6d0eb2b0f4ff6af9a590ce2bf6@google.com>
Reviewed-by: Konstantin Shcheglov <09e4d7516628963212bf4aace2f97603d2b706e4@google.com>

dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk