load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

oncall("executorch")

fbcode_target(_kind = runtime.python_library,
    name = "schemas",
    srcs = ["schemas/__init__.py"],
    resources = [
        "schemas/tosa_1.0.fbs",
    ],
    visibility = ["PUBLIC"],
)

fbcode_target(_kind = runtime.python_library,
    name = "cast_support",
    srcs = [
        "cast_support.py",
    ],
    deps = [
        "//caffe2:torch",
        ":specification",
    ],
)

fbcode_target(_kind = runtime.python_library,
    name = "constant_pool",
    srcs = [
        "constant_pool.py",
    ],
    deps = [
        "fbsource//third-party/tosa_tools:serializer",
    ],
)

fbcode_target(_kind = runtime.python_library,
    name = "mapping",
    srcs = [
        "mapping.py",
    ],
    deps = [
        "fbsource//third-party/tosa_tools:serializer",
        "//caffe2:torch",
        ":specification",
    ],
)
fbcode_target(_kind = runtime.python_library,
    name = "specification",
    srcs = [
        "specification.py",
    ],
    deps = [
        "fbsource//third-party/pypi/packaging:packaging",
        "//executorch/exir/backend:compile_spec_schema",
    ],
)
fbcode_target(_kind = runtime.python_library,
    name = "utils",
    srcs = [
        "utils.py",
    ],
    deps = [
        "//executorch/backends/arm/operators:node_visitor",
    ],
)

fbcode_target(_kind = runtime.python_library,
    name = "resize_utils",
    srcs = [
        "resize_utils.py",
    ],
    deps = [
        "//caffe2:torch",
        ":specification",
    ],
)

fbcode_target(_kind = runtime.python_library,
    name = "tosa",
    srcs = [
        "__init__.py",
    ],
    deps = [
       ":specification",
    ],
)

fbcode_target(_kind = runtime.python_library,
    name = "compile_spec",
    srcs = [
        "compile_spec.py",
    ],
    deps = [
        ":tosa",
        ":specification",
        "//executorch/backends/arm:arm_compile_spec",
    ],
)

fbcode_target(_kind = runtime.python_library,
    name = "partitioner",
    srcs = [
        "backend.py",
        "partitioner.py",
    ],
    deps = [
        ":compile_spec",
        ":constant_pool",
        "//executorch/backends/arm:constants",
        "//executorch/backends/arm:process_node",
        "//executorch/backends/arm/debug:schema",
        "//executorch/backends/arm/operator_support:operator_support",
        "//executorch/backends/arm/_passes:passes",
        "//executorch/exir:lib",
    ],
)
