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

Add global-project non-project specific configuration #5095

Open
NightRa opened this issue Nov 23, 2019 · 0 comments
Open

Add global-project non-project specific configuration #5095

NightRa opened this issue Nov 23, 2019 · 0 comments

Comments

@NightRa
Copy link
Contributor

NightRa commented Nov 23, 2019

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

stack/src/Stack/Config.hs

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)

stack/src/Stack/Config.hs

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

@mpilgrem mpilgrem changed the title global-project Configs (not project configs) should not be ignored. Add global-project non-project specific configuration Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants