-
Notifications
You must be signed in to change notification settings - Fork 847
Open
Labels
Description
General summary
The global-project/stack.yaml config properties are ignored when stack is used outside of a project, while only config.yamls configs are used.
This doesn't allow to specify configs which should be used when outside a project, and not global configs which are applied to all projects.
Steps to reproduce
For example, specifying setup-info-locations in global-project/stack.yaml is completely ignored.
Stack version
Stack 2.13 release
Relevant source code
Lines 411 to 423 in 665a184
| loadConfig :: HasRunner env => (Config -> RIO env a) -> RIO env a | |
| loadConfig inner = do | |
| mstackYaml <- view $ globalOptsL.to globalStackYaml | |
| mproject <- loadProjectConfig mstackYaml | |
| mresolver <- view $ globalOptsL.to globalResolver | |
| configArgs <- view $ globalOptsL.to globalConfigMonoid | |
| (stackRoot, userOwnsStackRoot) <- determineStackRootAndOwnership configArgs | |
| let (mproject', addConfigMonoid) = | |
| case mproject of | |
| PCProject (proj, fp, cm) -> (PCProject (proj, fp), (cm:)) | |
| PCGlobalProject -> (PCGlobalProject, id) | |
| PCNoProject deps -> (PCNoProject deps, id) |
(
PCGlobalProject, id - should not be id, but the ConfigMonoid of the global-project/stack.yaml)
Lines 483 to 495 in 665a184
| PCGlobalProject -> do | |
| logDebug "Run from outside a project, using implicit global project config" | |
| destDir <- getImplicitGlobalProjectDir config | |
| let dest :: Path Abs File | |
| dest = destDir </> stackDotYaml | |
| dest' :: FilePath | |
| dest' = toFilePath dest | |
| ensureDir destDir | |
| exists <- doesFileExist dest | |
| if exists | |
| then do | |
| iopc <- loadConfigYaml (parseProjectAndConfigMonoid destDir) dest | |
| ProjectAndConfigMonoid project _ <- liftIO iopc |
(
ProjectAndConfigMonoid project _ - The ConfigMonoid should not be ignored)
Relevant issues
Relevant: #964 was also confused by this behavior