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 a switch to select between cabal new-build or stack build #429

Closed
andrewufrank opened this issue Feb 21, 2017 · 5 comments
Closed

add a switch to select between cabal new-build or stack build #429

andrewufrank opened this issue Feb 21, 2017 · 5 comments

Comments

@andrewufrank
Copy link

andrewufrank commented Feb 21, 2017

the current method to decide based on the presence of a stack.yaml file whether to use the cabal new-build approach or stack build is not working and can probably not be fixed.

stack uses a central (hierarchically higher) directory to select the build-plan and stores there the results. this can be used with a dummy (stackroot.cabal) haskell project in this central directory. if leksah needs to update a package in the project (where no stack.yaml files must be present) it goes to cabal new-build and fails. with a switch, in stead of sensing the presence of a file, stack build could started and work properly.

@hamishmack
Copy link
Member

cabal has a similar problem when you have more than one cabal.project files in different parent folders. Leksah runs the cabal new-build in the directory of the cabal file so it uses the cabal.project in the inner most directory.

I think we need to add the concept of a "Project" file to Leksah. This could be a cabal.project or a stack.yaml file. Instead of adding the individual packages you could add the project. It would show as a parent node in the workspace with the packages as children.

If the project file is a .yaml file leksah would use --stack-yaml to pass it to stack when building packages.

It the project file is a .project file leksah would set the current directory to the directory of the project and use --project-file to pass the filename.

@andrewufrank andrewufrank changed the title add a swtich to select between cabal new-build or stack build add a switch to select between cabal new-build or stack build Feb 21, 2017
@andrewufrank
Copy link
Author

@hamishmack i think your suggestion is sensible, but i have since learned, that stack assumes that multi-package modules use extra-dep for packages other than the major one and to load them individually.
i will experiment with this and report what i find.

@andrewufrank
Copy link
Author

andrewufrank commented Apr 16, 2017 via email

@andrewufrank
Copy link
Author

i have tried a leksah fork with a flag in preferences which always uses stack build (i can send you a pull request). BUT: there is a problem in stack with the described scenario (see issue in stack #3168) which is not consistently handled correctly. if i can force leksah to use always the selected 'active package' as target and never another one (for which no stack.yaml file is present, or for which a stack.yaml file exist but should not be used) then it would work. at the moment, my fork of leksah tries to access stack.yaml files and crashes..
what do you think needs to be adapted beyond the replacement of the test for the presence of a stack.yaml file and replace with a preference flag?

@andrewufrank
Copy link
Author

the current solution works - at least for stack.yaml! jan 2018, 16.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants