Visitar URL original
Bump for ghc-10 by philderbeast · Pull Request #12374 · haskell/cabal · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import Distribution.Client.Init.Types
import Distribution.Client.Compat.Prelude hiding (getLine, head, last, putStr, putStrLn)
import Prelude ()

import Data.List (last)
import qualified Data.List.NonEmpty as NEL

import Distribution.CabalSpecVersion (CabalSpecVersion (..))
Expand All @@ -56,15 +55,15 @@ import Distribution.Simple.Setup (fromFlagOrDefault, pattern Flag, pattern NoFla
import Distribution.Solver.Types.PackageIndex (elemByPackageName)
import Distribution.Types.Dependency (Dependency (..))
import Distribution.Types.PackageName (PackageName, unPackageName)
import Distribution.Utils.Generic (safeHead)
import Distribution.Utils.Generic (safeHead, safeLast)
import Distribution.Verbosity
import Distribution.Version (Version)

import Language.Haskell.Extension (Extension (..), Language (..))

import qualified Data.Set as Set
import Distribution.FieldGrammar.Newtypes
import System.FilePath (splitDirectories, (</>))
import System.FilePath ((</>))

-- | Main driver for interactive prompt code.
createProject
Expand Down Expand Up @@ -267,7 +266,7 @@ packageNameHeuristics sourcePkgDb flags = getPackageName flags $ do
defName <-
guessPackageName =<< case packageDir flags of
Flag a -> return a
NoFlag -> last . splitDirectories <$> getCurrentDirectory
NoFlag -> getCurrentDirectory

when (isPkgRegistered defName) $
putStrLn (inUseMsg defName)
Expand Down Expand Up @@ -413,7 +412,7 @@ libOtherModulesHeuristics flags = case otherModules flags of
if exists
then do
otherModules' <- filter isHaskell <$> listFilesRecursive libDir
filter ((`elem` otherCandidates) . last . components)
filter (maybe False (`elem` otherCandidates) . safeLast . components)
. catMaybes
<$> traverse retrieveModuleName otherModules'
else return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ import Distribution.Client.Compat.Prelude hiding (many, readFile, (<|>))
import Distribution.Simple.Setup (fromFlagOrDefault)

import Data.Functor ((<&>))
import qualified Data.List as L
import qualified Data.Set as Set
import Distribution.CabalSpecVersion
import Distribution.Client.Init.Defaults
import Distribution.Client.Init.FlagExtractors (getCabalVersionNoPrompt)
import Distribution.Client.Init.Types
import Distribution.Client.Init.Utils
import Distribution.FieldGrammar.Newtypes
import Distribution.Simple.Utils (ordNub)
import Distribution.Simple.Utils (ordNub, safeLast)
import Distribution.Types.PackageName (PackageName)
import Distribution.Version
import System.FilePath
Expand Down Expand Up @@ -101,7 +100,7 @@ guessPackageType flags = do
if fromFlagOrDefault False (initializeTestSuite flags)
then return TestSuite
else do
let lastDir dirs = L.last . splitDirectories $ dirs
let lastDir dirs = fromMaybe "" . safeLast . splitDirectories $ dirs
srcCandidates = [defaultSourceDir, "src", "source"]
testCandidates = [defaultTestDir, "test", "tests"]

Expand Down
52 changes: 51 additions & 1 deletion cabal-install/src/Distribution/Client/ProjectConfig/Types.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE NamedFieldPuns #-}

-- | Handling project configuration, types.
module Distribution.Client.ProjectConfig.Types
Expand Down Expand Up @@ -501,4 +502,53 @@ data BuildTimeSettings = BuildTimeSettings
}
deriving (Generic)

