Commit 325d363e authored by bardur.arantsson's avatar bardur.arantsson Committed by GitHub
Browse files

Merge pull request #4023 from ezyang/pr/T3978

Do an early check for unbuildable deps, and give good error.
parents 211776b1 18e82270
......@@ -130,7 +130,7 @@ import Distribution.Text
import qualified Distribution.Compat.Graph as Graph
import Distribution.Compat.Graph(IsNode(..))
import Text.PrettyPrint (text, (<+>))
import Text.PrettyPrint hiding ((<>))
import qualified Data.Map as Map
import Data.Set (Set)
import qualified Data.Set as Set
......@@ -1142,6 +1142,21 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
Map ComponentId FilePath),
ElaboratedConfiguredPackage)
buildComponent (cc_map, lc_map, exe_map) comp = do
-- Before we get too far, check if we depended on something
-- unbuildable. If we did, give a good error. (If we don't
-- check, the 'toConfiguredComponent' will assert fail, see #3978).
case unbuildable_external_lib_deps of
[] -> return ()
deps -> failProgress $
text "The package" <+> disp pkgid <+>
text "depends on unbuildable libraries:" <+>
hsep (punctuate comma (map (disp.solverSrcId) deps))
case unbuildable_external_exe_deps of
[] -> return ()
deps -> failProgress $
text "The package" <+> disp pkgid <+>
text "depends on unbuildable executables:" <+>
hsep (punctuate comma (map (disp.solverSrcId) deps))
infoProgress $ dispConfiguredComponent cc
let -- Use of invariant: DefUnitId indicates that if
-- there is no hash, it must have an empty
......@@ -1270,6 +1285,11 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
external_cc_map = Map.fromList (map mkPkgNameMapping external_lib_dep_pkgs)
external_lc_map = Map.fromList (map mkShapeMapping external_lib_dep_pkgs)
unbuildable_external_lib_deps =
filter (null . elaborateLibSolverId mapDep) external_lib_dep_sids
unbuildable_external_exe_deps =
filter (null . elaborateExeSolverId mapDep) external_exe_dep_sids
mkPkgNameMapping :: ElaboratedPlanPackage
-> (PackageName, (ComponentId, PackageId))
mkPkgNameMapping dpkg =
......
......@@ -134,6 +134,11 @@ Extra-Source-Files:
tests/IntegrationTests/new-build/T3460/sub-package-B/B.hs
tests/IntegrationTests/new-build/T3460/sub-package-B/Setup.hs
tests/IntegrationTests/new-build/T3460/sub-package-B/sub-package-B.cabal
tests/IntegrationTests/new-build/T3978.err
tests/IntegrationTests/new-build/T3978.sh
tests/IntegrationTests/new-build/T3978/cabal.project
tests/IntegrationTests/new-build/T3978/p/p.cabal
tests/IntegrationTests/new-build/T3978/q/q.cabal
tests/IntegrationTests/new-build/executable/Main.hs
tests/IntegrationTests/new-build/executable/Setup.hs
tests/IntegrationTests/new-build/executable/Test.hs
......
RE:^cabal(\.exe)?: The package q-1.0 depends on unbuildable libraries: p-1.0
. ./common.sh
cd T3978
! cabal new-build q
name: p
version: 1.0
build-type: Simple
cabal-version: >= 1.10
library
buildable: False
name: q
version: 1.0
build-type: Simple
cabal-version: >= 1.10
library
build-depends: p
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment