#!/usr/bin/env fuchsia-vendored-python
# Copyright 2021 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Assert that drivers aren't included in the build without a driver component"""

import argparse


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        "--metadata_file",
        type=argparse.FileType("r", encoding="UTF-8"),
        help="Path to the metadata file which tried to collect data about drivers",
    )
    parser.add_argument(
        "--output",
        type=argparse.FileType("w", encoding="UTF-8"),
        help="The path for the output file for the build.",
    )

    args = parser.parse_args()

    lines = args.metadata_file.readlines()
    if len(lines) != 0:
        print("All drivers should have driver components. These do not:")
        for line in lines:
            print("   " + line, end="")
        print(
            "Please visit https://fuchsia.dev/fuchsia-src/development/drivers/developer_guide/driver-development for how drivers should be included."
        )
        raise Exception("Found drivers that weren't driver components")
    args.output.write("passed")


if __name__ == "__main__":
    main()
