Commits (844)

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
Please include the following checklist in your PR:
* [ ] Patches conform to the [coding conventions](https://github.com/haskell/cabal/#conventions).
* [ ] Any changes that could be relevant to users have been recorded in the changelog.
* [ ] The documentation has been updated, if necessary.
* [ ] If the change is docs-only, `[ci skip]` is used to avoid triggering the build bots.
Please also shortly describe how you tested your change. Bonus points for added tests!
......@@ -14,6 +14,7 @@ dist
dist-*
register.sh
./cabal.config
cabal-tests.log
/Cabal/dist/
/Cabal/tests/Setup
......
......@@ -7,12 +7,12 @@
Adam Langley <agl@imperialviolet.org>
Alistair Bailey <alistair@abayley.org> alistair <alistair@abayley.org>
Alson Kemp <alson@alsonkemp.com> alson <alson@alsonkemp.com>
Andy Craze <accraze@gmail.com>
Andres Löh <andres.loeh@gmail.com>
Andres Löh <andres.loeh@gmail.com> <andres@cs.uu.nl>
Andres Löh <andres.loeh@gmail.com> <andres@well-typed.com>
Andres Löh <andres.loeh@gmail.com> <ksgithub@andres-loeh.de>
Andres Löh <andres.loeh@gmail.com> <mail@andres-loeh.de>
Andy Craze <accraze@gmail.com>
Audrey Tang <audreyt@audreyt.org> audreyt <audreyt@audreyt.org>
Austin Seipp <aseipp@pobox.com>
Austin Seipp <aseipp@pobox.com> <aseipp@well-typed.com>
......@@ -30,6 +30,7 @@ Bram Schuur <bramschuur@gmail.com>
Brendan Hay <brendan.g.hay@gmail.com> <brendanhay@users.noreply.github.com>
Brent Yorgey <byorgey@gmail.com> <byorgey@cis.upenn.edu>
Brian Smith <brianlsmith@gmail.com> brianlsmith <brianlsmith@gmail.com>
Daniel Wagner <daniel@wagner-home.com> <dmwit@galois.com>
David Himmelstrup <lemmih@gmail.com>
David Luposchainsky <dluposchainsky@gmail.com> <quchen@users.noreply.github.com>
David Waern <davve@dtek.chalmers.se> David Waern <unknown>
......@@ -45,6 +46,7 @@ Duncan Coutts <duncan@community.haskell.org> unknown <unkn
Edward Z. Yang <ezyang@cs.stanford.edu> <ezyang@mit.edu>
Einar Karttunen <ekarttun@cs.helsinki.fi>
Federico Mastellone <fmaste@users.noreply.github.com>
Francesco Gazzetta <francygazz@gmail.com> <fgaz@users.noreply.github.com>
Ganesh Sittampalam <ganesh.sittampalam@credit-suisse.com> <ganesh@earth.li>
Geoff Nixon <geoff-codes@users.noreply.github.com> <geoff.nixon@aol.com>
Gershom Bazerman <gershomb@gmail.com>
......@@ -71,18 +73,20 @@ Jens Petersen <juhpetersen@gmail.com> <petersen@red
Jeremy Shaw <jeremy.shaw@linspireinc.com>
Jeremy Shaw <jeremy.shaw@linspireinc.com> <jeremy@n-heptane.com>
Jim Burton <jim@sdf-eu.org>
Joel Bitrauser <jo.da@posteo.de> <bitrauser@users.noreply.github.com>
Joel Bitrauser <jo.da@posteo.de> Bitrauser <jo.da@posteo.de>
Joe Quinn <headprogrammingczar@gmail.com>
Joel Stanley <intractable@gmail.com>
Joeri van Eekelen <tchakkazulu@gmail.com>
John Ericson <Ericson2314@yahoo.com> <Ericson2314@Yahoo.con>
John Ericson <Ericson2314@yahoo.com> <jericson@galois.com>
John D. Ramsdell <ramsdell@mitre.org>
John Dias <dias@eecs.harvard.edu> dias <dias@eecs.harvard.edu>
John Ericson <Ericson2314@yahoo.com> <Ericson2314@Yahoo.con>
John Ericson <Ericson2314@yahoo.com> <jericson@galois.com>
Josh Hoyt <josh.hoyt@galois.com>
Judah Jacobson <judah.jacobson@gmail.com>
Jürgen Nicklisch-Franken <jnf@arcor.de>
Ken Bateman <novadenizen@gmail.com>
Keegan McAllister <mcallister.keegan@gmail.com> mcallister.keegan <mcallister.keegan@gmail.com>
Ken Bateman <novadenizen@gmail.com>
Kido Takahiro <shelarcy@gmail.com>
Krasimir Angelov <kr.angelov@gmail.com>
Krasimir Angelov <kr.angelov@gmail.com> ka2_mail <ka2_mail@yahoo.com>
......@@ -94,18 +98,19 @@ Malcolm Wallace <Malcolm.Wallace@me.com> Malcolm.Walla
Mark Weber <marco-oweber@gmx.de> marco-oweber <marco-oweber@gmx.de>
Martin Sjögren <msjogren@gmail.com> md9ms <md9ms@mdstud.chalmers.se>
Mikhail Glushenkov <mikhail.glushenkov@gmail.com> <c05mgv@cs.umu.se>
Mikhail Glushenkov <mikhail.glushenkov@gmail.com> <the.dead.shall.rise@gmail.com>
Mikhail Glushenkov <mikhail.glushenkov@gmail.com> <mikhail@scrive.com>
Mikhail Glushenkov <mikhail.glushenkov@gmail.com> <the.dead.shall.rise@gmail.com>
Neil Mitchell <ndmitchell@gmail.com> Neil Mitchell <unknown>
Niklas Broberg <niklas.broberg@gmail.com> <d00nibro@chalmers.se>
Niklas Broberg <niklas.broberg@gmail.com> <git@nand.wakku.to>
Peter Higley <phigley@gmail.com>
Peter Simons <simons@cryp.to>
Peter Trško <peter.trsko@gmail.com> Peter Trsko <peter.trsko@ixperta.com>
Philipp Schumann <philipp.schumann@gmail.com> metaleap <philipp.schumann@gmail.com>
Philipp Schuster <pschuster@uni-koblenz.de>
Randy Polen <randen@users.noreply.github.com>
Robert Henderson <rob@robjhen.com> <robjhen@users.noreply.github.com>
Robert Henderson <rob@robjhen.com> <rob at robjhen dot com>
Robert Henderson <rob@robjhen.com> <robjhen@users.noreply.github.com>
Ryan Scott <ryan.gl.scott@gmail.com> <ryan.gl.scott@ku.edu>
Samuel Gélineau <gelisam+github@gmail.com>
Sergei Trofimovich <slyfox@community.haskell.org> <slyfox@gentoo.org>
......
......@@ -2,6 +2,8 @@
# We specify language: c, so it doesn't default to e.g. ruby
language: c
dist: trusty
sudo: false
# Remember to add release branches
......@@ -9,6 +11,7 @@ sudo: false
branches:
only:
- master
- "2.0"
- "1.24"
- "1.22"
- "1.20"
......@@ -17,9 +20,13 @@ branches:
# The following enables several GHC versions to be tested; often it's enough to
# test only against the last release in a major GHC version. Feel free to omit
# lines listings versions you don't need/want testing for.
#
# NB: If you test the same GHC version/OS combo multiple times with
# SCRIPT=script (e.g., see PARSEC=YES below), you MUST supply a
# TAGSUFFIX to help travis/upload.sh disambiguate the matrix entry.
matrix:
include:
- env: GHCVER=8.0.1 SCRIPT=meta BUILDER=none
- env: GHCVER=8.2.1 SCRIPT=meta BUILDER=none
os: linux
sudo: required
# These don't have -dyn/-prof whitelisted yet, so we have to
......@@ -30,50 +37,48 @@ matrix:
- env: GHCVER=7.6.3 SCRIPT=script
os: linux
sudo: required
- env: GHCVER=7.8.4 SCRIPT=script
- env: GHCVER=7.8.4 SCRIPT=script USE_GOLD=YES
os: linux
sudo: required
# Ugh, we'd like to drop 'sudo: required' and use the
# apt plugin for the next two
# but the GCE instance we get has more memory, which makes
# a big difference
- env: GHCVER=7.10.3 SCRIPT=script
- env: GHCVER=7.10.3 SCRIPT=script USE_GOLD=YES
os: linux
sudo: required
- env: GHCVER=8.0.1 SCRIPT=script DEPLOY_DOCS=YES
- env: GHCVER=8.0.2 SCRIPT=script DEPLOY_DOCS=YES USE_GOLD=YES TEST_SOLVER_BENCHMARKS=YES
sudo: required
os: linux
- env: GHCVER=8.0.1 SCRIPT=solver-debug-flags
- env: GHCVER=8.0.2 SCRIPT=solver-debug-flags USE_GOLD=YES
sudo: required
os: linux
- env: GHCVER=8.0.1 SCRIPT=script PARSEC=YES
- env: GHCVER=8.0.2 SCRIPT=script DEBUG_EXPENSIVE_ASSERTIONS=YES TAGSUFFIX="-fdebug-expensive-assertions" USE_GOLD=YES
os: linux
sudo: required
- env: GHCVER=8.0.1 SCRIPT=bootstrap
- env: GHCVER=8.0.2 SCRIPT=bootstrap USE_GOLD=YES
sudo: required
os: linux
- env: GHCVER=8.2.1 SCRIPT=script
os: linux
sudo: required
# We axed GHC 7.6 and earlier because it's not worth the trouble to
# make older GHC work with clang's cpp. See
# https://ghc.haskell.org/trac/ghc/ticket/8493
- env: GHCVER=7.8.4 SCRIPT=script CABAL_LIB_ONLY=YES
- env: GHCVER=7.8.4 SCRIPT=script
os: osx
# Keep this synced with travis/upload.sh
osx_image: xcode6.4 # We need 10.10
- env: GHCVER=7.8.4 SCRIPT=script CABAL_INSTALL_ONLY=YES
os: osx
osx_image: xcode6.4
# TODO: We might want to specify OSX version
# https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
- env: GHCVER=7.10.3 SCRIPT=script CABAL_LIB_ONLY=YES
os: osx
- env: GHCVER=7.10.3 SCRIPT=script CABAL_INSTALL_ONLY=YES
os: osx
- env: GHCVER=8.0.1 SCRIPT=script CABAL_LIB_ONLY=YES
- env: GHCVER=7.10.3 SCRIPT=script
os: osx
- env: GHCVER=8.0.1 SCRIPT=script CABAL_INSTALL_ONLY=YES
- env: GHCVER=8.0.2 SCRIPT=script
os: osx
- env: GHCVER=8.0.1 SCRIPT=bootstrap
- env: GHCVER=8.0.2 SCRIPT=bootstrap
os: osx
- env: GHCVER=via-stack SCRIPT=stack STACKAGE_RESOLVER=lts
......@@ -97,17 +102,14 @@ before_install:
- export PATH=$HOME/bin:$PATH
- export PATH=$HOME/.cabal/bin:$PATH
- export PATH=$HOME/.local/bin:$PATH
- export PATH=/opt/cabal/1.24/bin:$PATH
- export PATH=/opt/cabal/2.0/bin:$PATH
- export PATH=/opt/happy/1.19.5/bin:$PATH
- export PATH=/opt/alex/3.1.7/bin:$PATH
- if [ "$USE_GOLD" = "YES" ]; then sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20; fi
- if [ "$USE_GOLD" = "YES" ]; then sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10; fi
- ld -v
- ./travis-install.sh
# Set up deployment to the haskell/cabal-website repo.
# NB: these commands MUST be in .travis.yml, otherwise the secret key can be
# leaked! See https://github.com/travis-ci/travis.rb/issues/423.
# umask to get the permissions to be 400.
- if [ "x$TRAVIS_REPO_SLUG" = "xhaskell/cabal" -a "x$TRAVIS_PULL_REQUEST" = "xfalse" -a "x$TRAVIS_BRANCH" = "xmaster" -a "x$DEPLOY_DOCS" = "xYES" ]; then (umask 377 && openssl aes-256-cbc -K $encrypted_edaf6551664d_key -iv $encrypted_edaf6551664d_iv -in id_rsa_cabal_website.aes256.enc -out ~/.ssh/id_rsa -d); fi
install:
# We intentionally do not install anything before trying to build Cabal because
# it should build with each supported GHC version out-of-the-box.
......@@ -117,7 +119,8 @@ install:
# ./dist/setup/setup here instead of cabal-install to avoid breakage when the
# build config format changed.
script:
- ./travis-${SCRIPT}.sh -j
- rm -rf dist-newstyle
- ./travis-${SCRIPT}.sh -j2
cache:
directories:
......@@ -137,10 +140,16 @@ cache:
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index*
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index*
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
# Deploy Haddocks to the haskell/cabal-website repo.
after_success:
# Set up deployment to the haskell/cabal-website repo.
# NB: these commands MUST be in .travis.yml, otherwise the secret key can be
# leaked! See https://github.com/travis-ci/travis.rb/issues/423.
# umask to get the permissions to be 600.
- if [ "x$TRAVIS_REPO_SLUG" = "xhaskell/cabal" -a "x$TRAVIS_PULL_REQUEST" = "xfalse" -a "x$TRAVIS_BRANCH" = "xmaster" -a "x$DEPLOY_DOCS" = "xYES" ]; then (umask 177 && openssl aes-256-cbc -K $encrypted_edaf6551664d_key -iv $encrypted_edaf6551664d_iv -in id_rsa_cabal_website.aes256.enc -out ~/.ssh/id_rsa -d); fi
- ./travis-deploy.sh
notifications:
......
......@@ -9,8 +9,10 @@ Albert Krewinkel <tarleb@moltkeplatz.de>
Alex Biehl <alexbiehl@gmail.com>
Alexander Kjeldaas <alexander.kjeldaas@gmail.com>
Alexander Vershilov <alexander.vershilov@gmail.com>
Alexei Pastuchov <alexei.pastuchov@telecolumbus.de>
Alistair Bailey <alistair@abayley.org>
Alson Kemp <alson@alsonkemp.com>
Amir Mohammad Saied <amirsaied@gmail.com>
Anders Kaseorg <andersk@mit.edu>
Andrea Vezzosi <sanzhiyan@gmail.com>
Andres Löh <andres.loeh@gmail.com>
......@@ -53,6 +55,7 @@ Chris Wong <lambda.fairy@gmail.com>
Christiaan Baaij <christiaan.baaij@gmail.com>
Clemens Fruhwirth <clemens@endorphin.org>
Clint Adams <clint@debian.org>
Colin Wahl <colin.t.wahl@gmail.com>
Conal Elliott <conal@conal.net>
Curtis Gagliardi <curtis@curtis.io>
Dan Burton <danburton.email@gmail.com>
......@@ -76,6 +79,7 @@ Dmitry Astapov <dastapov@gmail.com>
Dominic Steinitz <dominic@steinitz.org>
Don Stewart <dons00@gmail.com>
Doug Beardsley <mightybyte@gmail.com>
Douglas Wilson <douglas.wilson@gmail.com>
Duncan Coutts <duncan@community.haskell.org>
Echo Nolan <echo@echonolan.net>
Edsko de Vries <edsko@well-typed.com>
......@@ -92,6 +96,7 @@ Eyal Lotem <eyal.lotem@gmail.com>
Fabián Orccón <fabian.orccon@pucp.pe>
Federico Mastellone <fmaste@users.noreply.github.com>
Florian Hartwig <florian.j.hartwig@gmail.com>
Francesco Gazzetta <francygazz@gmail.com>
Franz Thoma <franz.thoma@tngtech.com>
Fujimura Daisuke <me@fujimuradaisuke.com>
Gabor Greif <ggreif@gmail.com>
......@@ -118,6 +123,7 @@ Ilya Smelkov <triplepointfive@gmail.com>
Isaac Potoczny-Jones <ijones@syntaxpolice.org>
Isamu Mogi <saturday6c@gmail.com>
Iustin Pop <iusty@k1024.org>
Ivan Lazar Miljenovic <Ivan.Miljenovic@gmail.com>
Iñaki García Etxebarria <garetxe@gmail.com>
JP Moresmau <jp@moresmau.fr>
Jacco Krijnen <jaccokrijnen@gmail.com>
......@@ -130,6 +136,7 @@ Jeremy Shaw <jeremy.shaw@linspireinc.com>
Jim Burton <jim@sdf-eu.org>
Joachim Breitner <mail@joachim-breitner.de>
Joe Quinn <headprogrammingczar@gmail.com>
Joel Bitrauser <jo.da@posteo.de>
Joel Stanley <intractable@gmail.com>
Joeri van Eekelen <tchakkazulu@gmail.com>
Johan Tibell <johan.tibell@gmail.com>
......@@ -188,6 +195,7 @@ Mikhail Glushenkov <mikhail.glushenkov@gmail.com>
Misty De Meo <mistydemeo@gmail.com>
Miëtek Bak <mietek@bak.io>
Mohit Agarwal <mohit@sdf.org>
Moritz Angermann <moritz.angermann@gmail.com>
Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Nathan Howell <nhowell@alphaheavy.com>
Neil Mitchell <ndmitchell@gmail.com>
......@@ -215,7 +223,9 @@ Peter Selinger <selinger@mathstat.dal.ca>
Peter Simons <simons@cryp.to>
Peter Trško <peter.trsko@gmail.com>
Phil Ruffwind <rf@rufflewind.com>
Philipp Schumann <philipp.schumann@gmail.com>
Philipp Schuster <pschuster@uni-koblenz.de>
Pranit Bauva <pranit.bauva@gmail.com>
Prayag Verma <prayag.verma@gmail.com>
Randy Polen <randen@users.noreply.github.com>
Reid Barton <rwbarton@gmail.com>
......@@ -247,8 +257,10 @@ Simon Meier <iridcode@gmail.com>
Simon Peyton Jones <simonpj@microsoft.com>
Spencer Janssen <sjanssen@cse.unl.edu>
Stephen Blackheath <stephen.blackheath@ipwnstudios.com>
Stuart Popejoy <spopejoy@panix.com>
Sven Panne <sven.panne@aedion.de>
Sönke Hahn <shahn@joyridelabs.de>
Tamar Christina <tamar@zhox.com>
Taru Karttunen <taruti@taruti.net>
Thomas Dziedzic <gostrc@gmail.com>
Thomas M. DuBuisson <thomas.dubuisson@gmail.com>
......
name: Cabal
version: 1.25.0.0
version: 2.1.0.0
copyright: 2003-2017, Cabal Development Team (see AUTHORS file)
license: BSD3
license-file: LICENSE
......@@ -32,6 +32,14 @@ extra-source-files:
-- Generated with 'misc/gen-extra-source-files.sh'
-- Do NOT edit this section manually; instead, run the script.
-- BEGIN gen-extra-source-files
tests/ParserTests/regressions/Octree-0.5.cabal
tests/ParserTests/regressions/elif.cabal
tests/ParserTests/regressions/elif2.cabal
tests/ParserTests/regressions/encoding-0.8.cabal
tests/ParserTests/regressions/generics-sop.cabal
tests/ParserTests/regressions/issue-774.cabal
tests/ParserTests/regressions/nothing-unicode.cabal
tests/ParserTests/regressions/shake.cabal
tests/ParserTests/warnings/bom.cabal
tests/ParserTests/warnings/bool.cabal
tests/ParserTests/warnings/deprecatedfield.cabal
......@@ -64,11 +72,6 @@ flag old-directory
description: Use directory < 1.2 and old-time
default: False
flag parsec
description: Use parsec parser
default: False
manual: True
flag parsec-struct-diff
description: Use StructDiff in parsec tests. Affects only parsec tests.
default: False
......@@ -83,15 +86,15 @@ library
deepseq >= 1.3 && < 1.5,
filepath >= 1.3 && < 1.5,
pretty >= 1.1 && < 1.2,
process >= 1.1.0.1 && < 1.5,
time >= 1.4 && < 1.8
process >= 1.1.0.1 && < 1.7,
time >= 1.4 && < 1.9
if flag(old-directory)
build-depends: directory >= 1.1 && < 1.2, old-time >= 1 && < 1.2,
process >= 1.0.1.1 && < 1.1.0.2
else
build-depends: directory >= 1.2 && < 1.4,
process >= 1.1.0.2 && < 1.5
process >= 1.1.0.2 && < 1.7
if flag(bundled-binary-generic)
build-depends: binary >= 0.5 && < 0.7
......@@ -108,7 +111,7 @@ library
if os(windows)
build-depends:
Win32 >= 2.2 && < 2.6
Win32 >= 2.2 && < 2.7
ghc-options: -Wall -fno-ignore-asserts -fwarn-tabs
if impl(ghc >= 8.0)
......@@ -120,10 +123,13 @@ library
Distribution.Backpack.Configure
Distribution.Backpack.ComponentsGraph
Distribution.Backpack.ConfiguredComponent
Distribution.Backpack.DescribeUnitId
Distribution.Backpack.FullUnitId
Distribution.Backpack.LinkedComponent
Distribution.Backpack.ModSubst
Distribution.Backpack.ModuleShape
Distribution.Backpack.PreModuleShape
Distribution.Utils.IOData
Distribution.Utils.LogProgress
Distribution.Utils.MapAccum
Distribution.Compat.CreatePipe
......@@ -132,6 +138,7 @@ library
Distribution.Compat.Graph
Distribution.Compat.Internal.TempFile
Distribution.Compat.Map.Strict
Distribution.Compat.Newtype
Distribution.Compat.Prelude.Internal
Distribution.Compat.ReadP
Distribution.Compat.Semigroup
......@@ -168,6 +175,7 @@ library
Distribution.Simple.GHC
Distribution.Simple.GHCJS
Distribution.Simple.Haddock
Distribution.Simple.Doctest
Distribution.Simple.HaskellSuite
Distribution.Simple.Hpc
Distribution.Simple.Install
......@@ -188,6 +196,7 @@ library
Distribution.Simple.Program.Hpc
Distribution.Simple.Program.Internal
Distribution.Simple.Program.Ld
Distribution.Simple.Program.ResponseFile
Distribution.Simple.Program.Run
Distribution.Simple.Program.Script
Distribution.Simple.Program.Strip
......@@ -205,6 +214,9 @@ library
Distribution.System
Distribution.TestSuite
Distribution.Text
Distribution.Pretty
Distribution.Types.AbiHash
Distribution.Types.AnnotatedId
Distribution.Types.Benchmark
Distribution.Types.BenchmarkInterface
Distribution.Types.BenchmarkType
......@@ -213,23 +225,33 @@ library
Distribution.Types.ComponentInclude
Distribution.Types.Dependency
Distribution.Types.ExeDependency
Distribution.Types.DependencyMap
Distribution.Types.LegacyExeDependency
Distribution.Types.PkgconfigDependency
Distribution.Types.DependencyMap
Distribution.Types.ComponentId
Distribution.Types.MungedPackageId
Distribution.Types.PackageId
Distribution.Types.UnitId
Distribution.Types.Executable
Distribution.Types.ExecutableScope
Distribution.Types.Library
Distribution.Types.ForeignLib
Distribution.Types.ForeignLibType
Distribution.Types.ForeignLibOption
Distribution.Types.Module
Distribution.Types.ModuleReexport
Distribution.Types.ModuleRenaming
Distribution.Types.ComponentName
Distribution.Types.MungedPackageName
Distribution.Types.PackageName
Distribution.Types.PkgconfigName
Distribution.Types.UnqualComponentName
Distribution.Types.IncludeRenaming
Distribution.Types.Mixin
Distribution.Types.SetupBuildInfo
Distribution.Types.TestSuite
Distribution.Types.TestSuiteInterface
Distribution.Types.TestType
Distribution.Types.ComponentName
Distribution.Types.GenericPackageDescription
Distribution.Types.Condition
Distribution.Types.CondTree
......@@ -241,7 +263,6 @@ library
Distribution.Types.LocalBuildInfo
Distribution.Types.ComponentRequestedSpec
Distribution.Types.TargetInfo
Distribution.Types.UnqualComponentName
Distribution.Utils.Generic
Distribution.Utils.NubList
Distribution.Utils.ShortText
......@@ -251,26 +272,45 @@ library
Language.Haskell.Extension
Distribution.Compat.Binary
if flag(parsec)
cpp-options: -DCABAL_PARSEC
build-depends:
transformers,
parsec >= 3.1.9 && <3.2
build-tools:
alex >=3.1.4 && <3.3
exposed-modules:
Distribution.Compat.Parsec
Distribution.PackageDescription.Parsec
Distribution.PackageDescription.Parsec.FieldDescr
Distribution.Parsec.Class
Distribution.Parsec.ConfVar
Distribution.Parsec.Lexer
Distribution.Parsec.LexerMonad
Distribution.Parsec.Parser
Distribution.Parsec.Types.Common
Distribution.Parsec.Types.Field
Distribution.Parsec.Types.FieldDescr
Distribution.Parsec.Types.ParseResult
-- Parsec parser relatedmodules
build-depends:
transformers,
mtl >= 2.1 && <2.3,
parsec >= 3.1.9 && <3.2
exposed-modules:
Distribution.Compat.Parsec
Distribution.FieldGrammar
Distribution.FieldGrammar.Class
Distribution.FieldGrammar.Parsec
Distribution.FieldGrammar.Pretty
Distribution.PackageDescription.FieldGrammar
Distribution.PackageDescription.Parsec
Distribution.PackageDescription.Quirks
Distribution.Parsec.Class
Distribution.Parsec.Common
Distribution.Parsec.ConfVar
Distribution.Parsec.Field
Distribution.Parsec.Lexer
Distribution.Parsec.LexerMonad
Distribution.Parsec.Newtypes
Distribution.Parsec.ParseResult
Distribution.Parsec.Parser
-- Lens functionality
exposed-modules:
Distribution.Compat.Lens
Distribution.Types.Lens
Distribution.Types.Benchmark.Lens
Distribution.Types.BuildInfo.Lens
Distribution.Types.Executable.Lens
Distribution.Types.ForeignLib.Lens
Distribution.Types.GenericPackageDescription.Lens
Distribution.Types.Library.Lens
Distribution.Types.PackageDescription.Lens
Distribution.Types.PackageId.Lens
Distribution.Types.SetupBuildInfo.Lens
Distribution.Types.SourceRepo.Lens
Distribution.Types.TestSuite.Lens
other-modules:
Distribution.Backpack.PreExistingComponent
......@@ -360,18 +400,16 @@ test-suite unit-tests
tasty-quickcheck,
tagged,
pretty,
QuickCheck >= 2.7 && < 2.10,
QuickCheck >= 2.7 && < 2.11,
Cabal
ghc-options: -Wall
default-language: Haskell2010
test-suite parser-tests
if !flag(parsec)
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: ParserTests.hs
build-depends: containers
build-depends:
base,
bytestring,
......@@ -379,20 +417,40 @@ test-suite parser-tests
tasty,
tasty-hunit,
tasty-quickcheck,
tasty-golden >=2.3.1.1 && <2.4,
Diff >=0.3.4 && <0.4,
Cabal
ghc-options: -Wall
default-language: Haskell2010
test-suite parser-hackage-tests
if !flag(parsec)
buildable: False
test-suite check-tests
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: CheckTests.hs
build-depends:
base,
bytestring,
filepath,
tasty,
tasty-golden >=2.3.1.1 && <2.4,
Diff >=0.3.4 && <0.4,
Cabal
ghc-options: -Wall
default-language: Haskell2010
test-suite parser-hackage-tests
type: exitcode-stdio-1.0
main-is: ParserHackageTests.hs
-- TODO: need to get 01-index.tar on appveyor
if os(windows)
buildable: False
hs-source-dirs: tests
build-depends:
base,
base-orphans == 0.6.*,
base-compat >=0.9.3 && <0.10,
containers,
tar >=0.5 && <0.6,
bytestring,
......@@ -402,7 +460,7 @@ test-suite parser-hackage-tests
if flag(parsec-struct-diff)
build-depends:
generics-sop ==0.2.*,
generics-sop >= 0.3.1.0 && <0.4,
these >=0.7.1 && <0.8,
singleton-bool >=0.1.1.0 && <0.2,
keys
......
......@@ -46,8 +46,10 @@ import qualified Text.PrettyPrint as Disp
import Text.PrettyPrint (hcat)
import Distribution.ModuleName
import Distribution.Package
import Distribution.Text
import Distribution.Types.ComponentId
import Distribution.Types.UnitId
import Distribution.Types.Module
import Distribution.Utils.Base62
import qualified Data.Map as Map
......
-- | See <https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst>
module Distribution.Backpack.ComponentsGraph (
ComponentsGraph,
dispComponentsGraph,
toComponentsGraph,
ComponentsWithDeps,
mkComponentsGraph,
componentsGraphToList,
dispComponentsWithDeps,
componentCycleMsg
) where
......@@ -14,9 +16,8 @@ import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.Simple.BuildToolDepends
import Distribution.Simple.LocalBuildInfo
import Distribution.Types.ComponentRequestedSpec
import Distribution.Types.Dependency
import Distribution.Types.UnqualComponentName
import Distribution.Compat.Graph (Node(..))
import Distribution.Compat.Graph (Graph, Node(..))
import qualified Distribution.Compat.Graph as Graph
import Distribution.Text
......@@ -27,31 +28,37 @@ import Text.PrettyPrint
-- Components graph
------------------------------------------------------------------------------
-- | A components graph is a source level graph tracking the
-- dependencies between components in a package.
type ComponentsGraph = [(Component, [ComponentName])]
-- | A graph of source-level components by their source-level
-- dependencies
--
type ComponentsGraph = Graph (Node ComponentName Component)
-- | Pretty-print a 'ComponentsGraph'.
dispComponentsGraph :: ComponentsGraph -> Doc
dispComponentsGraph graph =
-- | A list of components associated with the source level
-- dependencies between them.
--
type ComponentsWithDeps = [(Component, [ComponentName])]
-- | Pretty-print 'ComponentsWithDeps'.
--
dispComponentsWithDeps :: ComponentsWithDeps -> Doc
dispComponentsWithDeps graph =
vcat [ hang (text "component" <+> disp (componentName c)) 4
(vcat [ text "dependency" <+> disp cdep | cdep <- cdeps ])
| (c, cdeps) <- graph ]
-- | Given the package description and a 'PackageDescription' (used
-- to determine if a package name is internal or not), create a graph of
-- dependencies between the components. This is NOT necessarily the
-- build order (although it is in the absence of Backpack.)
toComponentsGraph :: ComponentRequestedSpec
-- | Create a 'Graph' of 'Component', or report a cycle if there is a
-- problem.
--
mkComponentsGraph :: ComponentRequestedSpec
-> PackageDescription
-> Either [ComponentName] ComponentsGraph
toComponentsGraph enabled pkg_descr =
mkComponentsGraph enabled pkg_descr =
let g = Graph.fromDistinctList
[ N c (componentName c) (componentDeps c)
| c <- pkgBuildableComponents pkg_descr
, componentEnabled enabled c ]
in case Graph.cycles g of
[] -> Right (map (\(N c _ cs) -> (c, cs)) (Graph.revTopSort g))
[] -> Right g
ccycles -> Left [ componentName c | N c _ _ <- concat ccycles ]
where
-- The dependencies for the given component
......@@ -70,6 +77,17 @@ toComponentsGraph enabled pkg_descr =
conv Nothing = packageNameToUnqualComponentName $ packageName pkg_descr
conv (Just s) = s
-- | Given the package description and a 'PackageDescription' (used
-- to determine if a package name is internal or not), sort the
-- components in dependency order (fewest dependencies first). This is
-- NOT necessarily the build order (although it is in the absence of
-- Backpack.)
--
componentsGraphToList :: ComponentsGraph
-> ComponentsWithDeps
componentsGraphToList =
map (\(N c _ cs) -> (c, cs)) . Graph.revTopSort
-- | Error message when there is a cycle; takes the SCC of components.
componentCycleMsg :: [ComponentName] -> Doc
componentCycleMsg cnames =
......
......@@ -25,6 +25,7 @@ import Distribution.Backpack.ConfiguredComponent
import Distribution.Backpack.LinkedComponent
import Distribution.Backpack.ReadyComponent
import Distribution.Backpack.ComponentsGraph
import Distribution.Backpack.Id
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Package
......@@ -37,12 +38,12 @@ import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.ModuleName
import Distribution.Simple.Setup as Setup
import Distribution.Simple.LocalBuildInfo
import Distribution.Types.AnnotatedId
import Distribution.Types.ComponentRequestedSpec
import Distribution.Types.ComponentInclude
import Distribution.Verbosity
import qualified Distribution.Compat.Graph as Graph
import Distribution.Compat.Graph (Graph, IsNode(..))
import Distribution.Utils.Progress
import Distribution.Utils.LogProgress
import Data.Either
......@@ -60,6 +61,7 @@ configureComponentLocalBuildInfos
:: Verbosity
-> Bool -- use_external_internal_deps
-> ComponentRequestedSpec
-> Bool -- deterministic
-> Flag String -- configIPID
-> Flag ComponentId -- configCID
-> PackageDescription
......@@ -70,22 +72,28 @@ configureComponentLocalBuildInfos
-> Compiler
-> LogProgress ([ComponentLocalBuildInfo], InstalledPackageIndex)
configureComponentLocalBuildInfos
verbosity use_external_internal_deps enabled ipid_flag cid_flag pkg_descr
verbosity use_external_internal_deps enabled deterministic ipid_flag cid_flag pkg_descr
prePkgDeps flagAssignment instantiate_with installedPackageSet comp = do
-- NB: In single component mode, this returns a *single* component.
-- In this graph, the graph is NOT closed.
graph0 <- case toComponentsGraph enabled pkg_descr of
Left ccycle -> failProgress (componentCycleMsg ccycle)
Right comps -> return comps
graph0 <- case mkComponentsGraph enabled pkg_descr of
Left ccycle -> dieProgress (componentCycleMsg ccycle)
Right g -> return (componentsGraphToList g)
infoProgress $ hang (text "Source component graph:") 4
(dispComponentsGraph graph0)
(dispComponentsWithDeps graph0)
let conf_pkg_map = Map.fromList
[(pc_pkgname pkg, (pc_cid pkg, pc_pkgid pkg))
let conf_pkg_map = Map.fromListWith Map.union
[(pc_pkgname pkg,
Map.singleton (pc_compname pkg)
(AnnotatedId {
ann_id = pc_cid pkg,
ann_pid = packageId pkg,
ann_cname = pc_compname pkg
}))
| pkg <- prePkgDeps]
graph1 = toConfiguredComponents use_external_internal_deps
graph1 <- toConfiguredComponents use_external_internal_deps
flagAssignment
ipid_flag cid_flag pkg_descr
deterministic ipid_flag cid_flag pkg_descr
conf_pkg_map (map fst graph0)
infoProgress $ hang (text "Configured component graph:") 4
(vcat (map dispConfiguredComponent graph1))
......@@ -107,9 +115,9 @@ configureComponentLocalBuildInfos
(vcat (map dispLinkedComponent graph2))
let pid_map = Map.fromList $
[ (pc_uid pkg, pc_pkgid pkg)
[ (pc_uid pkg, pc_munged_id pkg)
| pkg <- prePkgDeps] ++
[ (Installed.installedUnitId pkg, Installed.sourcePackageId pkg)
[ (Installed.installedUnitId pkg, mungedId pkg)
| (_, Module uid _) <- instantiate_with
, Just pkg <- [PackageIndex.lookupUnitId
installedPackageSet (unDefUnitId uid)] ]
......@@ -172,7 +180,7 @@ toComponentLocalBuildInfos
[] -> return ()
broken ->
-- TODO: ppr this
failProgress . text $
dieProgress . text $
"The following packages are broken because other"
++ " packages they depend on are missing. These broken "
++ "packages must be rebuilt before they can be used.\n"
......@@ -204,11 +212,9 @@ toComponentLocalBuildInfos
-- TODO: This is probably wrong for Backpack
let pseudoTopPkg :: InstalledPackageInfo
pseudoTopPkg = emptyInstalledPackageInfo {
Installed.installedUnitId =
mkLegacyUnitId (packageId pkg_descr),
Installed.installedUnitId = mkLegacyUnitId (packageId pkg_descr),
Installed.sourcePackageId = packageId pkg_descr,
Installed.depends =
map pc_uid externalPkgDeps
Installed.depends = map pc_uid externalPkgDeps
}
case PackageIndex.dependencyInconsistencies
. PackageIndex.insert pseudoTopPkg
......@@ -242,7 +248,7 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
isInternal x = Set.member x internalUnits
go rc =
case rc_component rc of
CLib _ ->
CLib lib ->
let convModuleExport (modname', (Module uid modname))
| this_uid == unDefUnitId uid
, modname' == modname
......@@ -270,6 +276,10 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
Left indefc -> [ (m, OpenModuleVar m) | m <- indefc_requires indefc ]
Right instc -> [ (m, OpenModule (DefiniteUnitId uid') m')
| (m, Module uid' m') <- instc_insts instc ]
compat_name = computeCompatPackageName (packageName rc) (libName lib)
compat_key = computeCompatPackageKey comp compat_name (packageVersion rc) this_uid
in LibComponentLocalBuildInfo {
componentPackageDeps = cpds,
componentUnitId = this_uid,
......@@ -278,12 +288,12 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
componentIsIndefinite_ = is_indefinite,
componentLocalName = cname,
componentInternalDeps = internal_deps,
componentExeDeps = map unDefUnitId (rc_internal_build_tools rc),
componentExeDeps = exe_deps,
componentIncludes = includes,
componentExposedModules = exports,
componentIsPublic = rc_public rc,
componentCompatPackageKey = rc_compat_key rc comp,
componentCompatPackageName = rc_compat_name rc
componentCompatPackageKey = compat_key,
componentCompatPackageName = compat_name
}
CFLib _ ->
FLibComponentLocalBuildInfo {
......@@ -291,7 +301,7 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
componentComponentId = this_cid,
componentLocalName = cname,
componentPackageDeps = cpds,
componentExeDeps = map unDefUnitId $ rc_internal_build_tools rc,
componentExeDeps = exe_deps,
componentInternalDeps = internal_deps,
componentIncludes = includes
}
......@@ -301,7 +311,7 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
componentComponentId = this_cid,
componentLocalName = cname,
componentPackageDeps = cpds,
componentExeDeps = map unDefUnitId $ rc_internal_build_tools rc,
componentExeDeps = exe_deps,
componentInternalDeps = internal_deps,
componentIncludes = includes
}
......@@ -311,7 +321,7 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
componentComponentId = this_cid,
componentLocalName = cname,
componentPackageDeps = cpds,
componentExeDeps = map unDefUnitId $ rc_internal_build_tools rc,
componentExeDeps = exe_deps,
componentInternalDeps = internal_deps,
componentIncludes = includes
}
......@@ -321,7 +331,7 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
componentComponentId = this_cid,
componentLocalName = cname,
componentPackageDeps = cpds,
componentExeDeps = map unDefUnitId $ rc_internal_build_tools rc,
componentExeDeps = exe_deps,
componentInternalDeps = internal_deps,
componentIncludes = includes
}
......@@ -331,6 +341,7 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
this_cid = rc_cid rc
cname = componentName (rc_component rc)
cpds = rc_depends rc
exe_deps = map ann_id $ rc_exe_deps rc
is_indefinite =
case rc_i rc of
Left _ -> True
......@@ -341,10 +352,6 @@ mkLinkedComponentsLocalBuildInfo comp rcs = map go rcs
Left indefc ->
indefc_includes indefc
Right instc ->
map (\ci -> ci { ci_id = DefiniteUnitId (ci_id ci) })
map (\ci -> ci { ci_ann_id = fmap DefiniteUnitId (ci_ann_id ci) })
(instc_includes instc)
internal_deps =
filter isInternal (nodeNeighbors rc)
++ map unDefUnitId (rc_internal_build_tools rc)
internal_deps = filter isInternal (nodeNeighbors rc)
......@@ -2,6 +2,9 @@
-- | See <https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst>
module Distribution.Backpack.ConfiguredComponent (
ConfiguredComponent(..),
cc_name,
cc_cid,
cc_pkgid,
toConfiguredComponent,
toConfiguredComponents,
dispConfiguredComponent,
......@@ -18,9 +21,15 @@ import Distribution.Compat.Prelude hiding ((<>))
import Distribution.Backpack.Id
import Distribution.Types.AnnotatedId
import Distribution.Types.Dependency
import Distribution.Types.ExeDependency
import Distribution.Types.IncludeRenaming
import Distribution.Types.ComponentId
import Distribution.Types.PackageId
import Distribution.Types.PackageName
import Distribution.Types.Mixin
import Distribution.Types.ComponentName
import Distribution.Types.UnqualComponentName
import Distribution.Types.ComponentInclude
import Distribution.Package
......@@ -29,11 +38,12 @@ import Distribution.Simple.BuildToolDepends
import Distribution.Simple.Setup as Setup
import Distribution.Simple.LocalBuildInfo
import Distribution.Version
import Distribution.Utils.LogProgress
import Distribution.Utils.MapAccum
import Control.Monad
import qualified Data.Set as Set
import qualified Data.Map as Map
import Data.Traversable
( mapAccumL )
import Distribution.Text
import Text.PrettyPrint
......@@ -41,10 +51,8 @@ import Text.PrettyPrint
-- and the 'ComponentId's of the things it depends on.
data ConfiguredComponent
= ConfiguredComponent {
-- | Uniquely identifies a configured component.
cc_cid :: ComponentId,
-- | The package this component came from.
cc_pkgid :: PackageId,
-- | Unique identifier of component, plus extra useful info.
cc_ann_id :: AnnotatedId ComponentId,
-- | The fragment of syntax from the Cabal file describing this
-- component.
cc_component :: Component,
......@@ -54,8 +62,9 @@ data ConfiguredComponent
-- Note that in one-component configure mode, this is
-- always True, because any component is the "public" one.)
cc_public :: Bool,
-- | Dependencies on internal executables from @build-tools@.
cc_internal_build_tools :: [ComponentId],
-- | Dependencies on executables from @build-tools@ and
-- @build-tool-depends@.
cc_exe_deps :: [AnnotatedId ComponentId],
-- | The mixins of this package, including both explicit (from
-- the @mixins@ field) and implicit (from @build-depends@). Not
-- mix-in linked yet; component configuration only looks at
......@@ -63,11 +72,20 @@ data ConfiguredComponent
cc_includes :: [ComponentInclude ComponentId IncludeRenaming]
}
-- | Uniquely identifies a configured component.
cc_cid :: ConfiguredComponent -> ComponentId
cc_cid = ann_id . cc_ann_id
-- | The package this component came from.
cc_pkgid :: ConfiguredComponent -> PackageId
cc_pkgid = ann_pid . cc_ann_id
-- | The 'ComponentName' of a component; this uniquely identifies
-- a fragment of syntax within a specified Cabal file describing the
-- component.
cc_name :: ConfiguredComponent -> ComponentName
cc_name = componentName . cc_component
cc_name = ann_cname . cc_ann_id
-- | Pretty-print a 'ConfiguredComponent'.
dispConfiguredComponent :: ConfiguredComponent -> Doc
......@@ -81,96 +99,108 @@ dispConfiguredComponent cc =
-- and library/executable dependencies are known. The primary
-- work this does is handling implicit @backpack-include@ fields.
mkConfiguredComponent
:: PackageId
:: PackageDescription
-> ComponentId
-> [(PackageName, (ComponentId, PackageId))]
-> [ComponentId]
-> [AnnotatedId ComponentId] -- lib deps
-> [AnnotatedId ComponentId] -- exe deps
-> Component
-> ConfiguredComponent
mkConfiguredComponent this_pid this_cid lib_deps exe_deps component =
ConfiguredComponent {
cc_cid = this_cid,
cc_pkgid = this_pid,
cc_component = component,
cc_public = is_public,
cc_internal_build_tools = exe_deps,
cc_includes = explicit_includes ++ implicit_includes
}
where
bi = componentBuildInfo component
deps = map snd lib_deps
deps_map = Map.fromList lib_deps
-- Resolve each @backpack-include@ into the actual dependency
-> LogProgress ConfiguredComponent
mkConfiguredComponent pkg_descr this_cid lib_deps exe_deps component = do
-- Resolve each @mixins@ into the actual dependency
-- from @lib_deps@.
explicit_includes
= [ let (cid, pid) =
case Map.lookup name deps_map of
Nothing ->
error $ "Mix-in refers to non-existent package " ++ display name ++
" (did you forget to add the package to build-depends?)"
Just r -> r
in ComponentInclude {
ci_id = cid,
-- TODO: Check what breaks if you remove this edit
ci_pkgid = pid { pkgName = name },
ci_renaming = rns
}
| Mixin name rns <- mixins bi ]
explicit_includes <- forM (mixins bi) $ \(Mixin name rns) -> do
let keys = fixFakePkgName pkg_descr name
aid <- case Map.lookup keys deps_map of
Nothing ->
dieProgress $
text "Mix-in refers to non-existent package" <+>
quotes (disp name) $$
text "(did you forget to add the package to build-depends?)"
Just r -> return r
return ComponentInclude {
ci_ann_id = aid,
ci_renaming = rns,
ci_implicit = False
}
-- Any @build-depends@ which is not explicitly mentioned in
-- @backpack-include@ is converted into an "implicit" include.
used_explicitly = Set.fromList (map ci_id explicit_includes)
implicit_includes
= map (\(cid, pid) -> ComponentInclude {
ci_id = cid,
ci_pkgid = pid,
ci_renaming = defaultIncludeRenaming
})
$ filter (flip Set.notMember used_explicitly . fst) deps
-- Any @build-depends@ which is not explicitly mentioned in
-- @backpack-include@ is converted into an "implicit" include.
let used_explicitly = Set.fromList (map ci_id explicit_includes)
implicit_includes
= map (\aid -> ComponentInclude {
ci_ann_id = aid,
ci_renaming = defaultIncludeRenaming,
ci_implicit = True
})
$ filter (flip Set.notMember used_explicitly . ann_id) lib_deps
return ConfiguredComponent {
cc_ann_id = AnnotatedId {
ann_id = this_cid,
ann_pid = package pkg_descr,
ann_cname = componentName component
},
cc_component = component,
cc_public = is_public,
cc_exe_deps = exe_deps,
cc_includes = explicit_includes ++ implicit_includes
}
where
bi = componentBuildInfo component
deps_map = Map.fromList [ ((packageName dep, ann_cname dep), dep)
| dep <- lib_deps ]
is_public = componentName component == CLibName
type ConfiguredComponentMap =
(Map PackageName (ComponentId, PackageId), -- libraries
Map UnqualComponentName ComponentId) -- executables
-- Executable map must be different because an executable can
-- have the same name as a library. Ew.
Map PackageName (Map ComponentName (AnnotatedId ComponentId))
-- | Given some ambient environment of package names that
-- are "in scope", looks at the 'BuildInfo' to decide
-- what the packages actually resolve to, and then builds
-- a 'ConfiguredComponent'.
toConfiguredComponent
:: PackageDescription
-> ComponentId
-> Map PackageName (ComponentId, PackageId) -- external
-> ConfiguredComponentMap
-> Component
-> ConfiguredComponent
toConfiguredComponent pkg_descr this_cid
external_lib_map (lib_map, exe_map) component =
-> LogProgress ConfiguredComponent
toConfiguredComponent pkg_descr this_cid dep_map component = do
lib_deps <-
if newPackageDepsBehaviour pkg_descr
then forM (targetBuildDepends bi) $ \(Dependency name _) -> do
let (pn, cn) = fixFakePkgName pkg_descr name
value <- case Map.lookup cn =<< Map.lookup pn dep_map of
Nothing ->
dieProgress $
text "Dependency on unbuildable" <+>
text (showComponentName cn) <+>
text "from" <+> disp pn
Just v -> return v
return value
else return old_style_lib_deps
mkConfiguredComponent
(package pkg_descr) this_cid
pkg_descr this_cid
lib_deps exe_deps component
where
bi = componentBuildInfo component
find_it :: PackageName -> (ComponentId, PackageId)
find_it name =
fromMaybe (error ("toConfiguredComponent: " ++ display (packageName pkg_descr) ++
" " ++ display name)) $
Map.lookup name lib_map <|>
Map.lookup name external_lib_map
lib_deps
| newPackageDepsBehaviour pkg_descr
= [ (name, find_it name)
| Dependency name _ <- targetBuildDepends bi ]
| otherwise
= Map.toList external_lib_map
exe_deps = [ cid
| toolName <- getAllInternalToolDependencies pkg_descr bi
, Just cid <- [ Map.lookup toolName exe_map ] ]
-- dep_map contains a mix of internal and external deps.
-- We want all the public libraries (dep_cn == CLibName)
-- of all external deps (dep /= pn). Note that this
-- excludes the public library of the current package:
-- this is not supported by old-style deps behavior
-- because it would imply a cyclic dependency for the
-- library itself.
old_style_lib_deps = [ e
| (pn, comp_map) <- Map.toList dep_map
, pn /= packageName pkg_descr
, (cn, e) <- Map.toList comp_map
, cn == CLibName ]
exe_deps =
[ exe
| ExeDependency pn cn _ <- getAllToolDependencies pkg_descr bi
-- The error suppression here is important, because in general
-- we won't know about external dependencies (e.g., 'happy')
-- which the package is attempting to use (those deps are only
-- fed in when cabal-install uses this codepath.)
-- TODO: Let cabal-install request errors here
, Just exe <- [Map.lookup (CExeName cn) =<< Map.lookup pn dep_map]
]
-- | Also computes the 'ComponentId', and sets cc_public if necessary.
-- This is Cabal-only; cabal-install won't use this.
......@@ -178,47 +208,36 @@ toConfiguredComponent'
:: Bool -- use_external_internal_deps
-> FlagAssignment
-> PackageDescription
-> Bool -- deterministic
-> Flag String -- configIPID (todo: remove me)
-> Flag ComponentId -- configCID
-> Map PackageName (ComponentId, PackageId) -- external
-> ConfiguredComponentMap
-> Component
-> ConfiguredComponent
-> LogProgress ConfiguredComponent
toConfiguredComponent' use_external_internal_deps flags
pkg_descr ipid_flag cid_flag
external_lib_map (lib_map, exe_map) component =
let cc = toConfiguredComponent
pkg_descr deterministic ipid_flag cid_flag
dep_map component = do
cc <- toConfiguredComponent
pkg_descr this_cid
external_lib_map (lib_map, exe_map) component
in if use_external_internal_deps
then cc { cc_public = True }
else cc
dep_map component
return $ if use_external_internal_deps
then cc { cc_public = True }
else cc
where
this_cid = computeComponentId ipid_flag cid_flag (package pkg_descr)
-- TODO: pass component names to it too!
this_cid = computeComponentId deterministic ipid_flag cid_flag (package pkg_descr)
(componentName component) (Just (deps, flags))
deps = [ cid | (cid, _) <- Map.elems external_lib_map ]
deps = [ ann_id aid | m <- Map.elems dep_map
, aid <- Map.elems m ]
extendConfiguredComponentMap
:: ConfiguredComponent
-> ConfiguredComponentMap
-> ConfiguredComponentMap
extendConfiguredComponentMap cc (lib_map, exe_map) =
(lib_map', exe_map')
where
lib_map'
= case cc_name cc of
CLibName ->
Map.insert (pkgName (cc_pkgid cc))
(cc_cid cc, cc_pkgid cc) lib_map
CSubLibName str ->
Map.insert (unqualComponentNameToPackageName str)
(cc_cid cc, cc_pkgid cc) lib_map
_ -> lib_map
exe_map'
= case cc_name cc of
CExeName str ->
Map.insert str (cc_cid cc) exe_map
_ -> exe_map
extendConfiguredComponentMap cc =
Map.insertWith Map.union
(pkgName (cc_pkgid cc))
(Map.singleton (cc_name cc) (cc_ann_id cc))
-- Compute the 'ComponentId's for a graph of 'Component's. The
-- list of internal components must be topologically sorted
......@@ -227,22 +246,24 @@ extendConfiguredComponentMap cc (lib_map, exe_map) =
toConfiguredComponents
:: Bool -- use_external_internal_deps
-> FlagAssignment
-> Bool -- deterministic
-> Flag String -- configIPID
-> Flag ComponentId -- configCID
-> PackageDescription
-> Map PackageName (ComponentId, PackageId)
-> ConfiguredComponentMap
-> [Component]
-> [ConfiguredComponent]
-> LogProgress [ConfiguredComponent]
toConfiguredComponents
use_external_internal_deps flags ipid_flag cid_flag pkg_descr
external_lib_map comps
= snd (mapAccumL go (Map.empty, Map.empty) comps)
use_external_internal_deps flags deterministic ipid_flag cid_flag pkg_descr
dep_map comps
= fmap snd (mapAccumM go dep_map comps)
where
go m component = (extendConfiguredComponentMap cc m, cc)
where cc = toConfiguredComponent'
use_external_internal_deps flags pkg_descr ipid_flag cid_flag
external_lib_map m component
go m component = do
cc <- toConfiguredComponent'
use_external_internal_deps flags pkg_descr
deterministic ipid_flag cid_flag
m component
return (extendConfiguredComponentMap cc m, cc)
newPackageDepsBehaviourMinVersion :: Version
newPackageDepsBehaviourMinVersion = mkVersion [1,7,1]
......@@ -256,3 +277,16 @@ newPackageDepsBehaviourMinVersion = mkVersion [1,7,1]
newPackageDepsBehaviour :: PackageDescription -> Bool
newPackageDepsBehaviour pkg =
specVersion pkg >= newPackageDepsBehaviourMinVersion
-- | 'build-depends:' stanzas are currently ambiguous as the external packages
-- and internal libraries are specified the same. For now, we assume internal
-- libraries shadow, and this function disambiguates accordingly, but soon the
-- underlying ambiguity will be addressed.
fixFakePkgName :: PackageDescription -> PackageName -> (PackageName, ComponentName)
fixFakePkgName pkg_descr pn =
if subLibName `elem` internalLibraries
then (packageName pkg_descr, CSubLibName subLibName)
else (pn, CLibName)
where
subLibName = packageNameToUnqualComponentName pn
internalLibraries = mapMaybe libName (allLibraries pkg_descr)
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE FlexibleContexts #-}
module Distribution.Backpack.DescribeUnitId where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Types.PackageId
import Distribution.Types.ComponentName
import Distribution.Compat.Stack
import Distribution.Verbosity
import Distribution.ModuleName
import Distribution.Text
import Distribution.Simple.Utils
import Text.PrettyPrint
-- Unit identifiers have a well defined, machine-readable format,
-- but this format isn't very user-friendly for users. This
-- module defines some functions for solving common rendering
-- problems one has for displaying these.
--
-- There are three basic problems we tackle:
--
-- - Users don't want to see pkg-0.5-inplace-libname,
-- they want to see "library 'libname' from 'pkg-0.5'"
--
-- - Users don't want to see the raw component identifier, which
-- usually contains a wordy hash that doesn't matter.
--
-- - Users don't want to see a hash of the instantiation: they
-- want to see the actual instantiation, and they want it in
-- interpretable form.
--
-- | Print a Setup message stating (1) what operation we are doing,
-- for (2) which component (with enough details to uniquely identify
-- the build in question.)
--
setupMessage' :: Text a => Verbosity
-> String -- ^ Operation being done (capitalized), on:
-> PackageIdentifier -- ^ Package
-> ComponentName -- ^ Component name
-> Maybe [(ModuleName, a)] -- ^ Instantiation, if available.
-- Polymorphic to take
-- 'OpenModule' or 'Module'
-> IO ()
setupMessage' verbosity msg pkgid cname mb_insts = withFrozenCallStack $ do
noticeDoc verbosity $
case mb_insts of
Just insts | not (null insts) ->
hang (msg_doc <+> text "instantiated with") 2
(vcat [ disp k <+> text "=" <+> disp v
| (k,v) <- insts ]) $$
for_doc
_ ->
msg_doc <+> for_doc
where
msg_doc = text msg <+> text (showComponentName cname)
for_doc = text "for" <+> disp pkgid <<>> text ".."
......@@ -7,7 +7,7 @@ module Distribution.Backpack.FullUnitId (
) where
import Distribution.Backpack
import Distribution.Package
import Distribution.Types.ComponentId
import Distribution.Compat.Prelude
-- Unlike OpenUnitId, which could direct to a UnitId.
......
......@@ -13,11 +13,14 @@ import Distribution.Compat.Prelude
import Distribution.Types.UnqualComponentName
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Package
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.Simple.Setup as Setup
import qualified Distribution.Simple.InstallDirs as InstallDirs
import Distribution.Simple.LocalBuildInfo
import Distribution.Types.ComponentId
import Distribution.Types.PackageId
import Distribution.Types.UnitId
import Distribution.Types.MungedPackageName
import Distribution.Utils.Base62
import Distribution.Version
......@@ -28,14 +31,15 @@ import Distribution.Text
-- for a package. The intent is that cabal-install (or the user) will
-- specify a more detailed IPID via the @--ipid@ flag if necessary.
computeComponentId
:: Flag String
:: Bool -- deterministic mode
-> Flag String
-> Flag ComponentId
-> PackageIdentifier
-> ComponentName
-- This is used by cabal-install's legacy codepath
-> Maybe ([ComponentId], FlagAssignment)
-> ComponentId
computeComponentId mb_ipid mb_cid pid cname mb_details =
computeComponentId deterministic mb_ipid mb_cid pid cname mb_details =
-- show is found to be faster than intercalate and then replacement of
-- special character used in intercalating. We cannot simply hash by
-- doubly concating list, as it just flatten out the nested list, so
......@@ -58,7 +62,8 @@ computeComponentId mb_ipid mb_cid pid cname mb_details =
where env = packageTemplateEnv pid (mkUnitId "")
actual_base = case mb_ipid of
Flag ipid0 -> explicit_base ipid0
NoFlag -> generated_base
NoFlag | deterministic -> display pid
| otherwise -> generated_base
in case mb_cid of
Flag cid -> cid
NoFlag -> mkComponentId $ actual_base
......@@ -66,55 +71,6 @@ computeComponentId mb_ipid mb_cid pid cname mb_details =
Nothing -> ""
Just s -> "-" ++ unUnqualComponentName s)
-- | Computes the package name for a library. If this is the public
-- library, it will just be the original package name; otherwise,
-- it will be a munged package name recording the original package
-- name as well as the name of the internal library.
--
-- A lot of tooling in the Haskell ecosystem assumes that if something
-- is installed to the package database with the package name 'foo',
-- then it actually is an entry for the (only public) library in package
-- 'foo'. With internal packages, this is not necessarily true:
-- a public library as well as arbitrarily many internal libraries may
-- come from the same package. To prevent tools from getting confused
-- in this case, the package name of these internal libraries is munged
-- so that they do not conflict the public library proper. A particular
-- case where this matters is ghc-pkg: if we don't munge the package
-- name, the inplace registration will OVERRIDE a different internal
-- library.
--
-- We munge into a reserved namespace, "z-", and encode both the
-- component name and the package name of an internal library using the
-- following format:
--
-- compat-pkg-name ::= "z-" package-name "-z-" library-name
--
-- where package-name and library-name have "-" ( "z" + ) "-"
-- segments encoded by adding an extra "z".
--
-- When we have the public library, the compat-pkg-name is just the
-- package-name, no surprises there!
--
computeCompatPackageName :: PackageName -> ComponentName -> PackageName
-- First handle the cases where we can just use the original 'PackageName'.
-- This is for the PRIMARY library, and it is non-Backpack, or the
-- indefinite package for us.
computeCompatPackageName pkg_name CLibName = pkg_name
computeCompatPackageName pkg_name cname
= mkPackageName $ "z-" ++ zdashcode (display pkg_name)
++ (case componentNameString cname of
Just cname_u -> "-z-" ++ zdashcode cname_str
where cname_str = unUnqualComponentName cname_u
Nothing -> "")
zdashcode :: String -> String
zdashcode s = go s (Nothing :: Maybe Int) []
where go [] _ r = reverse r
go ('-':z) (Just n) r | n > 0 = go z (Just 0) ('-':'z':r)
go ('-':z) _ r = go z (Just 0) ('-':r)
go ('z':z) (Just n) r = go z (Just (n+1)) ('z':r)
go (c:z) _ r = go z Nothing (c:r)
-- | In GHC 8.0, the string we pass to GHC to use for symbol
-- names for a package can be an arbitrary, IPID-compatible string.
-- However, prior to GHC 8.0 there are some restrictions on what
......@@ -164,7 +120,7 @@ zdashcode s = go s (Nothing :: Maybe Int) []
--
computeCompatPackageKey
:: Compiler
-> PackageName
-> MungedPackageName
-> Version
-> UnitId
-> String
......