cabal-version:      3.4
build-type:         Simple
category:           Development
name:               ghcide
version:            2.7.0.0
license:            Apache-2.0
license-file:       LICENSE
author:             Digital Asset and Ghcide contributors
maintainer:         Ghcide contributors
copyright:          Digital Asset and Ghcide contributors 2018-2020
synopsis:           The core of an IDE
description:        A library for building Haskell IDE's on top of the GHC API.
homepage:
  https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme

bug-reports:        https://github.com/haskell/haskell-language-server/issues
tested-with:        GHC ==9.8.2 || ==9.6.4 || ==9.4.8 || ==9.2.8
extra-source-files:
  CHANGELOG.md
  README.md
  test/data/**/*.cabal
  test/data/**/*.hs
  test/data/**/*.hs-boot
  test/data/**/*.project
  test/data/**/*.yaml

source-repository head
  type:     git
  location: https://github.com/haskell/haskell-language-server.git

flag ekg
  description:
    Enable EKG monitoring of the build graph and other metrics on port 8999

  default:     False
  manual:      True

flag pedantic
  description: Enable -Werror
  default:     False
  manual:      True

common warnings
  ghc-options:
    -Wall
    -Wincomplete-uni-patterns
    -Wunused-packages
    -Wno-name-shadowing
    -Wno-unticked-promoted-constructors
    -fno-ignore-asserts

library
  default-language:   GHC2021
  build-depends:
    , aeson
    , array
    , async
    , base                         >=4.16     && <5
    , base16-bytestring            >=0.1.1    && <1.1
    , binary
    , bytestring
    , case-insensitive
    , co-log-core
    , containers
    , cryptohash-sha1              >=0.11.100 && <0.12
    , data-default
    , deepseq
    , dependent-map
    , dependent-sum
    , Diff                         ^>=0.4.0
    , directory
    , dlist
    , enummapset
    , exceptions
    , extra                        >=1.7.14
    , filepath
    , fingertree
    , focus                        >=1.0.3.2
    , ghc                          >=9.2
    , ghc-boot
    , ghc-boot-th
    , ghc-check                    >=0.5.0.8
    , ghc-paths
    , ghc-trace-events
    , Glob
    , haddock-library              >=1.8      && <1.12
    , hashable
    , hie-bios                     ==0.13.1
    , hie-compat                   ^>=0.3.0.0
    , hiedb                        ^>= 0.6.0.0
    , hls-graph                    == 2.7.0.0
    , hls-plugin-api               == 2.7.0.0
    , implicit-hie                 >= 0.1.4.0 && < 0.1.5
    , lens
    , list-t
    , lsp                          ^>=2.4.0.0
    , lsp-types                    ^>=2.1.0.0
    , mtl
    , opentelemetry                >=0.6.1
    , optparse-applicative
    , parallel
    , prettyprinter                >=1.7
    , prettyprinter-ansi-terminal
    , random
    , regex-tdfa                   >=1.3.1.0
    , row-types
    , safe-exceptions
    , sorted-list
    , sqlite-simple
    , stm
    , stm-containers
    , syb
    , text
    , text-rope
    , time
    , transformers
    , unliftio                     >=0.2.6
    , unliftio-core
    , unordered-containers         >=0.2.10.0
    , vector

  if os(windows)
    build-depends: Win32

  else
    build-depends: unix

  default-extensions:
    DataKinds
    ExplicitNamespaces
    LambdaCase
    OverloadedStrings
    RecordWildCards
    ViewPatterns

  hs-source-dirs:     src session-loader
  exposed-modules:
    Control.Concurrent.Strict
    Development.IDE
    Development.IDE.Core.Actions
    Development.IDE.Core.Compile
    Development.IDE.Core.Debouncer
    Development.IDE.Core.FileStore
    Development.IDE.Core.FileUtils
    Development.IDE.Core.IdeConfiguration
    Development.IDE.Core.OfInterest
    Development.IDE.Core.PluginUtils
    Development.IDE.Core.PositionMapping
    Development.IDE.Core.Preprocessor
    Development.IDE.Core.ProgressReporting
    Development.IDE.Core.Rules
    Development.IDE.Core.RuleTypes
    Development.IDE.Core.Service
    Development.IDE.Core.Shake
    Development.IDE.Core.Tracing
    Development.IDE.Core.UseStale
    Development.IDE.GHC.Compat
    Development.IDE.GHC.Compat.Core
    Development.IDE.GHC.Compat.CmdLine
    Development.IDE.GHC.Compat.Env
    Development.IDE.GHC.Compat.Iface
    Development.IDE.GHC.Compat.Logger
    Development.IDE.GHC.Compat.Outputable
    Development.IDE.GHC.Compat.Parser
    Development.IDE.GHC.Compat.Plugins
    Development.IDE.GHC.Compat.Units
    Development.IDE.GHC.Compat.Util
    Development.IDE.GHC.CoreFile
    Development.IDE.GHC.Error
    Development.IDE.GHC.Orphans
    Development.IDE.GHC.Util
    Development.IDE.Import.DependencyInformation
    Development.IDE.Import.FindImports
    Development.IDE.LSP.HoverDefinition
    Development.IDE.LSP.LanguageServer
    Development.IDE.LSP.Notifications
    Development.IDE.LSP.Outline
    Development.IDE.LSP.Server
    Development.IDE.Main
    Development.IDE.Main.HeapStats
    Development.IDE.Monitoring.EKG
    Development.IDE.Monitoring.OpenTelemetry
    Development.IDE.Plugin
    Development.IDE.Plugin.Completions
    Development.IDE.Plugin.Completions.Types
    Development.IDE.Plugin.Completions.Logic
    Development.IDE.Plugin.HLS
    Development.IDE.Plugin.HLS.GhcIde
    Development.IDE.Plugin.Test
    Development.IDE.Plugin.TypeLenses
    Development.IDE.Session
    Development.IDE.Session.Diagnostics
    Development.IDE.Session.Implicit
    Development.IDE.Spans.AtPoint
    Development.IDE.Spans.Common
    Development.IDE.Spans.Documentation
    Development.IDE.Spans.LocalBindings
    Development.IDE.Spans.Pragmas
    Development.IDE.Types.Diagnostics
    Development.IDE.Types.Exports
    Development.IDE.Types.HscEnvEq
    Development.IDE.Types.KnownTargets
    Development.IDE.Types.Location
    Development.IDE.Types.Monitoring
    Development.IDE.Types.Options
    Development.IDE.Types.Shake
    Generics.SYB.GHC
    Text.Fuzzy.Parallel

  other-modules:
    Development.IDE.Core.FileExists
    Development.IDE.GHC.CPP
    Development.IDE.GHC.Warnings
    Development.IDE.Session.VersionCheck
    Development.IDE.Types.Action

  if flag(pedantic)
    ghc-options:
      -Werror

  if flag(ekg)
    build-depends:
      , ekg-core
      , ekg-wai

    cpp-options:   -DMONITORING_EKG

