Skip to content

Commit

Permalink
Merge pull request #6552 from commercialhaskell/fix6551
Browse files Browse the repository at this point in the history
Fix #6551 Use action `getLatestApplicableVersionAndRev` only when needed
  • Loading branch information
mpilgrem authored Apr 6, 2024
2 parents afc4afa + 182937f commit 80e2994
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Bug fixes:

* The `config set snapshot` and `config set resolver` commands now respect the
presence of a synoymous key.
* Fix a regression introduced in Stack 2.15.1 that caused a 'no operation'
`stack build` to be slower than previously.

## v2.15.5 - 2024-03-28

Expand Down
11 changes: 6 additions & 5 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ processDep ::
MissingPresentDeps
)
processDep pkgId name value = do
mLatestApplicable <- getLatestApplicableVersionAndRev name range
eRes <- getCachedDepOrAddDep name
let failure mLatestApp err =
Left $ Map.singleton name (range, mLatestApp, err)
Expand All @@ -844,17 +843,19 @@ processDep pkgId name value = do
-- spamming the user too much.
DependencyPlanFailures _ _ ->
Couldn'tResolveItsDependencies version
mLatestApplicable <- getLatestApplicableVersionAndRev name range
pure $ failure mLatestApplicable bd
Right adr
| isDepTypeLibrary value.depType && not (adrHasLibrary adr) ->
pure $ failure Nothing HasNoLibrary
Right adr -> do
addParent
inRange <- adrInRange pkgId name range adr
pure $ if inRange
then Right $ processAdr adr
else failure mLatestApplicable (DependencyMismatch $ adrVersion adr)

if inRange
then pure $ Right $ processAdr adr
else do
mLatestApplicable <- getLatestApplicableVersionAndRev name range
pure $ failure mLatestApplicable (DependencyMismatch $ adrVersion adr)
where
range = value.versionRange
version = pkgVersion pkgId
Expand Down

0 comments on commit 80e2994

Please sign in to comment.