load("@rules_haskell//haskell:defs.bzl", "haskell_library", "haskell_test") # example for basic usage of the autodetect directive # # gazelle_haskell_modules:srcs: src/ haskell_library( name = "package-c", ghcopts = [ "-DVERSION_package_b=\"0.1.0.0\"", "-XScopedTypeVariables", "-lm", ], hidden_modules = ["PackageC.Other.B"], version = "0.1.0.0", visibility = ["//visibility:public"], deps = [ "//package-a", "//package-a:package-a-v2", "@stackage//:base", "@stackage//:void", ], ) # example where we combine files in srcs with ones found by the directive # # gazelle_haskell_modules:srcs: explicit-src/Autodetect/ haskell_library( name = "package-c-explicit-srcs", srcs = [ "explicit-src/Autodetect/Root.hs", "explicit-src/Explicit/DepOnAuto.hs", ], ghcopts = [ "-DVERSION_package_b=\"0.1.0.0\"", "-XScopedTypeVariables", "-lm", ], version = "0.1.0.0", visibility = ["//visibility:public"], deps = [ "@stackage//:base", "@stackage//:void", ], ) # example where we have more than one folder to search # # gazelle_haskell_modules:srcs: src/ multiple-folder-src/ haskell_library( name = "package-c-multiple-srcs", ghcopts = [ "-DVERSION_package_b=\"0.1.0.0\"", "-XScopedTypeVariables", "-lm", ], hidden_modules = [ "PackageC.Other.B", "PackageC.Other.F", ], version = "0.1.0.0", visibility = ["//visibility:public"], deps = [ "//package-a", "//package-a:package-a-v2", "@stackage//:base", "@stackage//:void", ], ) # example where we have already autodetected some modules, but a new one has been added # # gazelle_haskell_modules:srcs: add-module-src/ haskell_library( name = "package-c-detect-new", ghcopts = [ "-DVERSION_package_b=\"0.1.0.0\"", "-XScopedTypeVariables", "-lm", ], hidden_modules = ["PackageC.Other.B"], modules = [ ":package-c-detect-new.PackageC.Exposed.A", ":package-c-detect-new.PackageC.Other.B", ], narrowed_deps = [ "//package-a", "//package-a:package-a-v2", ], version = "0.1.0.0", visibility = ["//visibility:public"], deps = [ "@stackage//:base", "@stackage//:void", ], ) # test that we ignore autodetection when keep is present # # gazelle_haskell_modules:srcs: tests # gazelle_haskell_modules:keep haskell_test( name = "test", srcs = [ "tests/Main.hs", "tests/PackageC/Other/C.hs", ], ghcopts = [ "-DVERSION_package_b=\"0.1.0.0\"", "-DTASTY_DISCOVER_TASTY_DISCOVER_PATH=$(location @stackage-exe//tasty-discover)", ], tools = ["@stackage-exe//tasty-discover"], version = "0.1.0.0", visibility = ["//visibility:public"], deps = [ ":check-package-c-explicit-srcs", ":check-package-c-multiple-srcs", ":package-c", "@stackage//:base", "@stackage//:tasty", "@stackage//:tasty-hunit", ], ) # rule generated by gazelle_haskell_modules haskell_module( name = "package-c-detect-new.PackageC.Exposed.A", src = "add-module-src/PackageC/Exposed/A.hs", src_strip_prefix = "add-module-src", visibility = ["//visibility:public"], deps = [":package-c-detect-new.PackageC.Other.B"], ) # rule generated by gazelle_haskell_modules haskell_module( name = "package-c-detect-new.PackageC.Other.B", src = "add-module-src/PackageC/Other/B.hs", src_strip_prefix = "add-module-src", visibility = ["//visibility:public"], ) haskell_library( name = "check-package-c-explicit-srcs", srcs = ["checksrc/CheckPackageCExplicit.hs"], deps = [ ":package-c-explicit-srcs", "@stackage//:base", ], ) haskell_library( name = "check-package-c-multiple-srcs", srcs = ["checksrc/CheckPackageCMultipleSrcs.hs"], deps = [ ":package-c-multiple-srcs", "@stackage//:base", ], )