flag test-exe
  description: Build the ghcide-test-preprocessor executable
  default:     True

executable ghcide-test-preprocessor
  import: warnings
  default-language:   GHC2021
  hs-source-dirs:   test/preprocessor
  main-is:          Main.hs
  build-depends:    base >=4 && <5

  if !flag(test-exe)
    buildable: False

flag executable
  description: Build the ghcide executable
  default:     True

executable ghcide
  import: warnings
  default-language:   GHC2021
  hs-source-dirs:     exe
  ghc-options:        -threaded -rtsopts "-with-rtsopts=-I0 -A128M -T"


  -- allow user RTS overrides
  -- disable idle GC
  -- increase nursery size
  -- Enable collection of heap statistics
  main-is:            Main.hs
  build-depends:
    , base                  >=4.16 && <5
    , data-default
    , extra
    , ghcide
    , gitrev
    , hls-plugin-api
    , lsp
    , lsp-types
    , optparse-applicative

  other-modules:
    Arguments
    Paths_ghcide

  autogen-modules:    Paths_ghcide
  default-extensions:
    LambdaCase
    OverloadedStrings
    RecordWildCards
    ViewPatterns

  if !flag(executable)
    buildable: False

library ghcide-test-utils
  import: warnings
  visibility: public
  default-language:   GHC2021

  hs-source-dirs: test/src test/cabal 
  exposed-modules:
    Development.IDE.Test
    Development.IDE.Test.Runfiles
    Development.IDE.Test.Diagnostic

  build-depends:
      aeson,
      base > 4.9 && < 5,
      containers,
      data-default,
      directory,
      extra,
      filepath,
      ghcide,
      lsp-types,
      hls-plugin-api,
      lens,
      lsp-test ^>= 0.17,
      tasty-hunit >= 0.10,
      text,
      row-types,

  default-extensions:
      LambdaCase
      OverloadedStrings
      RecordWildCards
      ViewPatterns
  
test-suite ghcide-tests
  import: warnings
  type:               exitcode-stdio-1.0
  default-language:   GHC2021
  build-tool-depends:
    , ghcide:ghcide
    , ghcide:ghcide-test-preprocessor
    , implicit-hie:gen-hie

  build-depends:
    , aeson
    , async
    , base
    , containers
    , data-default
    , directory
    , enummapset
    , extra
    , filepath
    , fuzzy
    , ghcide
    , ghcide:ghcide-test-utils
    , hls-plugin-api
    , lens
    , list-t
    , lsp
    , lsp-test                ^>=0.17.0.0
    , lsp-types
    , monoid-subclasses
    , mtl
    , network-uri
    , QuickCheck
    , random
    , regex-tdfa              ^>=1.3.1
    , row-types
    , shake
    , sqlite-simple
    , stm
    , stm-containers
    , tasty
    , tasty-expected-failure
    , tasty-hunit             >=0.10
    , tasty-quickcheck
    , tasty-rerun
    , text
    , text-rope
    , unordered-containers

  if impl(ghc <9.3)
    build-depends: ghc-typelits-knownnat

  hs-source-dirs:     test/exe 
  ghc-options:        -threaded -O0

  main-is:            Main.hs
  other-modules:
    AsyncTests
    BootTests
    ClientSettingsTests
    CodeLensTests
    CompletionTests
    CPPTests
    CradleTests
    DependentFileTest
    DiagnosticTests
    ExceptionTests
    FindDefinitionAndHoverTests
    FuzzySearch
    GarbageCollectionTests
    HaddockTests
    HieDbRetry
    HighlightTests
    IfaceTests
    InitializeResponseTests
    LogType
    NonLspCommandLine
    OpenCloseTest
    OutlineTests
    PluginParsedResultTests
    PluginSimpleTests
    PositionMappingTests
    PreprocessorTests
    Progress
    ReferenceTests
    RootUriTests
    SafeTests
    SymlinkTests
    TestUtils
    THTests
    UnitTests
    WatchedFileTests

  -- Tests that have been pulled out of the main file
  default-extensions:
    LambdaCase
    OverloadedStrings
    RecordWildCards
    ViewPatterns