Actually this is wrong, because `getLocations` ignores `build` when `env` is set. Need to consider both combined.