# Copyright (c) 2019 The DAML Authors. All rights reserved. # SPDX-License-Identifier: Apache-2.0 load( "//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_library", "da_haskell_test", ) load("@os_info//:os_info.bzl", "is_windows") depends = [ "aeson", "async", "base", "binary", "bytestring", "containers", "data-default", "deepseq", "directory", "extra", "filepath", "hashable", "haskell-lsp", "haskell-lsp-types", "mtl", "network-uri", "prettyprinter", "prettyprinter-ansi-terminal", "rope-utf16-splay", "safe-exceptions", "sorted-list", "shake", "stm", "syb", "text", "time", "transformers", "unordered-containers", "utf8-string", ] + ([] if is_windows else ["unix"]) hidden = [ "Development.IDE.Core.Compile", "Development.IDE.GHC.Compat", "Development.IDE.GHC.CPP", "Development.IDE.GHC.Error", "Development.IDE.GHC.Orphans", "Development.IDE.GHC.Warnings", "Development.IDE.Import.FindImports", "Development.IDE.LSP.CodeAction", "Development.IDE.LSP.Definition", "Development.IDE.LSP.Hover", "Development.IDE.LSP.Notifications", "Development.IDE.Spans.AtPoint", "Development.IDE.Spans.Calculate", "Development.IDE.Spans.Documentation", "Development.IDE.Spans.Type", ] da_haskell_library( name = "hie-core", srcs = glob(["src/**/*.hs"]), hackage_deps = depends + [ "ghc-lib", "ghc-lib-parser", ], hidden_modules = hidden, src_strip_prefix = "src", visibility = ["//visibility:public"], deps = [] if is_windows else [":getmodtime"], ) # Used in getModificationTimeRule in Development.IDE.Core.FileStore cc_library( name = "getmodtime", srcs = glob(["cbits/getmodtime.c"]), copts = [ "-Wall", "-Werror", ], ) if not is_windows else None da_haskell_library( name = "hie-core-public", srcs = glob(["src/**/*.hs"]), compiler_flags = ["-DGHC_STABLE"], hackage_deps = depends + [ "ghc", "ghc-boot", "ghc-boot-th", ], hidden_modules = hidden, # Override the -hide-package flags defined in WORKSPACE # -hide-package=ghc-boot-th -hide-package=ghc-boot repl_ghci_args = [ "-package=ghc-boot", "-package=ghc-boot-th", ], src_strip_prefix = "src", visibility = ["//visibility:public"], deps = [] if is_windows else [":getmodtime"], ) da_haskell_binary( name = "hie-core-exe", srcs = glob(["exe/**/*.hs"]), hackage_deps = [ "base", "containers", "data-default", "directory", "extra", "filepath", "ghc-paths", "ghc", "haskell-lsp", "hie-bios", "optparse-applicative", "shake", "text", ], src_strip_prefix = "test", visibility = ["//visibility:public"], deps = [ "hie-core-public", ], )