{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module Development.Shake.ATS.Type ( ForeignCabal (..)
, Version (..)
, ATSTarget (..)
, ArtifactType (..)
, ATSToolConfig (..)
, ATSGen (..)
, HATSGen (..)
, Solver (..)
, atsTarget
, hasPretty
, cFlags
, otherDeps
, toolConfig
, cc
, linkStatic
, src
, gc
, binTarget
, genTargets
, hsLibs
, libs
, patsHome
, patsHomeLocs
, tgtType
, linkTargets
, cpphs
, hsFile
, strip
, solver
, linkATSLib
, patsFlags
) where
import Data.Binary (Binary (..))
import Data.Dependency (Version (..))
import Data.Hashable (Hashable)
import qualified Data.Text.Lazy as TL
import Development.Shake.C
import GHC.Generics (Generic)
import Lens.Micro.TH
data ArtifactType = StaticLibrary
| Executable
| SharedLibrary
deriving (Generic, Binary)
data Solver = PatsSolve
| Z3
| Ignore
deriving (Generic, Binary)
data ATSToolConfig = ATSToolConfig { _patsHome :: String
, _patsHomeLocs :: String
, _hasPretty :: Bool
, _cc :: CCompiler
, _linkStatic :: Bool
, _solver :: Solver
, _linkATSLib :: Bool
, _patsFlags :: [String]
} deriving (Generic, Binary)
data HATSGen = HATSGen { satsFile :: FilePath
, hatsFile :: FilePath
} deriving (Generic, Binary)
data ATSGen = ATSGen { _hsFile :: FilePath
, _atsTarget :: FilePath
, _cpphs :: Bool
} deriving (Generic, Binary)
data ATSTarget = ATSTarget { _cFlags :: [String]
, _toolConfig :: ATSToolConfig
, _gc :: Bool
, _libs :: [String]
, _src :: [FilePath]
, _hsLibs :: [ForeignCabal]
, _genTargets :: [ATSGen]
, _linkTargets :: [HATSGen]
, _binTarget :: FilePath
, _otherDeps :: [FilePath]
, _tgtType :: ArtifactType
, _strip :: Bool
} deriving (Generic, Binary)
data ForeignCabal = ForeignCabal { projectFile :: Maybe TL.Text
, cabalFile :: TL.Text
, objectFile :: TL.Text
} deriving (Eq, Show, Generic, Binary, Hashable)
mconcat <$> traverse makeLenses [''ATSGen, ''ATSTarget, ''ATSToolConfig]