aboutsummaryrefslogtreecommitdiff
path: root/CLPM/Package.dcl
blob: 9c685d2482e615e720c95409e8a08e134b8a17c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
definition module CLPM.Package

from StdFile import class <<<

from Data.Error import :: MaybeError, :: MaybeErrorString
from Data.Maybe import :: Maybe
from Text.JSON import :: JSONNode, generic JSONEncode, generic JSONDecode

DEFAULT_NAME :== "Unnamed package"
DEFAULT_DESC :== "Empty description"
DEFAULT_AUTHOR :== "Unknown author"
DEFAULT_URL :== "http://clean.cs.ru.nl"
DEFAULT_MAIN :== "main"
DEFAULT_PATHS :== ["."]
DEFAULT_OPTIONS :==
	{ show_result       = True
	, show_constructors = True
	, show_time         = True
	, heap_size         = 2000
	, stack_size        = 500
	, extra_flags       = []
	}

MODULE_DIR :== "clpm_modules"
PACKAGE_FILE :== "clpm.json"

:: StoredPackage

:: Package
	= { name    :: PackageName
	  , desc    :: Description
	  , author  :: Author
	  , url     :: Url
	  , main    :: Path
	  , depends :: [Dependency]
	  , paths   :: [Path]
	  , options :: Options
	  }

:: Dependency
	= { dep_name   :: PackageName
	  , dep_source :: PackageSource
	  }

:: PackageSource
	= Git Url GitTag
	| Download Url

:: Options
	= { show_result       :: Bool
	  , show_constructors :: Bool
	  , show_time         :: Bool
	  , heap_size         :: Int
	  , stack_size        :: Int
	  , extra_flags       :: [String]
	  }

:: PackageName :== String
:: Description :== String
:: Author :== String
:: Url :== String
:: Path :== String

:: GitTag
	= Commit String
	| Tag String
	| Latest

derive JSONEncode StoredPackage
derive JSONDecode StoredPackage

instance <<< Package

toPackage :: StoredPackage -> Package
toStoredPackage :: Package -> StoredPackage

readPackage :: String -> *World -> *(Maybe Package, *World)
getRecursivePaths :: Package *World -> (MaybeErrorString [Path], *World)

optionsToFlags :: Options -> [String]