@@ -215,12 +215,23 @@ resolvePackage packageConfig gpkg =
215215 where
216216 pkgFiles = GetPackageFiles $
217217 \ cabalfp ->
218- do distDir <- distDirFromDir (parent cabalfp)
218+ do let pkgDir = parent cabalfp
219+ distDir <- distDirFromDir pkgDir
219220 (componentModules,componentFiles,dataFiles',warnings) <-
220221 runReaderT
221222 (packageDescModulesAndFiles pkg)
222223 (cabalfp, buildDir distDir)
223- return (componentModules, componentFiles, S. insert cabalfp dataFiles', warnings)
224+ buildFiles <- liftM (S. insert cabalfp) $
225+ if buildType pkg `elem` [Nothing , Just Custom ]
226+ then do
227+ let setupHsPath = pkgDir </> $ (mkRelFile " Setup.hs" )
228+ setupLhsPath = pkgDir </> $ (mkRelFile " Setup.lhs" )
229+ setupHsExists <- doesFileExist setupHsPath
230+ if setupHsExists then return (S. singleton setupHsPath) else do
231+ setupLhsExists <- doesFileExist setupLhsPath
232+ if setupLhsExists then return (S. singleton setupLhsPath) else return S. empty
233+ else return S. empty
234+ return (componentModules, componentFiles, buildFiles <> dataFiles', warnings)
224235 pkgId = package (packageDescription gpkg)
225236 name = fromCabalPackageName (pkgName pkgId)
226237 pkg = resolvePackageDescription packageConfig gpkg
0 commit comments