packages feed

glean-0.1.0.0: glean.cabal

cabal-version:       3.6

-- Copyright (c) Facebook, Inc. and its affiliates.

-- @generated from glean.cabal.in
-- DO NO EDIT THIS FILE DIRECTLY

name:                glean
version:             0.1.0.0
synopsis: A system for collecting, deriving and working with facts
          about source code.
homepage:            https://github.com/facebookincubator/Glean
bug-reports:         https://github.com/facebookincubator/Glean/issues
license:             BSD-3-Clause
license-file:        LICENSE
author:              Facebook, Inc.
maintainer:          Glean-team@fb.com
copyright:           (c) Facebook, All Rights Reserved
build-type:          Simple
extra-doc-files:     CHANGELOG.md, README.md


data-files:
    glean/schema/source/**/*.angle

common fb-haskell
    default-language: Haskell2010
    default-extensions:
        BangPatterns
        BinaryLiterals
        DataKinds
        DeriveDataTypeable
        DeriveGeneric
        EmptyCase
        ExistentialQuantification
        FlexibleContexts
        FlexibleInstances
        GADTs
        GeneralizedNewtypeDeriving
        LambdaCase
        MultiParamTypeClasses
        MultiWayIf
        NamedFieldPuns
        NoMonomorphismRestriction
        OverloadedStrings
        PatternSynonyms
        RankNTypes
        RecordWildCards
        ScopedTypeVariables
        StandaloneDeriving
        TupleSections
        TypeFamilies
        TypeSynonymInstances
        NondecreasingIndentation
        TypeOperators

    ghc-options: -Wall -Wno-orphans -Wno-name-shadowing
    if flag(opt)
       ghc-options: -O2

common fb-cpp
  cxx-options: -std=c++17 -Wno-nullability-completeness
  if !flag(clang)
     cxx-options: -fcoroutines
  if arch(x86_64)
     cxx-options: -march=haswell
  if flag(opt)
     cxx-options: -O3 -DNDEBUG
     cxx-options: -O3
  

common exe
  ghc-options: -threaded -rtsopts

common haskell-indexer
  if impl(ghc >= 9.2)
    buildable: True
  else
    buildable: False

flag clang
     default: False

flag opt
     default: False

flag benchmarks
     default: False

-- run tests that require clang
flag clang-tests
     default: True

-- run tests that require hhvm, typically Linux/x86_64
flag hack-tests
     default: True

-- run tests that require lsif-tsc
flag typescript-tests
     default: True

-- run tests that require python-scip
flag python-tests
     default: True

-- run tests that require dotnet-scip
flag dotnet-tests
     default: True

-- run tests that require lsif-go
flag go-tests
     default: False

-- run tests that require rust-analyzer
flag rust-tests
     default: True

-- run tests that require lsif-java
flag java-lsif-tests
     default: False

-- run tests that require flow
flag flow-tests
     default: True

-- use fbthrift as the the server/client transport, or HTTP?
flag fbthrift
     default: False

flag use-folly-clib
     default: False

common folly
    if flag(use-folly-clib)
        build-depends: fb-util >= 0.2, folly-clib > 0
    else
        build-depends: fb-util < 0.2
        pkgconfig-depends: libfolly

common deps
    build-depends:
        fb-util,
        thrift-lib,
        HUnit,
        safe,
        safe-exceptions,
        scientific,
        text-show,
        uuid,
        extra,
        aeson,
        data-default,
        temporary,
        clock,
        STMonadTrans,
        utf8-string,
        optparse-applicative,
        ansi-terminal,
        json,
        random,
        regex-base,
        regex-pcre,
        base >=4.11.1 && <4.19,
        array ^>=0.5.2.0,
        async ^>=2.2.1,
        attoparsec >=0.13.2.3 && <0.15,
        attoparsec-aeson >= 2.1 && < 2.3,
        unordered-containers ^>=0.2.9.0,
        containers,
        contravariant ^>=1.5,
        text >=1.2.3.0 && < 2.2,
        bytestring >=0.10.8.2 && <0.12,
        vector >=0.12.0.1 && <0.14,
        transformers >= 0.5.6 && < 0.7,
        network-uri ^>=2.6.1.0,
        stm ^>=2.5.0.0,
        directory ^>=1.3.1.5,
        filepath ^>=1.4.2,
        exceptions ^>=0.10.0,
        mtl >= 2.2.2 && < 2.4,
        unix >= 2.7.2.2 && < 2.9,
        process ^>=1.6.3.0,
        prettyprinter >=1.2.1 && <1.8,
        time >=1.8.0.2 && <1.13,
        binary ^>=0.8.5.1,
        deepseq ^>=1.4.3.0,
        hashable >=1.2.7.0 && <1.6,
        tar ^>=0.5.1.0,
        ghc-prim >=0.5.2.0 && <0.11,
        parsec ^>=3.1.13.0,
        haxl >= 2.1.2.0 && < 2.6,
        hinotify ^>= 0.4.1

common hsc2hs-cpp
    hsc2hs-options: --cc=g++ --lflag=-lstdc++ --cflag=-D__HSC2HS__=1 --cflag=-std=c++17

common thrift-server
    if flag(fbthrift)
       cpp-options: -DFBTHRIFT
       build-depends: thrift-server
    else
       build-depends: thrift-http

common thrift-client
    if flag(fbthrift)
       cpp-options: -DFBTHRIFT
       build-depends: thrift-cpp-channel
    else
       build-depends: thrift-http

library stubs
    import: fb-haskell, fb-cpp, deps, thrift-server
    visibility: public
    hs-source-dirs: glean/github
    exposed-modules:
        Facebook.Fb303
        Facebook.Service
        Glean.BuildInfo
        Glean.Datasource.Scribe.Write
        Glean.Init
        Glean.Server.PublishShards
        Glean.Index
        Glean.Username
        ServiceData.Types
        ServiceData.GlobalStats
        TestRunner
    build-depends:
        glean:if-fb303-hs,
        glean:if-glean-hs,
        glean:if-index-hs,
        mangle,
        template-haskell,
        tasty,
        tasty-hunit-adapter

library logger
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs: glean/github
    exposed-modules:
        Logger.IO
        Logger.GleanGlass
        Logger.GleanGlassErrors
    build-depends:
        glean:util

library config
    import: fb-haskell, fb-cpp, deps
    visibility: public
    include-dirs: .
    hs-source-dirs:
        glean/config/gen-hs2
        glean/config/server/gen-hs2
        glean/config/client/gen-hs2
    exposed-modules:
        Glean.Service.Types
        Glean.ClientConfig.Types
        Glean.ServerConfig.Types

library defaultconfigs
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs: glean/github
    exposed-modules:
        Glean.DefaultConfigs
    build-depends:
        glean:config,
        glean:util

library thrift-annotation
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs:
        thrift/annotation/gen-hs2
    exposed-modules:
        Facebook.Thrift.Annotation.Cpp.Cpp.Types
        Hack.Types
        Rust.Types
        Scope.Types
        Facebook.Thrift.Annotation.Thrift.Thrift.Types

library if-fb303-hs
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs:
        glean/github/if/gen-hs2
    exposed-modules:
        Fb303Core.Types
        Fb303Core.BaseService.Client
        Fb303Core.BaseService.Service
        Fb303.Types
        Fb303.FacebookService.Client
        Fb303.FacebookService.Service
    build-depends:
        glean:thrift-annotation,

library if-glean-hs
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs:
        glean/if/gen-hs2
    exposed-modules:
        Glean.Types
        Glean.GleanService.Client
        Glean.GleanService.Service
    build-depends:
        glean:thrift-annotation,
        glean:config,
        glean:if-fb303-hs

library if-index-hs
    import: fb-haskell, deps
    visibility: public
    hs-source-dirs:
        glean/if/index/gen-hs2
    exposed-modules:
        Glean.Index.Types
        Glean.Index.GleanIndexingService.Client
        Glean.Index.GleanIndexingService.Service
    build-depends:
        glean:if-glean-hs

library if-internal-hs
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs:
        glean/if/internal/gen-hs2
    exposed-modules:
        Glean.Internal.Types
    build-depends:
        glean:config,
        glean:if-glean-hs

library rts
    import: fb-haskell, fb-cpp, deps, folly
    visibility: public
    include-dirs: .
    cxx-sources:
        glean/rts/binary.cpp
        glean/rts/benchmarking/factblock.cpp
        glean/rts/benchmarking/ffi.cpp
        glean/rts/bytecode/subroutine.cpp
        glean/rts/cache.cpp
        glean/rts/define.cpp
        glean/rts/error.cpp
        glean/rts/fact.cpp
        glean/rts/factset.cpp
        glean/rts/ffi.cpp
        glean/rts/inventory.cpp
        glean/rts/json.cpp
        glean/rts/lookup.cpp
        glean/rts/nat.cpp
        glean/rts/ownership.cpp
        glean/rts/ownership/derived.cpp
        glean/rts/ownership/setu32.cpp
        glean/rts/ownership/slice.cpp
        glean/rts/ownership/uset.cpp
        glean/rts/prim.cpp
        glean/rts/query.cpp
        glean/rts/sanity.cpp
        glean/rts/set.cpp
        glean/rts/stats.cpp
        glean/rts/string.cpp
        glean/rts/substitution.cpp
        glean/rts/thrift.cpp
        glean/rts/timer.cpp
        glean/rts/validate.cpp
    cxx-options: -DOSS=1
    install-includes:
        glean/bytecode/evaluate.h
        glean/bytecode/instruction.h
        glean/rts/benchmarking/factblock.h
        glean/rts/benchmarking/ffi.h
        glean/rts/binary.h
        glean/rts/bytecode/subroutine.h
        glean/rts/bytecode/syscall.h
        glean/rts/cache.h
        glean/rts/define.h
        glean/rts/densemap.h
        glean/rts/error.h
        glean/rts/fact.h
        glean/rts/factset.h
        glean/rts/ffi.h
        glean/rts/id.h
        glean/rts/inventory.h
        glean/rts/json.h
        glean/rts/lookup.h
        glean/rts/nat.h
        glean/rts/ondemand.h
        glean/rts/ownership/derived.h
        glean/rts/ownership/fallbackavx.h
        glean/rts/ownership.h
        glean/rts/ownership/pool.h
        glean/rts/ownership/setu32.h
        glean/rts/ownership/slice.h
        glean/rts/ownership/triearray.h
        glean/rts/ownership/uset.h
        glean/rts/prim.h
        glean/rts/query.h
        glean/rts/sanity.h
        glean/rts/serialize.h
        glean/rts/set.h
        glean/rts/stacked.h
        glean/rts/stats.h
        glean/rts/store.h
        glean/rts/string.h
        glean/rts/substitution.h
        glean/rts/tests/arbitrary.h
        glean/rts/tests/uniform.h
        glean/rts/thrift.h
        glean/rts/timer.h
        glean/rts/validate.h
    -- __atomic_is_lock_free missing with clang
    extra-libraries: atomic
    pkgconfig-depends: libunwind, libglog, icu-uc, gflags, libxxhash

library rocksdb
    import: fb-haskell, fb-cpp, deps, folly
    visibility: private
    cxx-sources:
        glean/rocksdb/container-impl.cpp
        glean/rocksdb/database-impl.cpp
        glean/rocksdb/ownership.cpp
        glean/rocksdb/ffi.cpp
        glean/rocksdb/rocksdb.cpp
    cxx-options: -fno-rtti -DOSS=1
    include-dirs: .
    install-includes:
        glean/rocksdb/container-impl.h
        glean/rocksdb/database-impl.h
        glean/rocksdb/ffi.h
        glean/rocksdb/rocksdb.h
        glean/rocksdb/util.h
    pkgconfig-depends: rocksdb, fmt
    build-depends:
        glean:rocksdb-stats,
        glean:rts,

-- This needs to be separate from rocksdb because it can't be compiled with -fno-rtti
library rocksdb-stats
    import: fb-haskell, fb-cpp, deps, folly
    visibility: private
    cxx-sources:
        glean/rocksdb/stats.cpp
    include-dirs: .
    install-includes:
        glean/rocksdb/stats.h
    build-depends:
        glean:rts,

library util
    import: fb-haskell, fb-cpp, deps, thrift-client
    visibility: public
    hs-source-dirs: glean/util
    exposed-modules:
        Glean.Impl.ThriftService
        Glean.Impl.ConfigProvider
        Glean.Impl.TestConfigProvider
        Glean.Util.Bisect
        Glean.Util.ConfigProvider
        Glean.Util.Disk
        Glean.Util.IO
        Glean.Util.Metric
        Glean.Util.Mutex
        Glean.Util.Observed
        Glean.Util.Periodic
        Glean.Util.Process
        Glean.Util.RetryRecvTimeout
        Glean.Util.RetryChannelException
        Glean.Util.Service
        Glean.Util.ShardManager
        Glean.Util.Some
        Glean.Util.ThriftService
        Glean.Util.ThriftSource
        Glean.Util.Throttle
        Glean.Util.TransitiveClosure
        Glean.Util.Trace
        Glean.Util.ValueBuffer
        Glean.Util.Vector
        Glean.Util.Warden
    build-depends:
        glean:stubs,
        glean:config,
        glean:if-glean-hs,
        primitive,
        network

library core
    import: fb-haskell, fb-cpp, deps, hsc2hs-cpp
    visibility: public
    hs-source-dirs: glean/hs
    default-extensions: CPP
    hsc2hs-options: --cflag=-DOSS=1

    exposed-modules:
        Glean.FFI

        Glean.RTS
        Glean.RTS.Builder
        Glean.RTS.Bytecode.Code
        Glean.RTS.Bytecode.Disassemble
        Glean.RTS.Bytecode.Supply
        Glean.RTS.Constants
        Glean.RTS.Foreign.Benchmarking
        Glean.RTS.Foreign.Bytecode
        Glean.RTS.Foreign.Define
        Glean.RTS.Foreign.FactSet
        Glean.RTS.Foreign.Inventory
        Glean.RTS.Foreign.JSON
        Glean.RTS.Foreign.LookupCache
        Glean.RTS.Foreign.Lookup
        Glean.RTS.Foreign.Ownership
        Glean.RTS.Foreign.Query
        Glean.RTS.Foreign.Stacked
        Glean.RTS.Foreign.Stats
        Glean.RTS.Foreign.Subst
        Glean.RTS.Foreign.Thrift
        Glean.RTS.Foreign.Typecheck
        Glean.RTS.Set
        Glean.RTS.Term
        Glean.RTS.Traverse
        Glean.RTS.Typecheck
        Glean.RTS.Types

        -- generated by bytecode-gen-hs
        Glean.RTS.Bytecode.Gen.Instruction
        Glean.RTS.Bytecode.Gen.Issue
        Glean.RTS.Bytecode.Gen.Version

        Glean.Typed
        Glean.Typed.Binary
        Glean.Typed.Build
        Glean.Typed.BuildFact
        Glean.Typed.Fact
        Glean.Typed.Id
        Glean.Typed.Predicate
        Glean.Typed.Prim

        Glean.Query.Thrift
        Glean.Query.Thrift.Internal

        Glean.Write.Async
        Glean.Write.Options
        Glean.Write.SendBatch
        Glean.Write.SendQueue
        Glean.Write.SendAndRebaseQueue
        Glean.Write.Stats

        Glean.Angle.Hash
        Glean.Angle.Lexer
        Glean.Angle.Parser
        Glean.Angle.Types
        Glean.Display
        Glean.Query.Angle
        Glean.Repo.Text
        Glean.Schema.Resolve
        Glean.Schema.Evolve
        Glean.Schema.Types
        Glean.Schema.Util

        Glean.Backend.Types
        Glean.Backend.Retry

    build-tool-depends: alex:alex, happy:happy
    build-depends:
        glean:bytecode,
        glean:config,
        glean:defaultconfigs,
        glean:util,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:rts,
        glean:stubs,
        glean:rocksdb,

