diff options
| author | Camil Staps | 2017-02-05 23:25:46 +0100 | 
|---|---|---|
| committer | Camil Staps | 2017-02-05 23:25:46 +0100 | 
| commit | 366512d77c0051c81353b5e1119cd7df3a4734b2 (patch) | |
| tree | 00f7b3336cfb6bfbda30045971c5b67028015f0e /CLPM/Package.dcl | |
| parent | Working make command (diff) | |
Start with repository and dependency resolution
Diffstat (limited to 'CLPM/Package.dcl')
| -rw-r--r-- | CLPM/Package.dcl | 42 | 
1 files changed, 34 insertions, 8 deletions
| diff --git a/CLPM/Package.dcl b/CLPM/Package.dcl index 9c685d2..3ddf521 100644 --- a/CLPM/Package.dcl +++ b/CLPM/Package.dcl @@ -1,12 +1,19 @@  definition module CLPM.Package +from StdClass import class Ord  from StdFile import class <<< +from StdOverloaded import class <, class ==, class toString +from StdTuple import instance < (a,b,c) | < a & < b & < c  from Data.Error import :: MaybeError, :: MaybeErrorString  from Data.Maybe import :: Maybe  from Text.JSON import :: JSONNode, generic JSONEncode, generic JSONDecode +from CLPM.Repository import :: Repository, :: RepositoryItem +from CLPM.Util import class Parse +  DEFAULT_NAME :== "Unnamed package" +DEFAULT_VERSION :== (0,1,0)  DEFAULT_DESC :== "Empty description"  DEFAULT_AUTHOR :== "Unknown author"  DEFAULT_URL :== "http://clean.cs.ru.nl" @@ -28,6 +35,7 @@ PACKAGE_FILE :== "clpm.json"  :: Package  	= { name    :: PackageName +	  , version :: Version  	  , desc    :: Description  	  , author  :: Author  	  , url     :: Url @@ -38,13 +46,9 @@ PACKAGE_FILE :== "clpm.json"  	  }  :: Dependency -	= { dep_name   :: PackageName -	  , dep_source :: PackageSource -	  } - -:: PackageSource  	= Git Url GitTag  	| Download Url +	| Package PackageName VersionRequirement  :: Options  	= { show_result       :: Bool @@ -56,6 +60,7 @@ PACKAGE_FILE :== "clpm.json"  	  }  :: PackageName :== String +:: Version :== (Int, Int, Int)  :: Description :== String  :: Author :== String  :: Url :== String @@ -66,15 +71,36 @@ PACKAGE_FILE :== "clpm.json"  	| Tag String  	| Latest +:: VersionRequirement +	= AtLeast Version +	| AtMost Version +	| Satisfy (Maybe Int, Maybe Int, Maybe Int) +	| Compound VersionRequirement VersionRequirement +  derive JSONEncode StoredPackage  derive JSONDecode StoredPackage  instance <<< Package -toPackage :: StoredPackage -> Package +instance toString Version + +instance == Dependency +instance == VersionRequirement +instance == GitTag + +instance Parse Dependency +instance Parse VersionRequirement + +depName :: Dependency -> PackageName + +satisfies :: VersionRequirement Version -> Bool + +toPackage :: StoredPackage -> MaybeErrorString Package  toStoredPackage :: Package -> StoredPackage -readPackage :: String -> *World -> *(Maybe Package, *World) -getRecursivePaths :: Package *World -> (MaybeErrorString [Path], *World) +readPackage :: String *World -> *(MaybeErrorString Package, *World) + +resolveDependencies :: Repository Package -> MaybeErrorString [(Dependency, Version)] +getRecursivePaths :: Package *World -> (MaybeErrorString [Path], *World)  optionsToFlags :: Options -> [String] | 
