Refactor duplicate dependency detection to be in the BUILD file parsing logic