Skip to content

Commit

Permalink
Merge pull request #5393 from uncle-betty/hie-bios
Browse files Browse the repository at this point in the history
Also resolve auto-generated component files.
  • Loading branch information
snoyberg committed Sep 21, 2020
2 parents 3c6a5d7 + f8b7bfc commit e4a25e9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Stack/Package.hs
Expand Up @@ -82,6 +82,7 @@ import qualified RIO.PrettyPrint as PP (Style (Module))
data Ctx = Ctx { ctxFile :: !(Path Abs File)
, ctxDistDir :: !(Path Abs Dir)
, ctxBuildConfig :: !BuildConfig
, ctxCabalVer :: !Version
}

instance HasPlatform Ctx
Expand Down Expand Up @@ -219,9 +220,10 @@ packageFromPackageDescription packageConfig pkgFlags (PackageDescriptionPair pkg
let pkgDir = parent cabalfp
distDir <- distDirFromDir pkgDir
bc <- view buildConfigL
cabalVer <- view cabalVersionL
(componentModules,componentFiles,dataFiles',warnings) <-
runRIO
(Ctx cabalfp distDir bc)
(Ctx cabalfp distDir bc cabalVer)
(packageDescModulesAndFiles pkg)
setupFiles <-
if buildType pkg == Custom
Expand Down Expand Up @@ -795,13 +797,21 @@ resolveComponentFiles
resolveComponentFiles component build names = do
dirs <- mapMaybeM resolveDirOrWarn (hsSourceDirs build)
dir <- asks (parent . ctxFile)
agdirs <- autogenDirs
(modules,files,warnings) <-
resolveFilesAndDeps
component
(if null dirs then [dir] else dirs)
((if null dirs then [dir] else dirs) ++ agdirs)
names
cfiles <- buildOtherSources build
return (modules, files <> cfiles, warnings)
where
autogenDirs = do
cabalVer <- asks ctxCabalVer
distDir <- asks ctxDistDir
let compDir = componentAutogenDir cabalVer component distDir
pkgDir = maybeToList $ packageAutogenDir cabalVer distDir
return $ compDir : pkgDir

-- | Get all C sources and extra source files in a build.
buildOtherSources :: BuildInfo -> RIO Ctx [DotCabalPath]
Expand Down

0 comments on commit e4a25e9

Please sign in to comment.