Remove autogen-modules from other-modules + Update tests

This commit is contained in:
Avi Dessauer 2020-05-19 22:18:49 -04:00
parent 4513e5033b
commit 3350d7c90f
5 changed files with 28 additions and 34 deletions

View File

@ -6,8 +6,5 @@ cradle:
- path: "app/Main.hs"
component: "implicit-hie:exe:gen-hie"
- path: "app/Paths_implicit_hie.hs"
component: "implicit-hie:exe:gen-hie"
- path: "test"
component: "implicit-hie:test:implicit-hie-test"

View File

@ -76,7 +76,7 @@ parseBench = parseSecMain (Comp Bench) "benchmark"
parseSecMain :: (Name -> Path -> Component) -> Text -> Indent -> Parser [Component]
parseSecMain c s i = do
n <- componentHeader i s
p <- pathMain (i + 1) ["./"] "" []
p <- pathMain (i + 1) ["./"] "" [] []
pure $ map (c n) p
parseQuoted :: Parser Text
@ -106,17 +106,24 @@ parseList i = items <|> (emptyOrComLine >> indent i >> items)
<|> pure []
pure $ h : t
pathMain :: Indent -> [Text] -> Text -> [Text] -> Parser [Text]
pathMain i p m o =
(hsSourceDir i >>= (\p' -> pathMain i p' m o))
<|> (field i "main-is" (const parseString) >>= flip (pathMain i p) o)
<|> (field i "other-modules" parseList >>= pathMain i p m)
<|> (skipBlockLine i >> pathMain i p m o)
<|> pure (map (<//> m) p <> [p' <//> (o' <> ".hs") | p' <- p, o' <- o])
pathMain :: Indent -> [Text] -> Text -> [Text] -> [Text] -> Parser [Text]
pathMain i p m o a =
(hsSourceDir i >>= (\p' -> pathMain i p' m o a))
<|> (field i "main-is" (const parseString) >>= (\m' -> pathMain i p m' o a))
<|> (field i "other-modules" parseList >>= flip (pathMain i p m) a)
<|> (field i "autogen-modules" parseList >>= pathMain i p m o)
<|> (skipBlockLine i >> pathMain i p m o a)
<|> pure
( map (<//> m) p
<> [ p' <//> (o' <> ".hs")
| p' <- p,
o' <- filter (`notElem` a) o
]
)
(<//>) :: Text -> Text -> Text
a <//> b = T.pack (T.unpack a </> T.unpack b)
infixr 5 <//>
parseSec :: Indent -> Text -> (Name -> Path -> Component) -> Parser [Component]

View File

@ -17,9 +17,7 @@ spec = do
describe "Should Succeed"
$ it "successfully parses executable section"
$ exeSection ~> parseExe 0
`shouldParse` [ Comp Exe "implicit-hie-exe" "app/Main.hs",
Comp Exe "implicit-hie-exe" "app/Paths_implicit_hie.hs"
]
`shouldParse` [Comp Exe "gen-hie" "app/Main.hs"]
describe "Should Succeed"
$ it "successfully parses test section"
$ testSection ~> parseTestSuite 0
@ -50,8 +48,7 @@ spec = do
`shouldParse` Package
"implicit-hie"
[ Comp Lib "" "src",
Comp Exe "implicit-hie-exe" "app/Main.hs",
Comp Exe "implicit-hie-exe" "app/Paths_implicit_hie.hs",
Comp Exe "gen-hie" "app/Main.hs",
Comp Test "implicit-hie-test" "test"
]
describe "Should Succeed"
@ -92,9 +89,11 @@ spec = do
exeSection :: Text
exeSection =
"executable implicit-hie-exe\n\
"executable gen-hie\n\
\ other-modules:\n\
\ Paths_implicit_hie\n\
\ autogen-modules:\n\
\ Paths_implicit_hie\n\
\ hs-source-dirs:\n\
\ app\n\
\ ghc-options: -O2\n\

View File

@ -1,28 +1,22 @@
cradle:
cabal:
- path: "src"
- path: "./src"
component: "lib:haskell-language-server"
- path: "exe/Main.hs"
- path: "./exe/Main.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "exe/Arguments.hs"
- path: "./exe/Arguments.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "exe/Paths_haskell_language_server.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "exe/Wrapper.hs"
- path: "./exe/Wrapper.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "exe/Arguments.hs"
- path: "./exe/Arguments.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "exe/Paths_haskell_language_server.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "test/functional"
- path: "./test/functional"
component: "haskell-language-server:test:func-test"
- path: "test/utils"
- path: "./test/utils"
component: "haskell-language-server:lib:hls-test-utils"

View File

@ -6,8 +6,5 @@ cradle:
- path: "./app/Main.hs"
component: "implicit-hie:exe:gen-hie"
- path: "./app/Paths_implicit_hie.hs"
component: "implicit-hie:exe:gen-hie"
- path: "./test"
component: "implicit-hie:test:implicit-hie-test"