library db
    import: fb-haskell, fb-cpp, deps, hsc2hs-cpp
    visibility: public
    hs-source-dirs: glean/db
    default-extensions: CPP
    cpp-options: -DOSS=1

    exposed-modules:
        Glean.Database.Backup
        Glean.Database.Backup.Backend
        Glean.Database.Backup.Locator
        Glean.Database.Backup.Mock
        Glean.Database.BatchLocation
        Glean.Database.Catalog.Filter
        Glean.Database.Catalog
        Glean.Database.Catalog.Local.Files
        Glean.Database.Catalog.Local.Memory
        Glean.Database.Catalog.Store
        Glean.Database.CompletePredicates
        Glean.Database.Config
        Glean.Database.Data
        Glean.Database.Env
        Glean.Database.Exception
        Glean.Database.Open
        Glean.Database.Close
        Glean.Database.Restore
        Glean.Database.Delete
        Glean.Database.Create
        Glean.Database.Finish
        Glean.Database.List
        Glean.Database.Janitor
        Glean.Database.Logger
        Glean.Database.Meta
        Glean.Database.Ownership
        Glean.Database.PredicateStats
        Glean.Database.Repo
        Glean.Database.Retention
        Glean.Database.Schema
        Glean.Database.Schema.ComputeIds
        Glean.Database.Schema.Types
        Glean.Database.Storage
        Glean.Database.Storage.Memory
        Glean.Database.Storage.RocksDB
        Glean.Database.Trace
        Glean.Database.Types
        Glean.Database.Validate
        Glean.Database.Writes
        Glean.Database.Write.Batch
        Glean.Logger.Database
        Glean.Logger.Server
        Glean.Write.JSON
        Glean.Query.BindOrder
        Glean.Query.Codegen
        Glean.Query.Codegen.QueryRegs
        Glean.Query.Codegen.Types
        Glean.Query.Transform
        Glean.Query.Expand
        Glean.Query.Flatten
        Glean.Query.Flatten.Types
        Glean.Query.Opt
        Glean.Query.Prune
        Glean.Query.Reorder
        Glean.Query.Typecheck
        Glean.Query.Typecheck.Monad
        Glean.Query.Typecheck.Types
        Glean.Query.Typecheck.Unify
        Glean.Query.Vars

        Glean.Query.JSON

        Glean.Query.Derive
        Glean.Query.UserQuery
        Glean.Query.Incremental

        Glean.Backend.Local
        Glean.Backend.Logging
        Glean.Dump
        Glean.Logger

    other-modules:
        Paths_glean
    autogen-modules:
        Paths_glean

    build-depends:
        split,
        glean:bytecode,
        glean:config,
        glean:core,
        glean:defaultconfigs,
        glean:haxl-datasource,
        glean:util,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:rts,
        glean:stubs,
        glean:rocksdb,

library client-hs
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs: glean/client/hs
    cxx-sources:
        glean/client/hs/cpp/write.cpp
    exposed-modules:
          Glean
          Glean.Angle
          Glean.Write
          Glean.Haxl
          Glean.Remote
          Glean.Repo
          Glean.Haxl.Repos
          Glean.Util.ShellPrint
    build-depends:
        pretty,
        aeson-pretty,
        mangle,
        glean:if-glean-hs,
        glean:util,
        glean:core,
        glean:config,
        glean:defaultconfigs,
        glean:haxl-datasource,
        glean:stubs,
        prettyprinter-ansi-terminal,
        thrift-haxl,
        process-extras

library client-hs-local
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs: glean/client/hs/local
    exposed-modules:
        Glean.LocalOrRemote
    build-depends:
        glean:if-glean-hs,
        glean:core,
        glean:client-hs,
        glean:db,
        glean:defaultconfigs,
        glean:util,

-- things needed by glean-clang
library client-cpp
    import: fb-haskell, fb-cpp, deps, folly
    visibility: public
    cxx-sources:
        glean/cpp/filewriter.cpp
        glean/cpp/glean.cpp
        glean/interprocess/cpp/worklist.cpp
        glean/interprocess/cpp/counters.cpp
    cxx-options: -DOSS=1
    include-dirs: .
    install-includes:
        glean/cpp/filewriter.h
        glean/cpp/sender.h
        glean/cpp/glean.h
        glean/interprocess/cpp/counters.h
        glean/interprocess/cpp/counters_ffi.h
        glean/interprocess/cpp/worklist.h
        glean/interprocess/cpp/worklist_ffi.h
    build-depends:
        glean:rts

library interprocess
    import: fb-haskell, deps
    visibility: public
    hs-source-dirs: glean/interprocess/hs
    exposed-modules:
        Glean.Interprocess.Counters
        Glean.Interprocess.Worklist
    build-depends:
        glean:client-cpp

