Skip to content

Commit

Permalink
Merge pull request #6021 from commercialhaskell/ghc2021
Browse files Browse the repository at this point in the history
Move Stack to -XGHC2021
  • Loading branch information
mpilgrem authored Jan 21, 2023
2 parents cf9d8bb + 7fca6d4 commit 8042969
Show file tree
Hide file tree
Showing 86 changed files with 32 additions and 261 deletions.
7 changes: 6 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Hpack >= 0.35.0 is provided by Stack >= 2.9.1.
spec-version: 0.35.0

name: stack
version: '2.10.0'
synopsis: The Haskell Tool Stack
Expand All @@ -8,7 +11,7 @@ description: |
If building a 'stack' executable for distribution, please download the
source code from <https://github.com/commercialhaskell/stack/releases>
and build it using Stack itself in order to ensure identical behaviour
to official binaries. This package on Hackage is provided for convenience
to official binaries. This package on Hackage is provided for convenience
and bootstrapping purposes.
.
Note that the API for the library is not currently stable, and may
Expand Down Expand Up @@ -39,6 +42,8 @@ extra-source-files:
- test/package-dump/ghc-head.txt
- src/test/Stack/Untar/test1.tar.gz
- src/test/Stack/Untar/test2.tar.gz
# GHC's GHC2021 language extension is supported by GHC >= 9.2.1
language: GHC2021
ghc-options:
- -fwrite-ide-info
- -hiedir=.hie
Expand Down
1 change: 0 additions & 1 deletion src/Control/Concurrent/Execute.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE RecordWildCards #-}

-- Concurrent execution with dependencies. Types currently hard-coded for needs
Expand Down
3 changes: 0 additions & 3 deletions src/Data/Monoid/Map.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Data.Monoid.Map
( MonoidMap (..)
) where
Expand Down
1 change: 0 additions & 1 deletion src/Options/Applicative/Builder/Extra.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Extra functions for optparse-applicative.

Expand Down
1 change: 0 additions & 1 deletion src/Path/CheckInstall.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}

module Path.CheckInstall
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/Build.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Build the project.

Expand Down
4 changes: 0 additions & 4 deletions src/Stack/Build/Cache.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Cache information about previous builds
module Stack.Build.Cache
Expand Down
6 changes: 0 additions & 6 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}

-- | Construct a @Plan@ for how to build
Expand Down
41 changes: 19 additions & 22 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}

-- | Perform a build
Expand Down Expand Up @@ -69,7 +63,7 @@ import Distribution.Types.UnqualComponentName
( mkUnqualComponentName )
import Distribution.Verbosity ( showForCabal )
import Distribution.Version ( mkVersion )
import Pantry.Internal.Companion ( withCompanion )
import Pantry.Internal.Companion ( Companion, withCompanion )
import Path
( PathException, (</>), addExtension, filename
, isProperPrefixOf, parent, parseRelDir, parseRelFile
Expand Down Expand Up @@ -1170,40 +1164,43 @@ announceTask ee task action = logInfo $
-- | Ensure we're the only action using the directory. See
-- <https://github.com/commercialhaskell/stack/issues/2730>
withLockedDistDir ::
HasEnvConfig env
forall env a. HasEnvConfig env
=> (Utf8Builder -> RIO env ()) -- ^ announce
-> Path Abs Dir -- ^ root directory for package
-> RIO env a
-> RIO env a
withLockedDistDir announce root inner = do
distDir <- distRelativeDir
let lockFP = root </> distDir </> relFileBuildLock
lockFP' = toFilePath lockFP
ensureDir $ parent lockFP

mres <-
withRunInIO $ \run ->
withTryFileLock (toFilePath lockFP) Exclusive $ \_lock ->
withTryFileLock lockFP' Exclusive $ \_lock ->
run inner

case mres of
Just res -> pure res
Nothing -> do
let complainer delay = do
delay 5000000 -- 5 seconds
announce $
"blocking for directory lock on "
<> fromString (toFilePath lockFP)
forever $ do
delay 30000000 -- 30 seconds
announce $
"still blocking for directory lock on "
<> fromString (toFilePath lockFP)
<> "; maybe another Stack process is running?"
withCompanion complainer $
withCompanion (complainer lockFP') $
\stopComplaining ->
withRunInIO $ \run ->
withFileLock (toFilePath lockFP) Exclusive $ \_ ->
withFileLock lockFP' Exclusive $ \_ ->
run $ stopComplaining *> inner
where
complainer :: FilePath -> Companion (RIO env)
complainer fp delay = do
delay 5000000 -- 5 seconds
announce $
"blocking for directory lock on "
<> fromString fp
forever $ do
delay 30000000 -- 30 seconds
announce $
"still blocking for directory lock on "
<> fromString fp
<> "; maybe another Stack process is running?"

-- | How we deal with output from GHC, either dumping to a log file or the
-- console (with some prefix).
Expand Down
5 changes: 0 additions & 5 deletions src/Stack/Build/Haddock.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Generate haddocks
module Stack.Build.Haddock
Expand Down
3 changes: 0 additions & 3 deletions src/Stack/Build/Installed.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}

-- Determine which packages are already installed
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- Load information on package sources
module Stack.Build.Source
Expand Down
2 changes: 0 additions & 2 deletions src/Stack/Build/Target.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}

-- | Parsing command line targets
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/BuildPlan.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Resolving a build plan for a set of packages in a given Stackage
-- snapshot.
Expand Down
3 changes: 0 additions & 3 deletions src/Stack/Clean.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}

-- | Clean a project.
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/ComponentFile.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

-- | A module which exports all component-level file-gathering logic. It also
-- includes utility functions for handling paths and directories.
Expand Down
3 changes: 0 additions & 3 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}

-- | The general Stack configuration that starts everything off. This should
Expand Down
1 change: 0 additions & 1 deletion src/Stack/Config/Docker.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

Expand Down
1 change: 0 additions & 1 deletion src/Stack/Config/Nix.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

Expand Down
3 changes: 0 additions & 3 deletions src/Stack/ConfigCmd.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Make changes to project or global configuration.
module Stack.ConfigCmd
Expand Down
6 changes: 0 additions & 6 deletions src/Stack/Coverage.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

-- | Generate HPC (Haskell Program Coverage) reports
module Stack.Coverage
Expand Down
5 changes: 0 additions & 5 deletions src/Stack/Docker.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | Run commands in Docker containers
module Stack.Docker
Expand Down
3 changes: 0 additions & 3 deletions src/Stack/Dot.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}

module Stack.Dot
( dot
Expand Down
1 change: 0 additions & 1 deletion src/Stack/FileWatch.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}

module Stack.FileWatch
( WatchMode (WatchModePoll)
Expand Down
1 change: 0 additions & 1 deletion src/Stack/GhcPkg.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}

-- | Functions for the GHC package database.
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/Ghci.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}

-- | Run a GHCi configured with the user's package(s).

Expand Down
1 change: 0 additions & 1 deletion src/Stack/Hoogle.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- | A wrapper around hoogle.
module Stack.Hoogle
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/IDE.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

-- | Functions for IDEs.
module Stack.IDE
Expand Down
5 changes: 0 additions & 5 deletions src/Stack/Init.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

module Stack.Init
( initProject
Expand Down
1 change: 0 additions & 1 deletion src/Stack/List.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Stack.List
( listPackages
Expand Down
2 changes: 0 additions & 2 deletions src/Stack/Lock.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

Expand Down
1 change: 0 additions & 1 deletion src/Stack/Ls.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Stack.Ls
( lsCmd
Expand Down
6 changes: 0 additions & 6 deletions src/Stack/New.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}

-- | Create new a new project directory populated with a basic working
-- project.
Expand Down
Loading

0 comments on commit 8042969

Please sign in to comment.