Skip to content

Commit 91e2323

Browse files
committed
Fix #6551 Use action getLatestApplicableVersionAndRev only when needed
1 parent 8211672 commit 91e2323

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Other enhancements:
2121

2222
Bug fixes:
2323

24+
* Fix a regression introduced in Stack 2.15.1 that caused a 'no operation'
25+
`stack build` to be slower than previously.
26+
2427
## v2.15.5 - 2024-03-28
2528

2629
Release notes:

src/Stack/Build/ConstructPlan.hs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,6 @@ processDep ::
835835
(Set PackageIdentifier, Map PackageIdentifier GhcPkgId, IsMutable)
836836
)
837837
processDep pkgId name value = do
838-
mLatestApplicable <- getLatestApplicableVersionAndRev name range
839838
eRes <- getCachedDepOrAddDep name
840839
case eRes of
841840
Left e -> do
@@ -848,22 +847,25 @@ processDep pkgId name value = do
848847
-- spamming the user too much
849848
DependencyPlanFailures _ _ ->
850849
Couldn'tResolveItsDependencies version
850+
mLatestApplicable <- getLatestApplicableVersionAndRev name range
851851
pure $ Left (name, (range, mLatestApplicable, bd))
852852
Right adr
853853
| isDepTypeLibrary value.depType && not (adrHasLibrary adr) ->
854854
pure $ Left (name, (range, Nothing, HasNoLibrary))
855855
Right adr -> do
856856
addParent
857857
inRange <- adrInRange pkgId name range adr
858-
pure $ if inRange
859-
then Right $ processAdr adr
860-
else Left
861-
( name
862-
, ( range
863-
, mLatestApplicable
864-
, DependencyMismatch $ adrVersion adr
858+
if inRange
859+
then pure $ Right $ processAdr adr
860+
else do
861+
mLatestApplicable <- getLatestApplicableVersionAndRev name range
862+
pure $ Left
863+
( name
864+
, ( range
865+
, mLatestApplicable
866+
, DependencyMismatch $ adrVersion adr
867+
)
865868
)
866-
)
867869
where
868870
range = value.versionRange
869871
version = pkgVersion pkgId

0 commit comments

Comments
 (0)