Skip to content

Commit

Permalink
Improve the 'build' proccess
Browse files Browse the repository at this point in the history
  • Loading branch information
EMQ-YangM authored and emqplus committed Apr 15, 2020
1 parent 5117b7b commit 5b4a696
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ pscMakeOptions = PSCMakeOptions <$> many inputFile
command :: Opts.Parser (IO ())
command = pure $ do
dir <- getCurrentDirectory
fps1 <- gethmFiles (dir <> "/.deps/hamler/lib")
isExist <- doesDirectoryExist hamlerlib
fps1 <- if isExist
then gethmFiles hamlerlib
else gethmFiles (dir <> "/.deps/hamler/lib")
fps2 <- gethmFiles (dir <> "/src")
let fps = fps1 <> fps2
compile (PSCMakeOptions { pscmInput = fps
Expand Down Expand Up @@ -227,7 +230,7 @@ helloHamler = concat [
, "\n"
, "main :: String\n"
, "main = print "
, "\"hello hamler! Great world!!\"\n"
, "\"Let there be Hamler, running on Erlang VM!\"\n"
]

makeFile :: String
Expand All @@ -243,14 +246,21 @@ makeFile = concat [ ".PHONY : build run\n"

liblink = "https://github.com/hamler-lang/hamler.git"

hamlerlib = "/usr/local/lib/hamler/lib"

initProject :: Opts.Parser (IO ())
initProject =pure $ do
base <- getCurrentDirectory
let dictlist' = fmap (\x -> base <> "/" <> x) dictlist
mapM createDirectory dictlist'
writeFile "src/Main.hm" helloHamler
writeFile "Makefile" makeFile
SS.shelly $ SS.run "git" ["clone",liblink,".deps/hamler"]
isExist <- doesDirectoryExist hamlerlib
if isExist
then return ()
else do
SS.shelly $ SS.run "git" ["clone",liblink,".deps/hamler"]
return ()
print "hamler init finish!"


Expand Down

0 comments on commit 5b4a696

Please sign in to comment.