Skip to content

Commit

Permalink
Require Cabal >= 3.13 for defaultMainWithSetupHooks autoconfSetupHooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sheaf committed Apr 29, 2024
1 parent 29fbd78 commit bbc2418
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cabal-install/src/Distribution/Client/SetupWrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,18 @@ getExternalSetupMethod verbosity options pkg bt = do
buildTypeScript cabalLibVersion = case bt of
Simple -> "import Distribution.Simple; main = defaultMain\n"
Configure
| cabalLibVersion >= mkVersion [1, 3, 10] -> "import Distribution.Simple; main = defaultMainWithSetupHooks autoconfSetupHooks\n"
| otherwise -> "import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks\n"
| cabalLibVersion >= mkVersion [3, 13, 0]
-> "import Distribution.Simple; main = defaultMainWithSetupHooks autoconfSetupHooks\n"
| cabalLibVersion >= mkVersion [1, 3, 10]
-> "import Distribution.Simple; main = defaultMainWithHooks autoconfUserHooks\n"
| otherwise
-> "import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks\n"
Make -> "import Distribution.Make; main = defaultMain\n"
Hooks -> "import Distribution.Simple; import SetupHooks; main = defaultMainWithSetupHooks setupHooks\n"
Hooks
| cabalLibVersion >= mkVersion [3, 13, 0]
-> "import Distribution.Simple; import SetupHooks; main = defaultMainWithSetupHooks setupHooks\n"
| otherwise
-> error "buildTypeScript Hooks with Cabal < 3.13"
Custom -> error "buildTypeScript Custom"
-- TODO: should all of these include {-# LANGUAGE NoImplicitPrelude #-}?
-- What happens if there is no base dependency declared in the Cabal file?
Expand Down

0 comments on commit bbc2418

Please sign in to comment.