mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 12:37:32 +03:00
all: initial work on dependency management
This commit is contained in:
parent
e741d59ce3
commit
89c9492567
@ -81,6 +81,11 @@ main = do args <- SystemEnvironment.getArgs
|
|||||||
runInputT settings (repl finalContext "")
|
runInputT settings (repl finalContext "")
|
||||||
Build -> do _ <- executeString True finalContext ":b" "Compiler (Build)"
|
Build -> do _ <- executeString True finalContext ":b" "Compiler (Build)"
|
||||||
return ()
|
return ()
|
||||||
|
Install thing ->
|
||||||
|
do _ <- executeString True finalContext
|
||||||
|
("(install \"" ++ thing ++ "\")")
|
||||||
|
"Installation"
|
||||||
|
return ()
|
||||||
BuildAndRun -> do _ <- executeString True finalContext ":bx" "Compiler (Build & Run)"
|
BuildAndRun -> do _ <- executeString True finalContext ":bx" "Compiler (Build & Run)"
|
||||||
-- TODO: Handle the return value from executeString and return that one to the shell
|
-- TODO: Handle the return value from executeString and return that one to the shell
|
||||||
return ()
|
return ()
|
||||||
@ -103,6 +108,7 @@ parseArgs args = parseArgsInternal [] Repl [] args
|
|||||||
case arg of
|
case arg of
|
||||||
"-b" -> parseArgsInternal filesToLoad Build otherOptions restArgs
|
"-b" -> parseArgsInternal filesToLoad Build otherOptions restArgs
|
||||||
"-x" -> parseArgsInternal filesToLoad BuildAndRun otherOptions restArgs
|
"-x" -> parseArgsInternal filesToLoad BuildAndRun otherOptions restArgs
|
||||||
|
"-i" -> parseArgsInternal filesToLoad (Install (head restArgs)) otherOptions (tail restArgs)
|
||||||
"--check" -> parseArgsInternal filesToLoad Check otherOptions restArgs
|
"--check" -> parseArgsInternal filesToLoad Check otherOptions restArgs
|
||||||
"--no-core" -> parseArgsInternal filesToLoad execMode (NoCore : otherOptions) restArgs
|
"--no-core" -> parseArgsInternal filesToLoad execMode (NoCore : otherOptions) restArgs
|
||||||
"--log-memory" -> parseArgsInternal filesToLoad execMode (LogMemory : otherOptions) restArgs
|
"--log-memory" -> parseArgsInternal filesToLoad execMode (LogMemory : otherOptions) restArgs
|
||||||
|
@ -20,3 +20,4 @@
|
|||||||
(load "Map.carp")
|
(load "Map.carp")
|
||||||
(load "Heap.carp")
|
(load "Heap.carp")
|
||||||
(load "Sort.carp")
|
(load "Sort.carp")
|
||||||
|
(load "Install.carp")
|
||||||
|
8
core/Install.carp
Normal file
8
core/Install.carp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
(defn install [file]
|
||||||
|
(let [split (String.split-by file &[\@])]
|
||||||
|
(if (= (Array.length &split) 1)
|
||||||
|
(System.system &(fmt "git clone %s" file))
|
||||||
|
(do
|
||||||
|
(System.system &(fmt "git clone %s" file))
|
||||||
|
(comment TODO: check out tag)
|
||||||
|
))))
|
@ -447,6 +447,7 @@ catcher ctx exception =
|
|||||||
case contextExecMode ctx of
|
case contextExecMode ctx of
|
||||||
Repl -> return ctx
|
Repl -> return ctx
|
||||||
Build -> exitWith (ExitFailure returnCode)
|
Build -> exitWith (ExitFailure returnCode)
|
||||||
|
Install _ -> exitWith (ExitFailure returnCode)
|
||||||
BuildAndRun -> exitWith (ExitFailure returnCode)
|
BuildAndRun -> exitWith (ExitFailure returnCode)
|
||||||
Check -> exitWith ExitSuccess
|
Check -> exitWith ExitSuccess
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ forceTy :: XObj -> Ty
|
|||||||
forceTy xobj = fromMaybe (error ("No type in " ++ show xobj)) (ty xobj)
|
forceTy xobj = fromMaybe (error ("No type in " ++ show xobj)) (ty xobj)
|
||||||
|
|
||||||
-- | How should the compiler be run? Interactively or just build / build & run and then quit?
|
-- | How should the compiler be run? Interactively or just build / build & run and then quit?
|
||||||
data ExecutionMode = Repl | Build | BuildAndRun | Check deriving (Show, Eq)
|
data ExecutionMode = Repl | Build | BuildAndRun | Install String | Check deriving (Show, Eq)
|
||||||
|
|
||||||
-- | Information needed by the REPL
|
-- | Information needed by the REPL
|
||||||
data Context = Context { contextGlobalEnv :: Env
|
data Context = Context { contextGlobalEnv :: Env
|
||||||
|
Loading…
Reference in New Issue
Block a user