@@ -332,7 +332,7 @@ mkUnregisterLocal tasks dirtyReason localDumpPkgs sourceMap initialBuildSteps =
332332-- step.
333333addFinal :: LocalPackage -> Package -> Bool -> M ()
334334addFinal lp package isAllInOne = do
335- depsRes <- addPackageDeps package
335+ depsRes <- addPackageDeps False package
336336 res <- case depsRes of
337337 Left e -> return $ Left e
338338 Right (missing, present, _minLoc) -> do
@@ -402,10 +402,10 @@ addDep treatAsDep' name = do
402402 return $ Right $ ADRFound loc installed
403403 Just (PIOnlySource ps) -> do
404404 tellExecutables ps
405- installPackage name ps Nothing
405+ installPackage treatAsDep name ps Nothing
406406 Just (PIBoth ps installed) -> do
407407 tellExecutables ps
408- installPackage name ps (Just installed)
408+ installPackage treatAsDep name ps (Just installed)
409409 updateLibMap name res
410410 return res
411411
@@ -450,30 +450,30 @@ tellExecutablesPackage loc p = do
450450
451451-- | Given a 'PackageSource' and perhaps an 'Installed' value, adds
452452-- build 'Task's for the package and its dependencies.
453- installPackage
454- :: PackageName
455- -> PackageSource
456- -> Maybe Installed
457- -> M (Either ConstructPlanException AddDepRes )
458- installPackage name ps minstalled = do
453+ installPackage :: Bool -- ^ is this being used by a dependency?
454+ -> PackageName
455+ -> PackageSource
456+ -> Maybe Installed
457+ -> M (Either ConstructPlanException AddDepRes )
458+ installPackage treatAsDep name ps minstalled = do
459459 ctx <- ask
460460 case ps of
461461 PSIndex _ flags ghcOptions pkgLoc -> do
462462 planDebug $ " installPackage: Doing all-in-one build for upstream package " ++ show name
463463 package <- liftIO $ loadPackage ctx (PLIndex pkgLoc) flags ghcOptions -- FIXME be more efficient! Get this from the LoadedPackageInfo!
464- resolveDepsAndInstall True ps package minstalled
464+ resolveDepsAndInstall True treatAsDep ps package minstalled
465465 PSFiles lp _ ->
466466 case lpTestBench lp of
467467 Nothing -> do
468468 planDebug $ " installPackage: No test / bench component for " ++ show name ++ " so doing an all-in-one build."
469- resolveDepsAndInstall True ps (lpPackage lp) minstalled
469+ resolveDepsAndInstall True treatAsDep ps (lpPackage lp) minstalled
470470 Just tb -> do
471471 -- Attempt to find a plan which performs an all-in-one
472472 -- build. Ignore the writer action + reset the state if
473473 -- it fails.
474474 s <- get
475475 res <- pass $ do
476- res <- addPackageDeps tb
476+ res <- addPackageDeps treatAsDep tb
477477 let writerFunc w = case res of
478478 Left _ -> mempty
479479 _ -> w
@@ -494,7 +494,7 @@ installPackage name ps minstalled = do
494494 put s
495495 -- Otherwise, fall back on building the
496496 -- tests / benchmarks in a separate step.
497- res' <- resolveDepsAndInstall False ps (lpPackage lp) minstalled
497+ res' <- resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
498498 when (isRight res') $ do
499499 -- Insert it into the map so that it's
500500 -- available for addFinal.
@@ -503,12 +503,13 @@ installPackage name ps minstalled = do
503503 return res'
504504
505505resolveDepsAndInstall :: Bool
506+ -> Bool
506507 -> PackageSource
507508 -> Package
508509 -> Maybe Installed
509510 -> M (Either ConstructPlanException AddDepRes )
510- resolveDepsAndInstall isAllInOne ps package minstalled = do
511- res <- addPackageDeps package
511+ resolveDepsAndInstall isAllInOne treatAsDep ps package minstalled = do
512+ res <- addPackageDeps treatAsDep package
512513 case res of
513514 Left err -> return $ Left err
514515 Right deps -> liftM Right $ installPackageGivenDeps isAllInOne ps package minstalled deps
@@ -586,12 +587,13 @@ addEllipsis t
586587-- then the parent package must be installed locally. Otherwise, if it
587588-- is 'Snap', then it can either be installed locally or in the
588589-- snapshot.
589- addPackageDeps :: Package -> M (Either ConstructPlanException (Set PackageIdentifier , Map PackageIdentifier GhcPkgId , InstallLocation ))
590- addPackageDeps package = do
590+ addPackageDeps :: Bool -- ^ is this being used by a dependency?
591+ -> Package -> M (Either ConstructPlanException (Set PackageIdentifier , Map PackageIdentifier GhcPkgId , InstallLocation ))
592+ addPackageDeps treatAsDep package = do
591593 ctx <- ask
592594 deps' <- packageDepsWithTools package
593595 deps <- forM (Map. toList deps') $ \ (depname, range) -> do
594- eres <- addDep True depname
596+ eres <- addDep treatAsDep depname
595597 let getLatestApplicable = do
596598 vs <- liftIO $ getVersions ctx depname
597599 return (latestApplicableVersion range vs)
0 commit comments