library schema
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs:
        glean/schema/hs
        glean/schema/thrift/gen-hs2
    exposed-modules:
        Glean.Schema.Anglelang
        Glean.Schema.Buck
        Glean.Schema.Builtin
        Glean.Schema.Code
        Glean.Schema.CodeAnglelang
        Glean.Schema.CodeCsharp
        Glean.Schema.CodeCxx
        Glean.Schema.CodeDataswarm
        Glean.Schema.CodeErlang
        Glean.Schema.CodeGraphql
        Glean.Schema.CodeHack
        Glean.Schema.CodeHs
        Glean.Schema.CodeJava
        Glean.Schema.CodeKotlin
        Glean.Schema.CodeLsif
        Glean.Schema.Codemarkup
        Glean.Schema.CodemarkupAnglelang
        Glean.Schema.CodemarkupBuck
        Glean.Schema.CodemarkupCsharp
        Glean.Schema.CodemarkupCxx
        Glean.Schema.CodemarkupDataswarm
        Glean.Schema.CodemarkupErlang
        Glean.Schema.CodemarkupFlow
        Glean.Schema.CodemarkupGraphql
        Glean.Schema.CodemarkupHack
        Glean.Schema.CodemarkupHaskell
        Glean.Schema.CodemarkupLsif
        Glean.Schema.CodemarkupPp
        Glean.Schema.CodemarkupPython
        Glean.Schema.CodemarkupScip
        Glean.Schema.CodemarkupSearch
        Glean.Schema.CodemarkupTypes
        Glean.Schema.CodePp
        Glean.Schema.CodePython
        Glean.Schema.CodeBuck
        Glean.Schema.Csharp
        Glean.Schema.Cxx1
        Glean.Schema.Digest
        Glean.Schema.Dataswarm
        Glean.Schema.Glass
        Glean.Schema.Erlang
        Glean.Schema.Flow
        Glean.Schema.GleanTest
        Glean.Schema.Graphql
        Glean.Schema.Hack
        Glean.Schema.Hs
        Glean.Schema.JavakotlinAlpha
        Glean.Schema.KotlinAlpha
        Glean.Schema.Lsif
        Glean.Schema.Pp1
        Glean.Schema.Python
        Glean.Schema.SearchAnglelang
        Glean.Schema.SearchBuck
        Glean.Schema.SearchCode
        Glean.Schema.SearchCxx
        Glean.Schema.SearchErlang
        Glean.Schema.SearchHack
        Glean.Schema.SearchHs
        Glean.Schema.SearchPp
        Glean.Schema.Src
        Glean.Schema.Sys
        Glean.Schema.Anglelang.Types
        Glean.Schema.Buck.Types
        Glean.Schema.Builtin.Types
        Glean.Schema.CodeAnglelang.Types
        Glean.Schema.CodeBuck.Types
        Glean.Schema.CodeCsharp.Types
        Glean.Schema.CodeCxx.Types
        Glean.Schema.CodeDataswarm.Types
        Glean.Schema.CodeErlang.Types
        Glean.Schema.CodeFlow.Types
        Glean.Schema.CodeGraphql.Types
        Glean.Schema.CodeHack.Types
        Glean.Schema.CodeHs.Types
        Glean.Schema.CodeJava.Types
        Glean.Schema.CodeKotlin.Types
        Glean.Schema.CodeLsif.Types
        Glean.Schema.CodemarkupAnglelang.Types
        Glean.Schema.CodemarkupBuck.Types
        Glean.Schema.CodemarkupCsharp.Types
        Glean.Schema.CodemarkupCxx.Types
        Glean.Schema.CodemarkupDataswarm.Types
        Glean.Schema.CodemarkupErlang.Types
        Glean.Schema.CodemarkupFlow.Types
        Glean.Schema.CodemarkupGraphql.Types
        Glean.Schema.CodemarkupHack.Types
        Glean.Schema.CodemarkupHaskell.Types
        Glean.Schema.CodemarkupLsif.Types
        Glean.Schema.CodemarkupPp.Types
        Glean.Schema.CodemarkupPython.Types
        Glean.Schema.CodemarkupScip.Types
        Glean.Schema.CodemarkupSearch.Types
        Glean.Schema.Codemarkup.Types
        Glean.Schema.CodemarkupTypes.Types
        Glean.Schema.CodePp.Types
        Glean.Schema.CodePython.Types
        Glean.Schema.CodeScip.Types
        Glean.Schema.CodeFbthrift.Types
        Glean.Schema.Code.Types
        Glean.Schema.Csharp.Types
        Glean.Schema.Cxx1.Types
        Glean.Schema.Dataswarm.Types
        Glean.Schema.Digest.Types
        Glean.Schema.Erlang.Types
        Glean.Schema.Flow.Types
        Glean.Schema.Glass.Types
        Glean.Schema.GleanTest.Types
        Glean.Schema.Graphql.Types
        Glean.Schema.Hack.Types
        Glean.Schema.Hs.Types
        Glean.Schema.JavaAlpha.Types
        Glean.Schema.JavakotlinAlpha.Types
        Glean.Schema.KotlinAlpha.Types
        Glean.Schema.Lsif.Types
        Glean.Schema.LsifTypes.Types
        Glean.Schema.Scip.Types
        Glean.Schema.Pp1.Types
        Glean.Schema.Python.Types
        Glean.Schema.SearchAnglelang.Types
        Glean.Schema.SearchBuck.Types
        Glean.Schema.SearchCode.Types
        Glean.Schema.SearchCxx.Types
        Glean.Schema.SearchErlang.Types
        Glean.Schema.SearchHack.Types
        Glean.Schema.SearchHs.Types
        Glean.Schema.SearchPp.Types
        Glean.Schema.Src.Types
        Glean.Schema.SymbolidCxx.Types
        Glean.Schema.SymbolidJava.Types
        Glean.Schema.SymbolidKotlin.Types
        Glean.Schema.Sys.Types
        Glean.Schema.Fbthrift.Types
    build-depends:
        glean:if-glean-hs,
        glean:config,
        glean:core,
        glean:thrift-annotation

-- library clang-test-xref
--     import: fb-haskell, fb-cpp, deps
--     visibility: public
--     hs-source-dirs: lang/clang
--     exposed-modules:
--         Glean.Clang.Test.XRef

library haxl-datasource
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/haxl
    exposed-modules:
        Haxl.DataSource.Glean
        Haxl.DataSource.Glean.Common
    build-depends:
        glean:config,
        glean:core,
        glean:if-glean-hs,
        glean:util,
        thrift-haxl

executable gen-schema
    import: fb-haskell, fb-cpp, deps, exe
    scope: private
    main-is: Glean/Schema/Gen/Main.hs
    hs-source-dirs: glean/schema/gen
    ghc-options: -main-is Glean.Schema.Gen.Main
    other-modules:
        Glean.Schema.Gen.HackJson,
        Glean.Schema.Gen.Utils,
        Glean.Schema.Gen.Cpp,
        Glean.Schema.Gen.Haskell,
        Glean.Schema.Gen.OCaml,
        Glean.Schema.Gen.Python,
        Glean.Schema.Gen.Rust,
        Glean.Schema.Gen.Thrift
    build-depends:
        glean:core,
        glean:db,
        glean:config,
        glean:if-glean-hs,
        glean:if-internal-hs,
        aeson-pretty,
        fuzzy

library bytecode-instruction
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs: glean/bytecode/def
    exposed-modules:
        Glean.Bytecode.Generate.Instruction
    build-depends:
        glean:bytecode

library bytecode
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs: glean/bytecode
    exposed-modules:
        Glean.Bytecode.Types
        Glean.Bytecode.Decode
        Glean.Bytecode.SysCalls

executable gen-bytecode-cpp
    import: fb-haskell, fb-cpp, deps, exe
    scope: private
    main-is: Glean/Bytecode/Generate/Cpp.hs
    hs-source-dirs: glean/bytecode/gen
    ghc-options: -main-is Glean.Bytecode.Generate.Cpp
    build-depends:
        glean:bytecode,
        glean:bytecode-instruction

executable gen-bytecode-hs
    import: fb-haskell, fb-cpp, deps, exe
    scope: private
    main-is: Glean/Bytecode/Generate/Haskell.hs
    hs-source-dirs: glean/bytecode/gen
    ghc-options: -main-is Glean.Bytecode.Generate.Haskell
    build-depends:
        glean:bytecode,
        glean:bytecode-instruction

library lib-derive
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs: glean/lib
    exposed-modules:
        Glean.Derive
    build-depends:
        glean:client-hs,
        glean:if-glean-hs

library lib
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs: glean/lib
    exposed-modules:
        Glean.Util.CxxXRef
        Glean.Util.Declarations
        Glean.Util.Range
        Glean.Util.ToAngle
        Glean.Util.XRefs
        Glean.Util.Same
        Glean.Util.ShowSchemaId
        Glean.Write.SimpleAsync
        Glean.Util.PredMap
        Glean.Util.PredSet
    build-depends:
        glean:client-hs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:schema,
        glean:util,
        split

executable disassemble
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/tools/disassemble
    main-is: Disassemble.hs
    ghc-options: -main-is Disassemble
    extra-libraries: stdc++
    build-depends:
        glean:bytecode,
        glean:db,
        glean:core,
        glean:if-glean-hs,
        glean:lib,
        glean:util,

library test-unit
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/test/unit
    exposed-modules:
        Glean.Test.HUnit
        Glean.Test.Mock

-- Stub for regression tests
library handler
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/server
    exposed-modules:
        Glean.Handler
    build-depends:
        glean:client-hs,
        glean:if-fb303-hs,
        glean:if-glean-hs,
        glean:stubs,
        glean:db,
        glean:config,

executable glean-server
    import: fb-haskell, fb-cpp, deps, exe, thrift-server
    hs-source-dirs: glean/server
    main-is: Glean/Server.hs
    ghc-options: -main-is Glean.Server
    default-extensions: CPP
    other-modules:
        Glean.Handler
        Glean.Server.Config
        Glean.Server.Sharding
    extra-libraries: stdc++
    build-depends:
        glean:client-hs,
        glean:if-fb303-hs,
        glean:if-glean-hs,
        glean:if-index-hs,
        glean:stubs,
        glean:config,
        glean:core,
        glean:db,
        glean:util,
        haskeline >=0.7.3 && <0.9,
        json

