Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also resolve auto-generated component files. #5393

Merged
merged 1 commit into from
Sep 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Stack/Package.hs
Original file line number Diff line number Diff line change
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