load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:drake_cc.bzl",
    "drake_cc_googletest",
    "drake_cc_library",
    "drake_cc_package_library",
)

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

drake_cc_package_library(
    name = "expression",
    visibility = ["//common/symbolic:__pkg__"],
    deps = [
        ":everything",
    ],
)

drake_cc_library(
    name = "everything",
    srcs = [
        "all.cc",
        "boxed_cell.cc",
        "environment.cc",
        "expression.cc",
        "expression_cell.cc",
        "formula.cc",
        "formula_cell.cc",
        "ldlt.cc",
        "variable.cc",
        "variables.cc",
    ],
    hdrs = [
        "all.h",
        "boxed_cell.h",
        "environment.h",
        "expression.h",
        "expression_cell.h",
        "expression_kind.h",
        "expression_visitor.h",
        "formula.h",
        "formula_cell.h",
        "formula_visitor.h",
        "ldlt.h",
        "variable.h",
        "variables.h",
    ],
    interface_deps = [
        "//common:drake_bool",
        "//common:essential",
        "//common:hash",
        "//common:random",
        "//common:reset_after_move",
    ],
    deps = [
        "@abseil_cpp_internal//absl/container:flat_hash_set",
        "@abseil_cpp_internal//absl/container:inlined_vector",
        "@fmt",
    ],
)

drake_cc_googletest(
    name = "boxed_cell_test",
    deps = [
        ":expression",
    ],
)

drake_cc_googletest(
    name = "environment_test",
    deps = [
        ":expression",
    ],
)

drake_cc_googletest(
    name = "expression_test",
    deps = [
        ":expression",
        "//common/test_utilities:eigen_matrix_compare",
        "//common/test_utilities:is_memcpy_movable",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_array_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_cell_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_differentiation_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_expansion_test",
    deps = [
        ":expression",
        "//common/test_utilities:limit_malloc",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_jacobian_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_matrix_test",
    deps = [
        ":expression",
        "//common/test_utilities:eigen_matrix_compare",
        "//common/test_utilities:expect_throws_message",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "expression_transform_test",
    deps = [
        ":expression",
        "//common/test_utilities:eigen_matrix_compare",
        "//math:geometric_transform",
    ],
)

drake_cc_googletest(
    name = "formula_test",
    deps = [
        ":expression",
        "//common/test_utilities:expect_no_throw",
        "//common/test_utilities:is_memcpy_movable",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "formula_visitor_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "ldlt_test",
    deps = [
        ":expression",
        "//common/test_utilities:eigen_matrix_compare",
        "//common/test_utilities:expect_no_throw",
    ],
)

drake_cc_googletest(
    name = "mixing_scalar_types_test",
    deps = [
        ":expression",
        "//common/test_utilities:limit_malloc",
    ],
)

drake_cc_googletest(
    name = "ostream_test",
    deps = [
        ":expression",
    ],
)

drake_cc_googletest(
    name = "sparse_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "substitution_test",
    deps = [
        ":expression",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "variable_test",
    deps = [
        ":expression",
        "//common/test_utilities:is_memcpy_movable",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "variable_overloading_test",
    deps = [
        ":expression",
        "//common/test_utilities:expect_no_throw",
        "//common/test_utilities:symbolic_test_util",
    ],
)

drake_cc_googletest(
    name = "variables_test",
    deps = [
        ":expression",
    ],
)

add_lint_tests()
