load(
    "//doc:defs.bzl",
    "DEFAULT_TEST_TAGS",
    "enumerate_filegroup",
)
load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:drake_py.bzl",
    "drake_py_binary",
    "drake_py_library",
)

package(default_visibility = ["//visibility:private"])

# TODO(eric.cousineau): Add a smaller stub library stub to test this extension.
drake_py_library(
    name = "pydrake_sphinx_extension_py",
    srcs = ["pydrake_sphinx_extension.py"],
    deps = [
        "//bindings/pydrake",
        "//doc/doxygen_cxx:system_doxygen",
    ],
)

filegroup(
    name = "sphinx_input",
    srcs = [
        "_static/css/custom.css",
        "conf.py",
        "footer.html",
        "layout.html",
        "searchbox.html",
    ],
)

enumerate_filegroup(
    name = "sphinx_input.txt",
    data = [":sphinx_input"],
)

drake_py_binary(
    name = "build",
    srcs = ["build.py"],
    add_test_rule = 1,
    data = [
        ":sphinx_input",
        ":sphinx_input.txt",
    ],
    test_rule_args = [
        "--out_dir=<test>",
        # Only generate some modules, so that the test provides quick feedback.
        "pydrake.math",
    ],
    test_rule_tags = DEFAULT_TEST_TAGS,
    visibility = ["//doc:__pkg__"],
    deps = [
        ":pydrake_sphinx_extension_py",
        "//bindings/pydrake",
        "//doc:defs",
        "@stable_baselines3_internal//:stable_baselines3",
    ],
)

add_lint_tests()
