-
Notifications
You must be signed in to change notification settings - Fork 842
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
Do not require .cabal for all packages in stack.yaml when running stack runghc #1722
Comments
It is necessary to read stack.yaml for |
worth doing for use cases like this one? |
Yeah, it seems reasonable to me! It also means that We will have to figure out how to draw the line of when things get validated. I'd say that all validation for the stack.yaml that's purely based on its contents should happen up-front. Validation that requires some filesystem state, such as the presence of cabal files, should happen lazily. |
#!/bin/sh
mv stack.yaml stack-old.yaml
stack --resolver=lts-3.14 runghc genCabal.hs --package cartel --install-ghc > pinchot.cabal
mv stack-old.yaml stack.yaml In the example above this happens because In a way, it seems that sometimes we want a way to force stack to use the global config or a way to tell it ignore local packages because we are only going to work with snapshot. Maybe we can have
We can probably take an |
@luigy Yep, this is indeed related to our discussion on the PR for checking extra-deps #1858 (comment) . We should always warn about such things, but allow things to work if they don't actually require any of the missing packages.
It's inadvisable to use the global config for build scripts. Something like I'd rather not ignore local packages, since they may be needed for generating cabal files. Or, in the case of #1521, installing extra packages to the DB.
For knowing which packages are present, it's sufficient to just check the cabal file name, since stack enforces that it match the package name.
Sounds good to me! If any packages are missing, then it should definitely error out if the user didn't explicitly specify targets ( |
👍 indeed
yeah, the only case that came to mind was for a script like the one referenced above. The flag would of just behaved as if the user set it's packages to [], but it's all just a hack to get a package into the snapshot db. In any case the
Yep, that is assuming that the location of the package in the config even exits. So pretty much when a target is passed via
👍 |
True. I think it'd be fine to just give a warning in the case that:
This is getting a bit complicated. @harendra-kumar @luigy , thoughts on whether this complexity is worth it? I'm starting to think it isn't. While this is theoretically feasible, I think most people would be surprised by this feature. Projects that need to generate their own cabal files are going to have their own build scripts anyway, and they can use --stack-yaml to point to a stack.yaml file that works before the cabal files are present. |
Ah, this actually turned out to not be so complicated. It got fixed as a side effect of fd6d45 ! |
I saw this script in the pinchot package. It is moving stack.yaml out of the way before invoking a script using
stack runghc
.When we use runghc on a file inside a project dir do we need settings from
stack.yaml
? Or can we just avoid reading it?This will allow us to freely invoke scripts inside the project dir. For example the pinchot package is generating .cabal file using a script. When the script is run via
stack runghc
it finds a stack.yaml but no .cabal so it fails when trying to process the stack.yaml.The text was updated successfully, but these errors were encountered: