Skip to content

Commit

Permalink
Minor refactoring and comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Z. Yang <[email protected]>
  • Loading branch information
ezyang committed Oct 16, 2016
1 parent 4efe8c2 commit 40892a0
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Cabal/Distribution/Simple/SrcDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,7 @@ listPackageSourcesOrdinary verbosity pkg_descr pps =
case testInterface t of
TestSuiteExeV10 _ mainPath -> do
biSrcs <- allSourcesBuildInfo bi pps []
srcMainFile <- do
ppFile <- findFileWithExtension (ppSuffixes pps)
(hsSourceDirs bi) (dropExtension mainPath)
case ppFile of
Nothing -> findFile (hsSourceDirs bi) mainPath
Just pp -> return pp
srcMainFile <- findMainExeFile bi pps mainPath
return (srcMainFile:biSrcs)
TestSuiteLibV09 _ m ->
allSourcesBuildInfo bi pps [m]
Expand All @@ -196,12 +191,7 @@ listPackageSourcesOrdinary verbosity pkg_descr pps =
case benchmarkInterface bm of
BenchmarkExeV10 _ mainPath -> do
biSrcs <- allSourcesBuildInfo bi pps []
srcMainFile <- do
ppFile <- findFileWithExtension (ppSuffixes pps)
(hsSourceDirs bi) (dropExtension mainPath)
case ppFile of
Nothing -> findFile (hsSourceDirs bi) mainPath
Just pp -> return pp
srcMainFile <- findMainExeFile bi pps mainPath
return (srcMainFile:biSrcs)
BenchmarkUnsupported tp -> die $ "Unsupported benchmark type: "
++ show tp
Expand Down Expand Up @@ -427,6 +417,9 @@ allSourcesBuildInfo bi pps modules = do
let searchDirs = hsSourceDirs bi
sources <- fmap concat $ sequenceA $
[ let file = ModuleName.toFilePath module_
-- NB: *Not* findFileWithExtension, because the same source
-- file may show up in multiple paths due to a conditional;
-- we need to package all of them. See #367.
in findAllFilesWithExtension suffixes searchDirs file
>>= nonEmpty (notFound module_) return
| module_ <- modules ++ otherModules bi ]
Expand Down

0 comments on commit 40892a0

Please sign in to comment.