instance NFData BuildTimeSettings
-- | This instance avoids the deepseq deprecation of @NFData (a -> b)@ triggered
-- by buildSettingLogFile the alternative @instance NFData BuildTimeSettings@.
instance NFData BuildTimeSettings where
rnf
BuildTimeSettings
{ buildSettingDryRun
, buildSettingOnlyDeps
, buildSettingOnlyDownload
, buildSettingSummaryFile
, buildSettingLogFile
, buildSettingLogVerbosity
, buildSettingBuildReports
, buildSettingReportPlanningFailure
, buildSettingSymlinkBinDir
, buildSettingNumJobs
, buildSettingKeepGoing
, buildSettingOfflineMode
, buildSettingKeepTempFiles
, buildSettingRemoteRepos
, buildSettingLocalNoIndexRepos
, buildSettingCacheDir
, buildSettingHttpTransport
, buildSettingIgnoreExpiry
, buildSettingProgPathExtra
, buildSettingHaddockOpen
, buildSettingBuildTimings
} =
rnf
[ rnf buildSettingDryRun
, rnf buildSettingOnlyDeps
, rnf buildSettingOnlyDownload
, rnf buildSettingSummaryFile
, maybe () (`seq` ()) buildSettingLogFile
, rnf buildSettingLogVerbosity
, rnf buildSettingBuildReports
, rnf buildSettingReportPlanningFailure
, rnf buildSettingSymlinkBinDir
, rnf buildSettingNumJobs
, rnf buildSettingKeepGoing
, rnf buildSettingOfflineMode
, rnf buildSettingKeepTempFiles
, rnf buildSettingRemoteRepos
, rnf buildSettingLocalNoIndexRepos
, rnf buildSettingCacheDir
, rnf buildSettingHttpTransport
, rnf buildSettingIgnoreExpiry
, rnf buildSettingProgPathExtra
, rnf buildSettingHaddockOpen
, rnf buildSettingBuildTimings
]
14 changes: 9 additions & 5 deletions cabal-install/tests/IntegrationTests2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -818,12 +818,12 @@ testTargetProblemsCommon config0 = do

( \_ ->
TargetComponentNotProjectLocal
(pkgIdMap Map.! "filepath")
(CTestName "filepath-tests")
(pkgIdMap Map.! "bytestring")
(CTestName "bytestring-tests")
WholeComponent
, mkTargetComponent
(pkgIdMap Map.! "filepath")
(CTestName "filepath-tests")
(pkgIdMap Map.! "bytestring")
(CTestName "bytestring-tests")
)
, -- Components can be explicitly @buildable: False@

Expand Down Expand Up @@ -877,8 +877,12 @@ testTargetProblemsCommon config0 = do
, projectConfigShared =
(projectConfigShared config0)
{ projectConfigConstraints =
-- Constrain bytestring to a source instance, not the
-- installed one, so that its test suite is in the plan. Any
-- package with a test suite would do but the bytestring
-- package has wide upper bounds.
[
( UserConstraint (UserAnyQualifier "filepath") PackagePropertySource
( UserConstraint (UserAnyQualifier "bytestring") PackagePropertySource
, ConstraintSourceUnknown
)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cabal-version: >= 1.2

library
exposed-modules: Q
-- we rely that filepath has filepath-tests component
build-depends: base, filepath >=1.4.0.0
-- we rely that bytestring has bytestring-tests component
build-depends: base, bytestring

executable buildable-false
main-is: Main.hs
Expand Down
57 changes: 53 additions & 4 deletions project-cabal/ghc-latest.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,60 @@

-- NOTE: don't forget to update the compiler version in the conditional
-- when upgrading to a newer GHC
if impl(ghc >= 9.14.0)
if impl(ghc >= 10)
allow-newer:
--windns:*, rere:*, tree-diff:*, uuid-types:*, these:*, assoc:*, semialign:*, indexed-traversable-instances:*, indexed-traversable:*, OneTuple:*, scientific:*, time-compat:*, text-short:*, integer-conversion:*, generically:*, data-fix:*, binary:*
-- Artem, 2024-04-21: I started and then gave up...
*:base, *:template-haskell, text-short, *:deepseq, *:bytestring, *:ghc-prim, *:ghc-bignum, *:containers
aeson:template-haskell
, aeson:time
, assoc:base
, async:base
, bifunctors:template-haskell
, data-fix:base
, hackage-security:base
, hackage-security:ghc-prim
, hackage-security:template-haskell
, hackage-security:time
, hashable:base
, hashable:containers
, hashable:ghc-bignum
, hsc2hs:base
, HTTP:base
, HTTP:time
, indexed-traversable:base
, indexed-traversable-instances:base
, integer-conversion:base
, integer-logarithms:base
, nothunks:containers
, nothunks:time
, OneTuple:base
, parallel:base
, primitive:base
, scientific:base
, scientific:template-haskell
, semialign:base
, splitmix:base
, tagged:template-haskell
, tasty-bench:ghc-prim
, text-iso8601:time
, text-short:base
, text-short:ghc-prim
, text-short:template-haskell
, th-abstraction:template-haskell
, th-compat:template-haskell
, these:base
, time-compat:base
, time-compat:time
, tree-diff:base
, unordered-containers:template-haskell
, uuid-types:template-haskell
, vector:base
, vector-stream:base
, vector-stream:ghc-prim
, vector-th-unbox:base
, vector-th-unbox:template-haskell
, zinza:base
, zlib:base
-- Earlier versions of hashable have the ghc-bignum dependency.
constraints: hashable < 1.5.1.0

-- repository head.hackage.ghc.haskell.org
-- url: https://ghc.gitlab.haskell.org/head.hackage/
Expand Down
Loading