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

Stack init and solver finish up and doc update #1674

merged 25 commits into from Jan 27, 2016


Copy link

@harendra-kumar harendra-kumar commented Jan 19, 2016

Provide, working out of the box experience, for stack init and stack solver commands. Important fixes in this PR include:

  • Automatically omit packages (--omit-packages)
    • which cannot be compiled by the resolver
    • when there is a dependency conflict
    • when there is a package name conflict
    • Omitted packages are kept as commented in the config file
  • Try all major lts versions during init so that we do everything possible to compile a package
  • When some packages cannot be compiled choose a resolver which compiles maximum number of packages
  • Provide user messages on every config load when packages are omitted or extra-deps are added by init
  • Report packages with mismatched filename and package name
  • Update stack init and solver documentation in the guide

The documentation in the user guide provides more information and workflow examples.

With these fixes stack init experience must now become much better. We should be able to generate a working stack.yaml for most packages without any issues. If a package has working cabal files and cabal can build it but we are not able to generate a stack.yaml out of the box then it should be considered a bug!

harendra-kumar added 25 commits Jan 7, 2016
When doing stack init, some of the packages may not be compatible with the
resolver compiler while others just build ok. In that case we provide the user
an option to ignore those packages and use the rest. If --force is
specified stack will create a config with those packages which are compatible.

Fixes #1621
Warnings about:
  - ignored packages
  - extra dependencies
Packages which are not compatible with the resolver are added to the
config but commented out.

See #1621
When there are some issues with the config file add warning messages for the
user to be displayed everytime the config file is read. The messages can be
suppressed by a user action i.e. remove it from the config if the user accepts
the config.

See #1621
When there is an unresolved conflict among the dependencies of multiple source
packages then remove one of the conflicting packages and then retry. The
package chosen to be removed is the one which is on top of the dependency
pyramid i.e. noone else depends on it.

The functionality is not yet complete. It will be complete once cabal output is
parsed and the list of conflicting packages is fed to the upper level logic.

See #1616
When there is an unresolvable conflict among the dependencies of multiple
user packages ignore one of them and try again to resolve the rest.

This commit adds code for parsing cabal output to find out user packages
involved in the conflict. This output is then used to decide one of those
packages to be ignored from consideration in the next try.

Fixes #1616
When using stack init if duplicated package names are found automatically
ignore the duplicates with a warning.
Remove the overloading of --force option and use it exclusively for overwriting
an existing config. Use a separate --omit-packages option for excluding
conflicting or incompatible packages from generated config.

See #1621
When all resolver compilers are incompatible with some user packages then
choose the one which can build maximum number of packages rather then the one
with least number of compiler incompatibility errors.
Remove the affinity to existing in-use snapshots.
Try latest major lts, then latest nightly and then all other major lts versions
in the most recent first order.

Fixes #1628
stack init now uses the global --resolver option instead of its own
implementation of the same.

This changes the CLI behavior: you will have to use
`stack --resolver lts-4.1 init` instead of `stack init --resolver lts-4.1`

Fixes #1588
Detect duplicates based on the cabal package name instead of the file name.
If the cabal file does not have a name assigned to a package then display an
error and exit. Otherwise empty names will cause strange errors later on.

Also added code to dislay cabal error output when we cannot parse it.
Packages in upper level directories are likely to be more important and
therefore try to pick those when there is a conflict in packages.
Lot of things changed with the recent changes in stack init.
Since stack does not allow package name to mismatch with the .cabal file name
stack init should also not allow that. This commit disallows the mismatch.
Now that there is no local --resolver option for stack init we can allow the
global option to be used in subcommand context.

This was disabled by the fix for #1531. I have reverted the init specific fix for
that but kept the overall mechanism for any future use.
Copy link

@mgsloan mgsloan commented Jan 20, 2016

Looks awesome, thanks! I'll come back with more detailed feedback sometime in the next couple days.


This comment has been minimized.

Copy link

@mgsloan mgsloan commented on src/Stack/BuildPlan.hs in c1b1bb4 Jan 27, 2016

Hmm, I don't like overloading Ord and Eq for this purpose. Particularly because the Eq instance allows things that are quite different to be considered equal.

How about making an isBuildPlanBetter function?

This comment has been minimized.

Copy link
Owner Author

@harendra-kumar harendra-kumar replied Jan 27, 2016

I was having two minds when I did this but ultimately just chose this way. If you think about this data type as a test result measure then then this makes more sense. We perhaps would always want to compare this data type in terms of how good the match was rather than comparing it in the literal sense.

I don't mind using a separate function approach too if that looks clearer.


This comment has been minimized.

Copy link

@mgsloan mgsloan commented on 0c14ec4 Jan 27, 2016

I like this heuristic ^_^


This comment has been minimized.

Copy link

@mgsloan mgsloan commented on f569a16 Jan 27, 2016

Actually, happily this does not change CLI behavior. The order thing was fixed a long while back - commercialhaskell#519

This comment has been minimized.

Copy link
Owner Author

@harendra-kumar harendra-kumar replied Jan 27, 2016

Actually it did change the behavior and I fixed it via da82ce9 . There was a special case for stack init for fixing another problem due to conflict between global and local args.

This comment has been minimized.

Copy link

@mgsloan mgsloan replied Jan 27, 2016

Ah gotcha, nice!

Copy link

@mgsloan mgsloan commented Jan 27, 2016

Sorry for letting this languish so long! I've taken a look at the commits, and they look great. --solver --omit-packages does a fantastic job of producing a stack.yaml for a whole load of diagrams packages.

Since I only have a couple comments / tweaks, I'm going to go ahead and merge this and fix them myself.

mgsloan added a commit that referenced this pull request Jan 27, 2016
Stack init and solver finish up and doc update
@mgsloan mgsloan merged commit c29ca47 into commercialhaskell:master Jan 27, 2016
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
Copy link

@mgsloan mgsloan commented Jan 27, 2016

Pushed the following adjustments: 3dd473b 8703722

Copy link
Collaborator Author

@harendra-kumar harendra-kumar commented Jan 27, 2016

Thanks! Did you look at the doc changes?

Copy link

@mgsloan mgsloan commented Jan 27, 2016

Yup, I did! Also LGTM

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

Successfully merging this pull request may close these issues.

None yet

2 participants