Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lennart-augustsson-epicgames committed Sep 12, 2024
1 parent da77214 commit a59185d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion MicroCabal.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: MicroCabal
version: 0.2.1.0
version: 0.2.1.1
synopsis: A partial Cabal replacement
license: Apache-2.0
license-file: LICENSE
Expand Down
2 changes: 2 additions & 0 deletions src/MicroCabal/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ build env = do
sect s@(Section "executable" _ _) | TgtExe `elem` targets env = buildExe env glob s
sect s@(Section "library" _ _) | TgtLib `elem` targets env = buildLib env glob s
sect _ = return ()
message env 2 $ "Normalized Cabal file:\n" ++ show ncbl
mapM_ sect $ addMissing sects

buildExe :: Env -> Section -> Section -> IO ()
Expand Down Expand Up @@ -309,6 +310,7 @@ install env = do
sect s@(Section "executable" _ _) | TgtExe `elem` targets env = installExe env glob s
sect s@(Section "library" _ _) | TgtLib `elem` targets env = installLib env glob s
sect _ = return ()
message env 2 $ "Normalized Cabal file:\n" ++ show ncbl
mapM_ sect $ addMissing sects

installExe :: Env -> Section -> Section -> IO ()
Expand Down
10 changes: 5 additions & 5 deletions src/MicroCabal/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ preLex = loop 0
loop _ ('\r':cs) = loop 0 cs
loop n ('\t':cs) = replicate k ' ' ++ loop 0 cs
where k = 8 - n `rem` 8
-- Remove '--MHS'.
-- Hackage does not recognize mhs as a valid compiler yet.
-- Work around this by having mhs stuff in comments that
-- MicroCabal ignores.
loop 0 ('-':'-':'M':'H':'S':cs) = loop 0 cs
loop n (c:cs) = c : loop (n+1) cs

------------------------------
Expand Down Expand Up @@ -102,9 +97,14 @@ lower :: String -> String
lower = map toLower

-- Change lines with first non-space being '--' into just a newline
-- Remove '--MHS'.
-- Hackage does not recognize mhs as a valid compiler yet.
-- Work around this by having mhs stuff in comments that
-- MicroCabal ignores.
dropCabalComments :: String -> String
dropCabalComments = unlines . map cmt . lines
where
cmt ('-':'-':'M':'H':'S':cs) = cmt cs
cmt s | take 2 (dropWhile (== ' ') s) == "--" = ""
| otherwise = s

Expand Down

0 comments on commit a59185d

Please sign in to comment.