{-|
Module      : Idris.Package.Common
Description : Data structures common to all `iPKG` file formats.
License     : BSD3
Maintainer  : The Idris Community.
-}
module Idris.Package.Common where

import Idris.Core.TT (Name)
import Idris.Imports
import Idris.Options (Opt(..))

-- | Description of an Idris package.
data PkgDesc = PkgDesc {
    PkgDesc -> PkgName
pkgname       :: PkgName      -- ^ Name associated with a package.
  , PkgDesc -> [PkgName]
pkgdeps       :: [PkgName]    -- ^ List of packages this package depends on.
  , PkgDesc -> Maybe String
pkgbrief      :: Maybe String -- ^ Brief description of the package.
  , PkgDesc -> Maybe String
pkgversion    :: Maybe String -- ^ Version string to associate with the package.
  , PkgDesc -> Maybe String
pkgreadme     :: Maybe String -- ^ Location of the README file.
  , PkgDesc -> Maybe String
pkglicense    :: Maybe String -- ^ Description of the licensing information.
  , PkgDesc -> Maybe String
pkgauthor     :: Maybe String -- ^ Author information.
  , PkgDesc -> Maybe String
pkgmaintainer :: Maybe String -- ^ Maintainer information.
  , PkgDesc -> Maybe String
pkghomepage   :: Maybe String -- ^ Website associated with the package.
  , PkgDesc -> Maybe String
pkgsourceloc  :: Maybe String -- ^ Location of the source files.
  , PkgDesc -> Maybe String
pkgbugtracker :: Maybe String -- ^ Location of the project's bug tracker.
  , PkgDesc -> [String]
libdeps       :: [String]     -- ^ External dependencies.
  , PkgDesc -> [String]
objs          :: [String]     -- ^ Object files required by the package.
  , PkgDesc -> Maybe String
makefile      :: Maybe String -- ^ Makefile used to build external code. Used as part of the FFI process.
  , PkgDesc -> [Opt]
idris_opts    :: [Opt]        -- ^ List of options to give the compiler.
  , PkgDesc -> String
sourcedir     :: String       -- ^ Source directory for Idris files.
  , PkgDesc -> [Name]
modules       :: [Name]       -- ^ Modules provided by the package.
  , PkgDesc -> Maybe Name
idris_main    :: Maybe Name   -- ^ If an executable in which module can the Main namespace and function be found.
  , PkgDesc -> Maybe String
execout       :: Maybe String -- ^ What to call the executable.
  , PkgDesc -> [Name]
idris_tests   :: [Name]       -- ^ Lists of tests to execute against the package.
  } deriving (Int -> PkgDesc -> ShowS
[PkgDesc] -> ShowS
PkgDesc -> String
(Int -> PkgDesc -> ShowS)
-> (PkgDesc -> String) -> ([PkgDesc] -> ShowS) -> Show PkgDesc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PkgDesc -> ShowS
showsPrec :: Int -> PkgDesc -> ShowS
$cshow :: PkgDesc -> String
show :: PkgDesc -> String
$cshowList :: [PkgDesc] -> ShowS
showList :: [PkgDesc] -> ShowS
Show)

-- | Default settings for package descriptions.
defaultPkg :: PkgDesc
defaultPkg :: PkgDesc
defaultPkg = PkgName
-> [PkgName]
-> Maybe String
-> Maybe String
-> Maybe String
-> Maybe String
-> Maybe String
-> Maybe String
-> Maybe String
-> Maybe String
-> Maybe String
-> [String]
-> [String]
-> Maybe String
-> [Opt]
-> String
-> [Name]
-> Maybe Name
-> Maybe String
-> [Name]
-> PkgDesc
PkgDesc PkgName
unInitializedPkgName [] Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
                        Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
                        Maybe String
forall a. Maybe a
Nothing [] [] Maybe String
forall a. Maybe a
Nothing [] String
"" [] Maybe Name
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing []