Merge branch 'cabal-plan'
This commit is contained in:
commit
1fb048777c
@ -30,6 +30,7 @@ import GHCup.Utils.Prelude
|
|||||||
import GHCup.Utils.String.QQ
|
import GHCup.Utils.String.QQ
|
||||||
import GHCup.Version
|
import GHCup.Version
|
||||||
|
|
||||||
|
import Cabal.Plan ( findPlanJson, SearchPlanJson(..) )
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Concurrent.Async
|
import Control.Concurrent.Async
|
||||||
@ -42,6 +43,8 @@ import Control.Monad.Fail ( MonadFail )
|
|||||||
import Control.Monad.Logger
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
|
import Data.Aeson ( decodeStrict', Value )
|
||||||
|
import Data.Aeson.Encode.Pretty ( encodePretty )
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Data.Either
|
import Data.Either
|
||||||
@ -1363,6 +1366,16 @@ describe_result = $( LitE . StringL <$>
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
plan_json :: String
|
||||||
|
plan_json = $( LitE . StringL <$>
|
||||||
|
runIO (handleIO (\_ -> pure "") $ do
|
||||||
|
fp <- findPlanJson (ProjectRelativeToDir ".")
|
||||||
|
c <- B.readFile fp
|
||||||
|
(Just res) <- pure $ decodeStrict' @Value c
|
||||||
|
pure $ T.unpack $ decUTF8Safe' $ encodePretty res
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
formatConfig :: UserSettings -> String
|
formatConfig :: UserSettings -> String
|
||||||
formatConfig settings
|
formatConfig settings
|
||||||
= UTF8.toString . YP.encodePretty yamlConfig $ settings
|
= UTF8.toString . YP.encodePretty yamlConfig $ settings
|
||||||
@ -1381,6 +1394,9 @@ main = do
|
|||||||
(head . lines $ describe_result)
|
(head . lines $ describe_result)
|
||||||
)
|
)
|
||||||
(long "version" <> help "Show version" <> hidden)
|
(long "version" <> help "Show version" <> hidden)
|
||||||
|
let planJson = infoOption
|
||||||
|
plan_json
|
||||||
|
(long "plan-json" <> help "Show the build-time configuration" <> internal)
|
||||||
let numericVersionHelp = infoOption
|
let numericVersionHelp = infoOption
|
||||||
numericVer
|
numericVer
|
||||||
( long "numeric-version"
|
( long "numeric-version"
|
||||||
@ -1408,7 +1424,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
customExecParser
|
customExecParser
|
||||||
(prefs showHelpOnError)
|
(prefs showHelpOnError)
|
||||||
(info (opts <**> helper <**> versionHelp <**> numericVersionHelp <**> listCommands)
|
(info (opts <**> helper <**> versionHelp <**> numericVersionHelp <**> planJson <**> listCommands)
|
||||||
(footerDoc (Just $ text main_footer))
|
(footerDoc (Just $ text main_footer))
|
||||||
)
|
)
|
||||||
>>= \opt@Options {..} -> do
|
>>= \opt@Options {..} -> do
|
||||||
|
@ -23,4 +23,10 @@ constraints: http-io-streams -brotli
|
|||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
|
|
||||||
|
package aeson-pretty
|
||||||
|
flags: +lib-only
|
||||||
|
|
||||||
|
package cabal-plan
|
||||||
|
flags: -exe
|
||||||
|
|
||||||
allow-newer: base, ghc-prim, template-haskell, language-c
|
allow-newer: base, ghc-prim, template-haskell, language-c
|
||||||
|
@ -186,9 +186,12 @@ executable ghcup
|
|||||||
-fwarn-incomplete-record-updates -threaded
|
-fwarn-incomplete-record-updates -threaded
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
|
, aeson >=1.4 && <1.6
|
||||||
|
, aeson-pretty ^>=0.8.8
|
||||||
, async ^>=2.2.3
|
, async ^>=2.2.3
|
||||||
, base >=4.13 && <5
|
, base >=4.13 && <5
|
||||||
, bytestring ^>=0.10
|
, bytestring ^>=0.10
|
||||||
|
, cabal-plan ^>=0.7.2
|
||||||
, containers ^>=0.6
|
, containers ^>=0.6
|
||||||
, deepseq ^>=1.4
|
, deepseq ^>=1.4
|
||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
|
@ -53,6 +53,12 @@ flags:
|
|||||||
regex-posix:
|
regex-posix:
|
||||||
_regex-posix-clib: true
|
_regex-posix-clib: true
|
||||||
|
|
||||||
|
aeson-pretty:
|
||||||
|
lib-only: true
|
||||||
|
|
||||||
|
cabal-plan:
|
||||||
|
exe: false
|
||||||
|
|
||||||
ghc-options:
|
ghc-options:
|
||||||
"$locals": -O2
|
"$locals": -O2
|
||||||
streamly: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
|
streamly: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
|
||||||
|
Loading…
Reference in New Issue
Block a user