library shell-lib
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/shell
    exposed-modules:
        Glean.Shell
        Glean.Shell.Error
        Glean.Shell.Index
        Glean.Shell.Terminal
        Glean.Shell.Types
    default-extensions: CPP
    extra-libraries: stdc++
    build-depends:
        glean:cli-types,
        glean:if-glean-hs,
        glean:stubs,
        glean:config,
        glean:core,
        glean:db,
        glean:client-hs,
        glean:client-hs-local,
        glean:indexers,
        glean:util,
        glean:lsif,
        haskeline >=0.7.3 && <0.9,
        json,
        monad-control,
        prettyprinter-ansi-terminal,
        split

library indexers
    import: fb-haskell, fb-cpp, deps, thrift-server
    hs-source-dirs:
        glean/lang/clang
        glean/lang/flow
        glean/lang/go
        glean/lang/hack
        glean/lang/haskell
        glean/lang/java-lsif
        glean/lang/lsif/indexer
        glean/lang/scip/indexer
        glean/lang/swift
        glean/lang/python-scip
        glean/lang/dotnet-scip
        glean/lang/rust-lsif
        glean/lang/rust-scip
        glean/lang/typescript
        glean/index
        glean/index/list
    exposed-modules:
        Glean.Indexer
        Glean.Indexer.Cpp
        Glean.Indexer.External
        Glean.Indexer.Flow
        Glean.Indexer.Go
        Glean.Indexer.Hack
        Glean.Indexer.Haskell
        Glean.Indexer.JavaLsif
        Glean.Indexer.LSIF
        Glean.Indexer.SCIP
        Glean.Indexer.Swift
        Glean.Indexer.RustLsif
        Glean.Indexer.RustScip
        Glean.Indexer.Typescript
        Glean.Indexer.PythonScip
        Glean.Indexer.DotnetScip
        Glean.Indexer.List
    build-depends:
        glean:client-hs,
        glean:client-hs-local,
        glean:db,
        glean:handler,
        glean:interprocess,
        glean:lib-derive,
        glean:lsif,
        glean:scip,
        glean:stubs,
        glean:util

library cli-types
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/tools/gleancli/plugin
    exposed-modules:
        GleanCLI.Types
        GleanCLI.Utils
    build-depends:
        glean:client-hs-local,
        glean:config,
        glean:db,
        glean:util,

executable glean
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/tools/gleancli
    main-is: GleanCLI.hs
    other-modules:
        GleanCLI.Backup
        GleanCLI.Common
        GleanCLI.Complete
        GleanCLI.Derive
        GleanCLI.Finish
        GleanCLI.Merge
        GleanCLI.Index
        GleanCLI.Query
        GleanCLI.Restore
        GleanCLI.Write
    ghc-options: -main-is GleanCLI -with-rtsopts=-I0
    extra-libraries: stdc++
    build-depends:
        glean:cli-types,
        glean:client-hs,
        glean:client-hs-local,
        glean:db,
        glean:if-glean-hs,
        glean:indexers,
        glean:shell-lib,
        glean:stubs,
        glean:config,
        glean:core,
        glean:lib-derive,
        glean:util,
        json,
        split,
        Glob,

executable glean-hyperlink
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/demo
    main-is: Hyperlink.hs
    ghc-options: -main-is Hyperlink
    extra-libraries: stdc++
    build-depends:
        glean:lib,
        glean:schema,
        glean:util,
        glean:client-hs,
        http-types,
        wai,
        warp

library hack-derive-lib
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/lang/hack
    exposed-modules:
        Derive.All
        Derive.Env
        Derive.HackDeclarationTarget
        Derive.Types
        Glean.Indexer.HackWithDeriver
    other-modules:
        Glean.Indexer.Hack
    build-depends:
        glean:client-hs,
        glean:core,
        glean:if-glean-hs,
        glean:indexers,
        glean:lib,
        glean:lib-derive,
        glean:schema,
        glean:util,
        IntervalMap,

-- external hack deriver
-- n.b in subdir to avoid recompilation of hack-derive-lib
executable hack-derive
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/lang/hack/deriver
    main-is: Derive.hs
    ghc-options: -main-is Derive
    build-depends:
        aeson-pretty,
        glean:client-hs,
        glean:hack-derive-lib,
        glean:schema,
        glean:stubs,
        glean:util,

-- Haskell indexer via hie
executable hie-indexer
    import: deps, fb-haskell, exe, haskell-indexer
    hs-source-dirs: glean/lang/haskell
    main-is: HieIndexer/Main.hs
    other-modules:
        HieIndexer.Index
        HieIndexer.Options
    ghc-options: -main-is HieIndexer.Main
    build-depends:
        ghc,
        glean:client-hs,
        glean:client-hs-local,
        glean:core,
        glean:lib,
        glean:schema,
        glean:stubs,
        glean:util,
        hie-compat < 0.3.1.2,
        hiedb >= 0.6 && < 0.7

-- -----------------------------------------------------------------------------
-- LSIF support

library lsif
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/lang/lsif
    exposed-modules:
        Data.LSIF.Angle
        Data.LSIF.Env
        Data.LSIF.Gen
        Data.LSIF.JSON
        Data.LSIF.Moniker
        Data.LSIF.Types
        Glean.LSIF.Driver
    build-depends:
        aeson,
        split,

library scip
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/lang/scip
    exposed-modules:
        Data.SCIP.Angle
        Glean.SCIP.Driver
    build-depends:
        glean:if-proto-scip-hs,
        glean:lsif,
        microlens,
        proto-lens,

-- SCIP support.
--
-- Haskell bindings and spec https://github.com/sourcegraph/scip
--
library if-proto-scip-hs
    import: fb-haskell, deps
    exposed-modules:
        Proto.Scip,
        Proto.Scip_Fields
    hs-source-dirs: glean/lang/scip/proto
    build-depends: proto-lens-runtime

-- -----------------------------------------------------------------------------
-- Glass services

-- Glass thrift service definition
library if-glass-hs
    import: fb-haskell, fb-cpp, deps
    visibility: public
    hs-source-dirs:
        glean/glass/if/glass/gen-hs2
    exposed-modules:
        Glean.Glass.Types
        Glean.Glass.GlassService.Client
        Glean.Glass.GlassService.Service
    build-depends:
        glean:config,
        glean:if-fb303-hs,
        glean:if-index-hs,
        glean:thrift-annotation,

