on master help sign in
Note external iPKG dependencies in package description.

Idris package dependencies are currently listed in the Options list of an `iPKG` file. This commit extends the package description so they are tracked explicitly in package description as well as the Options list. Thus, allowing easier access to a packages dependencies.

commit7af834ee19e1179172e67d9ef6da087b6e6fb508 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateSun 31 Jul 2016, 11:51 (10 years ago) parent034169b
1 file changed+6−2
src/Pkg/PParser.hs+6−2
src/Pkg/PParser.hs+6−2
@@ -23,6 +23,7 @@ import Control.Monad.State.Strict
2323import Control.Applicative
2424import System.FilePath (takeFileName, isValid)
2525import Data.Maybe (isNothing, fromJust)
26+import Data.List (union)
2627
2728import Util.System
2829
@@ -30,6 +31,7 @@ type PParser = StateT PkgDesc IdrisInnerParser
3031
3132data PkgDesc = PkgDesc {
3233 pkgname :: String -- ^ Name associated with a package.
34+ , pkgdeps :: [String] -- ^ List of packages this package depends on.
3335 , pkgbrief :: Maybe String -- ^ Brief description of the package.
3436 , pkgversion :: Maybe String -- ^ Version string to associate with the package.
3537 , pkgreadme :: Maybe String -- ^ Location of the README file.
@@ -52,7 +54,7 @@ data PkgDesc = PkgDesc {
5254
5355-- | Default settings for package descriptions.
5456defaultPkg :: PkgDesc
55−defaultPkg = PkgDesc "" Nothing Nothing Nothing Nothing
57+defaultPkg = PkgDesc "" [] Nothing Nothing Nothing Nothing
5658 Nothing Nothing Nothing Nothing
5759 Nothing [] [] Nothing [] "" [] (sUN "") Nothing []
5860
@@ -169,7 +171,9 @@ pClause = do reserved "executable"; lchar '=';
169171 ps <- sepBy1 (fst <$> identifier) (lchar ',')
170172 st <- get
171173 let pkgs = pureArgParser $ concatMap (\x -> ["-p", x]) ps
172− put (st {idris_opts = pkgs ++ idris_opts st})
174+
175+ put (st { pkgdeps = ps `union` (pkgdeps st)
176+ , idris_opts = pkgs ++ idris_opts st})
173177
174178 <|> do reserved "modules"; lchar '=';
175179 ms <- sepBy1 (fst <$> iName []) (lchar ',')