Skip to content

Commit 7fca6d4

Browse files
committed
Move Stack to -XGHC2021
Merging this now may be premature. Users of Stack < 2.9.1 will not be able to `stack upgrade --source-only --git`, because Hpack >= 0.35.0 is required, although they will be able to `stack upgrade` to a version of Stack that can do that. Stack 2.9.1 was released in September 2022. On applying GHC2021, `Stack.Build.Execute.withLockedDistDir` required a signature on `complainer` in order to compile.
1 parent c3faf5c commit 7fca6d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+32
-261
lines changed

package.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Hpack >= 0.35.0 is provided by Stack >= 2.9.1.
2+
spec-version: 0.35.0
3+
14
name: stack
25
version: '2.10.0'
36
synopsis: The Haskell Tool Stack
@@ -8,7 +11,7 @@ description: |
811
If building a 'stack' executable for distribution, please download the
912
source code from <https://github.com/commercialhaskell/stack/releases>
1013
and build it using Stack itself in order to ensure identical behaviour
11-
to official binaries. This package on Hackage is provided for convenience
14+
to official binaries. This package on Hackage is provided for convenience
1215
and bootstrapping purposes.
1316
.
1417
Note that the API for the library is not currently stable, and may
@@ -39,6 +42,8 @@ extra-source-files:
3942
- test/package-dump/ghc-head.txt
4043
- src/test/Stack/Untar/test1.tar.gz
4144
- src/test/Stack/Untar/test2.tar.gz
45+
# GHC's GHC2021 language extension is supported by GHC >= 9.2.1
46+
language: GHC2021
4247
ghc-options:
4348
- -fwrite-ide-info
4449
- -hiedir=.hie