-- Glass core library
library glass-lib
    import: fb-haskell, fb-cpp, deps, thrift-server
    visibility: public
    default-extensions: CPP
    hs-source-dirs: glean/glass
    exposed-modules:
        Glean.Glass.Annotations
        Glean.Glass.Attributes
        Glean.Glass.Attributes.Class
        Glean.Glass.Attributes.SymbolKind
        Glean.Glass.Base
        Glean.Glass.Comments
        Glean.Glass.Config
        Glean.Glass.Describe
        Glean.Glass.Digest
        Glean.Glass.Env
        Glean.Glass.Handler.Symbols
        Glean.Glass.Handler.Documents
        Glean.Glass.Handler.Cxx
        Glean.Glass.Handler.Utils
        Glean.Glass.Logging
        Glean.Glass.Main
        Glean.Glass.NameSearch
        Glean.Glass.Neighborhood
        Glean.Glass.Options
        Glean.Glass.Path
        Glean.Glass.Pretty.Angle
        Glean.Glass.Pretty.Cxx
        Glean.Glass.Pretty.Flow
        Glean.Glass.Pretty.Fbthrift
        Glean.Glass.Pretty.Hack
        Glean.Glass.Pretty.Haskell
        Glean.Glass.Pretty.Java
        Glean.Glass.Pretty.LSIF
        Glean.Glass.Pretty.Python
        Glean.Glass.Pretty.SCIP
        Glean.Glass.Query
        Glean.Glass.Query.Cxx
        Glean.Glass.Range
        Glean.Glass.RepoMapping
        Glean.Glass.Repos
        Glean.Glass.Search
        Glean.Glass.Search.Angle
        Glean.Glass.Search.Buck
        Glean.Glass.Search.Class
        Glean.Glass.Search.Cxx
        Glean.Glass.Search.Erlang
        Glean.Glass.Search.Flow
        Glean.Glass.Search.GraphQL
        Glean.Glass.Search.Hack
        Glean.Glass.Search.Haskell
        Glean.Glass.Search.Java
        Glean.Glass.Search.Kotlin
        Glean.Glass.Search.LSIF
        Glean.Glass.Search.Pp
        Glean.Glass.Search.Python
        Glean.Glass.SearchRelated
        Glean.Glass.Search.SCIP
        Glean.Glass.Search.Thrift
        Glean.Glass.SnapshotBackend
        Glean.Glass.SourceControl
        Glean.Glass.SymbolId
        Glean.Glass.SymbolId.Angle
        Glean.Glass.SymbolId.Buck
        Glean.Glass.SymbolId.Class
        Glean.Glass.SymbolId.CSharp
        Glean.Glass.SymbolId.Cxx
        Glean.Glass.SymbolId.Cxx.Parse
        Glean.Glass.SymbolId.Erlang
        Glean.Glass.SymbolId.Flow
        Glean.Glass.SymbolId.GraphQL
        Glean.Glass.SymbolId.Hack
        Glean.Glass.SymbolId.SCIP
        Glean.Glass.SymbolId.Java
        Glean.Glass.SymbolId.Hs
        Glean.Glass.SymbolId.LSIF
        Glean.Glass.SymbolId.Pp
        Glean.Glass.SymbolId.Python
        Glean.Glass.SymbolId.Fbthrift
        Glean.Glass.SymbolKind
        Glean.Glass.SymbolMap
        Glean.Glass.SymbolSig
        Glean.Glass.Tracer
        Glean.Glass.Tracing
        Glean.Glass.Utils
        Glean.Glass.Visibility
        Glean.Glass.XRefs
    build-depends:
        glean:client-hs,
        glean:client-hs-local,
        glean:core,
        glean:haxl-datasource,
        glean:if-glass-hs,
        glean:if-index-hs,
        glean:lib,
        glean:logger,
        glean:schema,
        glean:stubs,
        glean:util,
        uri-encode,
        SHA,
        split,
        ghc

executable glass-server
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/glass/server
    main-is: Server.hs
    ghc-options: -main-is Server -threaded
    extra-libraries: stdc++
    build-depends:
        glean:glass-lib,

executable glass-symbol
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/glass/tools/
    main-is: Glean/Glass/Test/Symbol.hs
    ghc-options: -main-is Glean.Glass.Test.Symbol
    extra-libraries: stdc++
    default-extensions: CPP
    build-depends:
        glean:glass-lib,
        glean:if-glass-hs,
        glean:stubs,

-- Minimal glass client showing how to wire things up
executable glass-democlient
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/glass/tools/
    main-is: Glean/Glass/Test/DemoClient.hs
    ghc-options: -main-is Glean.Glass.Test.DemoClient
    extra-libraries: stdc++
    build-depends:
        glean:if-glass-hs,
        glean:stubs,
        glean:util,

-- -----------------------------------------------------------------------------
-- Benchmarks

library bench-util
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/bench/lib
    exposed-modules:
        Glean.Util.Benchmark
    build-depends:
        glean:stubs,
        criterion < 1.7

executable query-bench
    import: fb-haskell, fb-cpp, deps, exe
    if !flag(benchmarks)
       buildable: False
    hs-source-dirs: glean/bench
    main-is: QueryBench.hs
    other-modules: BenchDB
    ghc-options: -main-is QueryBench
    build-depends:
        glean:bench-util,
        glean:client-hs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:schema,
        glean:test-lib,
        glean:util,
        criterion < 1.7

executable rename-bench
    import: fb-haskell, fb-cpp, deps, exe
    if !flag(benchmarks)
       buildable: False
    hs-source-dirs: glean/bench
    main-is: RenameBench.hs
    ghc-options: -main-is RenameBench
    build-depends:
        glean:bench-util,
        glean:core,
        glean:db,
        glean:schema,
        glean:test-lib,
        glean:util,
        criterion < 1.7

executable makefact-bench
    import: fb-haskell, deps, exe
    if !flag(benchmarks)
       buildable: False
    hs-source-dirs: glean/bench
    main-is: MakeFactBench.hs
    ghc-options: -main-is MakeFactBench
    build-depends:
        glean:bench-util,
        glean:client-hs,
        glean:core,
        glean:schema,
        glean:test-lib,
        criterion < 1.7

executable compile-bench
    import: fb-haskell, fb-cpp, deps, exe
    if !flag(benchmarks)
       buildable: False
    hs-source-dirs: glean/bench
    main-is: CompileBench.hs
    ghc-options: -main-is CompileBench
    build-depends:
        glean:client-hs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:schema,
        glean:test-lib,
        glean:util,
        criterion < 1.7,
        criterion-measurement,
        statistics,
        vector-algorithms

executable factset-bench
    import: fb-haskell, deps, exe
    if !flag(benchmarks)
       buildable: False
    hs-source-dirs: glean/bench
    main-is: FactSetBench.hs
    ghc-options: -main-is FactSetBench
    build-depends:
        glean:bench-util,
        glean:client-hs,
        glean:client-hs-local,
        glean:core,
        glean:db,
        glean:schema,
        glean:test-lib,
        glean:util

-- -----------------------------------------------------------------------------
-- Tests

library test-lib
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs: glean/test/lib
    exposed-modules:
        TestBatch
        TestDB
        TestData
        Glean.Database.Catalog.Test
        Glean.Database.Test
    build-depends:
        glean:core,
        glean:db,
        glean:schema,
        glean:config,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:stubs,
        glean:test-unit,
        glean:util

-- snapshot and other regression tests against glean
library regression-test-lib
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs:
        glean/test/regression
    exposed-modules:
        Glean.Regression.Config
        Glean.Regression.Driver.External
        Glean.Regression.Indexer
        Glean.Regression.Snapshot
        Glean.Regression.Snapshot.Driver
        Glean.Regression.Snapshot.Options
        Glean.Regression.Snapshot.Query
        Glean.Regression.Snapshot.Result
        Glean.Regression.Snapshot.Transform
        Glean.Regression.Test
    cpp-options: -DOSS=1
    build-depends:
        glean:client-hs,
        glean:client-hs-local,
        glean:db,
        glean:indexers,
        glean:if-glean-hs,
        glean:lib,
        glean:stubs,
        glean:test-lib,
        glean:util,
        split,
        yaml

library clang-derive-lib
    import: fb-haskell, fb-cpp, deps
    hs-source-dirs: glean/lang/clang
    build-depends:
        ghc-compact,
        glean:client-hs,
        glean:client-hs-local,
        glean:core,
        glean:db,
        glean:lib,
        glean:lib-derive,
        glean:schema,
        glean:util,
        vector-algorithms
    exposed-modules:
        Derive.Common
        Derive.CxxDeclarationSources
        Derive.CxxSame
        Derive.CxxTargetUses
        Derive.Env
        Derive.Generic
        Derive.Lib
        Derive.Types

test-suite clang-test-regression
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs:
       glean/lang/clang/tests,
       glean/lang/clang/tests/github
    type: exitcode-stdio-1.0
    main-is: Glean/Clang/Regression.hs
    other-modules: Glean.Regression.Driver.Clang
                   Glean.Clang.Test
    ghc-options: -main-is Glean.Clang.Regression
    build-depends:
       glean:regression-test-lib,
       glean:indexers,
       glean:lib
    if !flag(clang-tests)
        buildable: False

