-
Notifications
You must be signed in to change notification settings - Fork 37
For executables, we should read the main-is
field from the cabal file.
#627
Conversation
Previously, we simply treat file name for `Main` module as `Main.hs` to build executable. That doesn't work for the `timeout` program. This patch fixes the problem.
This pr blocks #499 . |
Looks reasonable to me. |
src/Oracles/ModuleFiles.hs
Outdated
Just (mod, filepath) -> | ||
concatForM dirs $ \dir -> do | ||
found <- doesFileExist (dir -/- filepath) | ||
return $ if found then [(mod, unifyPath $ dir -/- filepath)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ (mod, unifyPath $ dir -/- filepath) | found ]
might be less awkward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/Oracles/ModuleFiles.hs
Outdated
@@ -136,7 +141,16 @@ moduleFilesOracle = void $ do | |||
let cmp f = compare (dropExtension f) | |||
found = intersectOrd cmp files mFiles | |||
return (map (fullDir -/-) found, mDir) | |||
let pairs = sort [ (encodeModule d f, f) | (fs, d) <- result, f <- fs ] | |||
|
|||
mainpairs <- case mainIs of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here, explaining why main
s are treated differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@sighingnow Many thanks! Just a couple of minor comments above. Please add a comment to clarify what's going on. |
@snowleopard Could we land this now ? |
@sighingnow Yes, thanks! I'm just waiting for at least one green light from Travis (I believe 8.2.2 was fine). |
Merged. |
Thanks ! |
Previously, we simply treat file name for
Main
module asMain.hs
to build executables. That doesn't work for thetimeout
program. This patch fixes the problem.