src/Control/Concurrent/Execute.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE DeriveDataTypeable #-}
32
{-# LANGUAGE RecordWildCards #-}
43

54
-- Concurrent execution with dependencies. Types currently hard-coded for needs

src/Data/Monoid/Map.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
{-# LANGUAGE DeriveGeneric #-}
2-
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3-
41
module Data.Monoid.Map
52
( MonoidMap (..)
63
) where

src/Options/Applicative/Builder/Extra.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
22
{-# LANGUAGE RecordWildCards #-}
3-
{-# LANGUAGE ScopedTypeVariables #-}
43

54
-- | Extra functions for optparse-applicative.
65

src/Path/CheckInstall.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE FlexibleContexts #-}
32
{-# LANGUAGE OverloadedStrings #-}
43

54
module Path.CheckInstall

src/Stack/Build.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE ConstraintKinds #-}
3-
{-# LANGUAGE DeriveDataTypeable #-}
4-
{-# LANGUAGE FlexibleContexts #-}
52
{-# LANGUAGE LambdaCase #-}
63
{-# LANGUAGE OverloadedStrings #-}
7-
{-# LANGUAGE ScopedTypeVariables #-}
84

95
-- | Build the project.
106

src/Stack/Build/Cache.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE ConstraintKinds #-}
32
{-# LANGUAGE DataKinds #-}
4-
{-# LANGUAGE FlexibleContexts #-}
5-
{-# LANGUAGE MultiParamTypeClasses #-}
63
{-# LANGUAGE OverloadedStrings #-}
7-
{-# LANGUAGE ScopedTypeVariables #-}
84

95
-- | Cache information about previous builds
106
module Stack.Build.Cache

src/Stack/Build/ConstructPlan.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE ConstraintKinds #-}
3-
{-# LANGUAGE DeriveGeneric #-}
4-
{-# LANGUAGE FlexibleContexts #-}
52
{-# LANGUAGE LambdaCase #-}
6-
{-# LANGUAGE MultiParamTypeClasses #-}
73
{-# LANGUAGE OverloadedStrings #-}
8-
{-# LANGUAGE ScopedTypeVariables #-}
9-
{-# LANGUAGE TupleSections #-}
104
{-# LANGUAGE ViewPatterns #-}
115

126
-- | Construct a @Plan@ for how to build

src/Stack/Build/Execute.hs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE ConstraintKinds #-}
32
{-# LANGUAGE DataKinds #-}
4-
{-# LANGUAGE FlexibleContexts #-}
5-
{-# LANGUAGE MultiParamTypeClasses #-}
63
{-# LANGUAGE OverloadedStrings #-}
7-
{-# LANGUAGE RankNTypes #-}
84
{-# LANGUAGE RecordWildCards #-}
9-
{-# LANGUAGE ScopedTypeVariables #-}
10-
{-# LANGUAGE TupleSections #-}
115
{-# LANGUAGE TypeFamilies #-}
126

137
-- | Perform a build
@@ -69,7 +63,7 @@ import Distribution.Types.UnqualComponentName
6963
( mkUnqualComponentName )
7064
import Distribution.Verbosity ( showForCabal )
7165
import Distribution.Version ( mkVersion )
72-
import Pantry.Internal.Companion ( withCompanion )
66+
import Pantry.Internal.Companion ( Companion, withCompanion )
7367
import Path
7468
( PathException, (</>), addExtension, filename
7569
, isProperPrefixOf, parent, parseRelDir, parseRelFile
@@ -1165,40 +1159,43 @@ announceTask ee task action = logInfo $
11651159
-- | Ensure we're the only action using the directory. See
11661160
-- <https://github.com/commercialhaskell/stack/issues/2730>
11671161
withLockedDistDir ::
1168-
HasEnvConfig env
1162+
forall env a. HasEnvConfig env
11691163
=> (Utf8Builder -> RIO env ()) -- ^ announce
11701164
-> Path Abs Dir -- ^ root directory for package
11711165
-> RIO env a
11721166
-> RIO env a
11731167
withLockedDistDir announce root inner = do
11741168
distDir <- distRelativeDir
11751169
let lockFP = root </> distDir </> relFileBuildLock
1170+
lockFP' = toFilePath lockFP
11761171
ensureDir $ parent lockFP
11771172

11781173
mres <-
11791174
withRunInIO $ \run ->
1180-
withTryFileLock (toFilePath lockFP) Exclusive $ \_lock ->
1175+
withTryFileLock lockFP' Exclusive $ \_lock ->
11811176
run inner
11821177

11831178
case mres of
11841179
Just res -> pure res
11851180
Nothing -> do
1186-
let complainer delay = do
1187-
delay 5000000 -- 5 seconds
1188-
announce $
1189-
"blocking for directory lock on "
1190-
<> fromString (toFilePath lockFP)
1191-
forever $ do
1192-
delay 30000000 -- 30 seconds
1193-
announce $
1194-
"still blocking for directory lock on "
1195-
<> fromString (toFilePath lockFP)
1196-
<> "; maybe another Stack process is running?"
1197-
withCompanion complainer $
1181+
withCompanion (complainer lockFP') $
11981182
\stopComplaining ->
11991183
withRunInIO $ \run ->
1200-
withFileLock (toFilePath lockFP) Exclusive $ \_ ->
1184+
withFileLock lockFP' Exclusive $ \_ ->
12011185
run $ stopComplaining *> inner
1186+
where
1187+
complainer :: FilePath -> Companion (RIO env)
1188+
complainer fp delay = do
1189+
delay 5000000 -- 5 seconds
1190+
announce $
1191+
"blocking for directory lock on "
1192+
<> fromString fp
1193+
forever $ do
1194+
delay 30000000 -- 30 seconds
1195+
announce $
1196+
"still blocking for directory lock on "
1197+
<> fromString fp
1198+
<> "; maybe another Stack process is running?"
12021199

12031200
-- | How we deal with output from GHC, either dumping to a log file or the
12041201
-- console (with some prefix).

src/Stack/Build/Haddock.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE ConstraintKinds #-}
3-
{-# LANGUAGE FlexibleContexts #-}
4-
{-# LANGUAGE MultiParamTypeClasses #-}
52
{-# LANGUAGE OverloadedStrings #-}
6-
{-# LANGUAGE NamedFieldPuns #-}
7-
{-# LANGUAGE ScopedTypeVariables #-}
83

94
-- | Generate haddocks
105
module Stack.Build.Haddock

0 commit comments

Comments
 (0)