test-suite clang-test-derivefamilies
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs:
       glean/lang/clang/tests,
       glean/lang/clang/tests/github
    type: exitcode-stdio-1.0
    main-is: Glean/Clang/DeriveFamilies.hs
    other-modules: Glean.Clang.Test.DerivePass
                   Glean.Clang.Test
                   Glean.Regression.Driver.DeriveDeclFamilies
    ghc-options: -main-is Glean.Clang.DeriveFamilies
    build-depends:
       glean:if-glean-hs,
       glean:client-hs,
       glean:core,
       glean:regression-test-lib,
       glean:clang-derive-lib,
       glean:indexers,
       glean:lib
    if !flag(clang-tests)
        buildable: False

test-suite clang-test-deriveattributes
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs:
       glean/lang/clang/tests,
       glean/lang/clang/tests/github
    type: exitcode-stdio-1.0
    main-is: Glean/Clang/DeriveAttrs.hs
    other-modules: Glean.Clang.Test.DerivePass
                   Glean.Clang.Test
                   Glean.Regression.Driver.DeriveFunctionDeclAttribute
    ghc-options: -main-is Glean.Clang.DeriveAttrs
    build-depends:
       glean:if-glean-hs,
       glean:client-hs,
       glean:core,
       glean:regression-test-lib,
       glean:clang-derive-lib,
       glean:indexers,
       glean:lib
    if !flag(clang-tests)
        buildable: False

test-suite clang-test-derivefuncalls
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs:
       glean/lang/clang/tests,
       glean/lang/clang/tests/github
    type: exitcode-stdio-1.0
    main-is: Glean/Clang/DeriveFunCalls.hs
    other-modules: Glean.Clang.Test.DerivePass
                   Glean.Clang.Test
                   Glean.Regression.Driver.DeriveFunctionCalls
    ghc-options: -main-is Glean.Clang.DeriveFunCalls
    build-depends:
       glean:if-glean-hs,
       glean:client-hs,
       glean:core,
       glean:regression-test-lib,
       glean:clang-derive-lib,
       glean:indexers,
       glean:lib
    if !flag(clang-tests)
        buildable: False

test-suite clang-test-deriveobjcinherit
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs:
       glean/lang/clang/tests,
       glean/lang/clang/tests/github
    type: exitcode-stdio-1.0
    main-is: Glean/Clang/DeriveObjCInheritance.hs
    other-modules: Glean.Clang.Test.DerivePass
                   Glean.Clang.Test
                   Glean.Regression.Driver.DeriveObjcInheritance
    ghc-options: -main-is Glean.Clang.DeriveObjCInheritance
    build-depends:
       glean:if-glean-hs,
       glean:client-hs,
       glean:core,
       glean:regression-test-lib,
       glean:clang-derive-lib,
       glean:indexers,
       glean:lib
    if !flag(clang-tests)
        buildable: False

test-suite clang-test-codemarkup
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs:
       glean/lang/clang/tests,
       glean/lang/clang/tests/github
    type: exitcode-stdio-1.0
    main-is: Glean/Clang/CodeMarkup.hs
    other-modules: Glean.Clang.Test.DerivePass
                   Glean.Clang.Test
                   Glean.Regression.Driver.DeriveForCodemarkup
    ghc-options: -main-is Glean.Clang.CodeMarkup
    build-depends:
       glean:if-glean-hs,
       glean:client-hs,
       glean:core,
       glean:regression-test-lib,
       glean:clang-derive-lib,
       glean:indexers,
       glean:lib
    if !flag(clang-tests)
        buildable: False

test-suite hack-derive-test
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/lang/hack/tests
    type: exitcode-stdio-1.0
    main-is: Main.hs
    ghc-options: -main-is Main
    other-modules: Driver
    build-depends:
       glean:regression-test-lib,
       glean:hack-derive-lib,
       glean:indexers,
    if !flag(hack-tests)
        buildable: False

library bench-lib
    import: fb-haskell, fb-cpp, deps
    visibility: private
    hs-source-dirs: glean/bench
    exposed-modules:
        BenchDB
    build-depends:
        glean:client-hs,
        glean:core,
        glean:db,
        glean:schema,
        glean:test-lib,

-- Skip this one: it depends on the C++ code for the schema, and we
-- don't want to generate and compile all that just for this one test.
--
-- test-suite encoding
--     import: test
--     type: exitcode-stdio-1.0
--     main-is: EncodingTest.hs
--     ghc-options: -main-is EncodingTest
--     build-depends:
--         base16-bytestring,
--         test-compact,
--         glean:stubs,
--         glean:core,
--         glean:schema
--
-- library test-compact
--     import: fb-haskell, fb-cpp, deps
--     visibility: private
--     include-dirs: .
--     cxx-sources:
--         glean/test/cpp/compact.cpp
--     build-depends:
--         schema-cpp
--
-- library schema-cpp
--     import: fb-haskell, fb-cpp, deps
--     visibility: private
--     include-dirs: .
--     cxx-sources:
--         glean/schema/gen-cpp2/glean_test_types.cpp
--         glean/schema/gen-cpp2/glean_test_types_compact.cpp
--         glean/schema/gen-cpp2/glean_test_types_binary.cpp
--         glean/schema/gen-cpp2/glean_test_data.cpp
--         glean/schema/gen-cpp2/builtin_types.cpp
--         glean/schema/gen-cpp2/builtin_types_compact.cpp
--         glean/schema/gen-cpp2/builtin_types_binary.cpp
--         glean/schema/gen-cpp2/builtin_data.cpp
--         glean/schema/gen-cpp2/sys_types.cpp
--         glean/schema/gen-cpp2/sys_types_compact.cpp
--         glean/schema/gen-cpp2/sys_types_binary.cpp
--         glean/schema/gen-cpp2/sys_data.cpp
--         ... etc.

common test
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/test/tests
    build-depends:
        glean:test-lib,
        glean:test-unit,
        HUnit,

common angle-test
    build-depends:
        glean:stubs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:schema

test-suite angle-test-angle
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/AngleTest.hs
    ghc-options: -main-is Angle.AngleTest

test-suite angle-test-error
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/ErrorTest.hs
    ghc-options: -main-is Angle.ErrorTest

test-suite angle-test-nested
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/NestedTest.hs
    ghc-options: -main-is Angle.NestedTest

test-suite angle-test-derived
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/DerivedTest.hs
    ghc-options: -main-is Angle.DerivedTest

test-suite angle-test-set
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/SetTest.hs
    ghc-options: -main-is Angle.SetTest

test-suite angle-test-stored
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/StoredTest.hs
    ghc-options: -main-is Angle.StoredTest

test-suite angle-test-array
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/ArrayTest.hs
    ghc-options: -main-is Angle.ArrayTest

test-suite angle-test-rec-expansion
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/RecExpansionTest.hs
    ghc-options: -main-is Angle.RecExpansionTest

test-suite angle-test-data
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/DataTest.hs
    ghc-options: -main-is Angle.DataTest

test-suite angle-test-opt
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/OptTest.hs
    ghc-options: -main-is Angle.OptTest

test-suite angle-test-misc
    import: test, angle-test
    type: exitcode-stdio-1.0
    main-is: Angle/MiscTest.hs
    ghc-options: -main-is Angle.MiscTest

test-suite api
    import: test
    type: exitcode-stdio-1.0
    main-is: ApiTest.hs
    ghc-options: -main-is ApiTest
    build-depends:
        glean:stubs,
        glean:core,
        glean:if-glean-hs,
        glean:schema

test-suite cppexception
    import: test
    type: exitcode-stdio-1.0
    main-is: CppCatchTest.hs
    ghc-options: -main-is CppCatchTest
    build-depends:
        glean:stubs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:schema

test-suite timeout
    import: test
    type: exitcode-stdio-1.0
    main-is: TimeoutTest.hs
    ghc-options: -main-is TimeoutTest
    build-depends:
        glean:client-hs,
        glean:stubs,
        glean:core,
        glean:schema,
        glean:bench-lib

