Skip to content

Commit 573f09b

Browse files
committed
only interpret explicitly requested packages
1 parent 5827ee7 commit 573f09b

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

  • lib/command/src/Obelisk/Command

lib/command/src/Obelisk/Command/Run.hs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -271,31 +271,9 @@ nixShellForInterpretPaths isPure shell' root interpretPaths cmd = do
271271

272272
-- | Like 'getLocalPkgs' but also parses them and fails if any of them can't be parsed.
273273
getParsedLocalPkgs :: MonadObelisk m => FilePath -> PathTree Interpret -> m (NonEmpty CabalPackageInfo)
274-
getParsedLocalPkgs root interpretPaths = do
275-
pkgs <- parsePackagesOrFail =<< getLocalPkgs root interpretPaths
276-
allLocalPkgs <- parsePackagesOrFail =<< getLocalPkgs root (pathToTree Interpret_Interpret root)
277-
pure $ expandLocalDeps pkgs allLocalPkgs
278-
279-
expandLocalDeps :: NE.NonEmpty CabalPackageInfo -> NE.NonEmpty CabalPackageInfo -> NE.NonEmpty CabalPackageInfo
280-
expandLocalDeps seeds allLocalPkgs =
281-
fromMaybe seeds $ NE.nonEmpty $ mapMaybe (`Map.lookup` allMap) $ Set.toList closureNames
282-
where
283-
allMap = Map.fromList (map (\p -> (_cabalPackageInfo_packageName p, p)) (toList allLocalPkgs))
284-
<> Map.fromList (map (\p -> (_cabalPackageInfo_packageName p, p)) (toList seeds))
285-
seedNames = Set.fromList $ map _cabalPackageInfo_packageName (toList seeds)
286-
closureNames = go seedNames (Set.toList seedNames)
287-
go seen [] = seen
288-
go seen (n:ns) =
289-
let deps = maybe [] localDeps (Map.lookup n allMap)
290-
newDeps = filter (\d -> not (Set.member d seen)) deps
291-
seen' = Set.union seen (Set.fromList newDeps)
292-
in go seen' (ns ++ newDeps)
293-
localDeps pkg =
294-
[ depName
295-
| dep <- _cabalPackageInfo_buildDepends pkg
296-
, let depName = T.pack (prettyShow (depPkgName dep))
297-
, Map.member depName allMap
298-
]
274+
getParsedLocalPkgs root interpretPaths =
275+
parsePackagesOrFail =<< getLocalPkgs root interpretPaths
276+
299277

300278
-- | Relative paths to local packages of an obelisk project.
301279
--

0 commit comments

Comments
 (0)