# test_omit.py: Loop through the text file generated by the genquery
# rule that lists the deps of @genson//:compile.  Make sure all
# whitelisted deps are present and all blacklisted deps are absent.

white = [
    "@com_owlike_genson//jar:jar",
    "@com_owlike_genson_scala_2_11//jar:jar",
]

black = [
    "@org_scala_lang_scala_library//jar:jar",
    "@org_scala_lang_scala_reflect//jar:jar",
]

with open('genson_compile_deps') as f:
    lines = [line for line in f.read().splitlines()]
    deps = set(lines)
    if not set(white).issubset(deps):
        raise ValueError("One or more deps were expected to be present but not found in deps list: %s" % white)
    if not deps.isdisjoint(set(black)):
        raise ValueError("One or more deps were expected to be absent, but *were* present in deps list: %s" % black)