test-suite jsonwrite
    import: test
    type: exitcode-stdio-1.0
    main-is: JSONWriteTest.hs
    ghc-options: -main-is JSONWriteTest
    build-depends:
        glean:client-hs,
        glean:stubs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:schema,

test-suite BinaryTest
    import: fb-haskell, fb-cpp, exe
    type: exitcode-stdio-1.0
    main-is: glean/rts/tests/BinaryTest.cpp
    ghc-options: -no-hs-main
    cxx-options: -DOSS=1
    build-depends:
        glean:rts
    pkgconfig-depends: gtest_main

test-suite rtstest
    import: test
    type: exitcode-stdio-1.0
    main-is: RTSTest.hs
    ghc-options: -main-is RTSTest
    build-depends:
        glean:client-hs,
        glean:stubs,
        glean:core,
        glean:schema,
        glean:config,
        glean:if-glean-hs,
        QuickCheck,
        quickcheck-text,

test-suite rts-json
    import: test
    type: exitcode-stdio-1.0
    main-is: RTSJSONTest.hs
    ghc-options: -main-is RTSJSONTest
    build-depends:
        glean:stubs,
        glean:core,
        QuickCheck,
        quickcheck-text,

test-suite dbjanitor
    import: test
    type: exitcode-stdio-1.0
    main-is: DatabaseJanitorTest.hs
    ghc-options: -main-is DatabaseJanitorTest
    build-depends:
        glean:stubs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:schema,
        glean:config,
        glean:util
    -- https://github.com/facebookincubator/Glean/issues/224
    buildable: False

test-suite dbderive
    import: test
    type: exitcode-stdio-1.0
    main-is: DbDeriveTest.hs
    ghc-options: -main-is DbDeriveTest
    build-depends:
        glean:client-hs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:schema,
        glean:stubs

test-suite backup
    import: test
    type: exitcode-stdio-1.0
    main-is: BackupTest.hs
    ghc-options: -main-is BackupTest
    build-depends:
        glean:config,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:schema,
        glean:stubs,
        glean:util

test-suite catalog
    import: test
    type: exitcode-stdio-1.0
    main-is: CatalogTest.hs
    ghc-options: -main-is CatalogTest
    build-depends:
        glean:stubs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:if-internal-hs,
        QuickCheck,
        quickcheck-io,
        glean:util

test-suite lifecycle
    import: test
    type: exitcode-stdio-1.0
    main-is: LifecycleTest.hs
    ghc-options: -main-is LifecycleTest
    build-depends:
        glean:client-hs,
        glean:stubs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:util,
        QuickCheck,
        quickcheck-io,

test-suite shard
    import: test
    type: exitcode-stdio-1.0
    main-is: TestShard.hs
    ghc-options: -main-is TestShard
    build-depends:
        glean:stubs,
        glean:core,
        glean:if-glean-hs,

test-suite publish-shards
    import: test
    type: exitcode-stdio-1.0
    main-is: PublishShardsTest.hs
    hs-source-dirs: glean/server
    ghc-options: -main-is PublishShardsTest
    other-modules:
        DatabaseJanitorTest
        Glean.Server.Config
        Glean.Server.Sharding
    build-depends:
        glean:config,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:schema,
        glean:stubs,
        glean:util

test-suite dbproperties
    import: test
    type: exitcode-stdio-1.0
    main-is: DbPropertiesTest.hs
    ghc-options: -main-is DbPropertiesTest
    build-depends:
        glean:client-hs,
        glean:stubs,
        glean:core,
        glean:if-glean-hs,

test-suite parser
    import: test
    type: exitcode-stdio-1.0
    main-is: ParserTest.hs
    ghc-options: -main-is ParserTest
    build-depends:
        glean:stubs,
        glean:core,

test-suite schematest
    import: test
    type: exitcode-stdio-1.0
    main-is: Schema/Basic.hs
    other-modules: Schema.Lib
    ghc-options: -main-is Schema.Basic
    build-depends:
        glean:stubs,
        glean:core,
        glean:db,
        glean:config,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:lib-derive,
        glean:util,

test-suite schemaevolves
    import: test
    type: exitcode-stdio-1.0
    main-is: Schema/Evolves.hs
    other-modules: Schema.Lib
    ghc-options: -main-is Schema.Evolves
    build-depends:
        glean:stubs,
        glean:client-hs,
        glean:core,
        glean:db,
        glean:config,
        glean:if-glean-hs,
        glean:util,

test-suite schemamulti
    import: test
    type: exitcode-stdio-1.0
    main-is: Schema/Multi.hs
    other-modules: Schema.Lib
    ghc-options: -main-is Schema.Multi
    build-depends:
        glean:stubs,
        glean:core,
        glean:db,
        glean:config,
        glean:if-glean-hs,
        glean:if-internal-hs,
        glean:util,

test-suite inventory
    import: test
    type: exitcode-stdio-1.0
    main-is: InventoryTest.hs
    ghc-options: -main-is InventoryTest
    build-depends:
        glean:core,
        glean:db,
        glean:if-internal-hs,
        glean:stubs

test-suite continuation
    import: test
    type: exitcode-stdio-1.0
    main-is: ContinuationTest.hs
    ghc-options: -main-is ContinuationTest
    build-depends:
        glean:stubs,
        glean:core,
        glean:if-glean-hs,
        glean:schema

test-suite lookup
    import: test
    type: exitcode-stdio-1.0
    main-is: LookupTest.hs
    ghc-options: -main-is LookupTest
    cxx-sources: glean/rts/tests/LookupInvariants.cpp
    cxx-options: -DOSS=1
    build-depends:
        glean:stubs,
        glean:core,
        glean:db

test-suite incremental
    import: test
    type: exitcode-stdio-1.0
    main-is: IncrementalTest.hs
    ghc-options: -main-is IncrementalTest
    build-depends:
        glean:stubs,
        glean:client-hs,
        glean:core,
        glean:db,
        glean:if-glean-hs,
        glean:lib-derive,
        glean:schema
    if arch(x86_64)
        buildable: True
    else
        buildable: False

test-suite glass-range
    import: fb-haskell, fb-cpp, deps, exe
    hs-source-dirs: glean/glass/test
    default-extensions: CPP
    type: exitcode-stdio-1.0
    main-is: Glean/Glass/Test/Range.hs
    ghc-options: -main-is Glean.Glass.Test.Range
    build-depends:
        HUnit,
        glean:client-hs,
        glean:glass-lib,
        glean:if-glass-hs,
        glean:lib,
        glean:schema,
        glean:stubs,
        glean:test-lib,
        glean:test-unit,

------------------------------------------------------------------------
-- Regression tests for schemas, indexers and systems
--
-- Glean snapshot regression tests, these require the indexers installed
--
test-suite glean-snapshot-flow
    import: fb-haskell, deps, exe
    hs-source-dirs: glean/lang/codemarkup/tests/flow
    type: exitcode-stdio-1.0
    main-is: Glean/Regression/Flow/Main.hs
    ghc-options: -main-is Glean.Regression.Flow.Main
    build-depends:
        glean:regression-test-lib,
        glean:indexers
    if !flag(flow-tests)
        buildable: False

test-suite glean-snapshot-hack
    import: fb-haskell, deps, exe
    hs-source-dirs: glean/lang/codemarkup/tests/hack
    type: exitcode-stdio-1.0
    main-is: Glean/Regression/Hack/Main.hs
    ghc-options: -main-is Glean.Regression.Hack.Main
    build-depends:
        glean:regression-test-lib,
        glean:indexers
    -- no regular hhvm builds for arm64
    if !flag(hack-tests)
        buildable: False

-- The Haskell indexer tests *only* work when run using Cabal with
--