Introducing cabal-helper-wrapper
The idea here is to build cabal-helper with whatever version of Cabal the user happens to be using (which we find by looking at dist/setup-config) at runtime. This way we can support literally any version of Cabal as long as the actual cabal-helper still compiles. I tried to only use interfaces in Cabal that have been there since at least 1.16 so I'm hoping this shouldn't break too much.
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
module Main where
|
||||
|
||||
import Control.Applicative
|
||||
|
||||
import Distribution.Simple.Utils (cabalVersion)
|
||||
import Distribution.Simple.Configure
|
||||
import Distribution.Text ( display )
|
||||
import System.Environment
|
||||
import System.Directory
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
args <- getArgs
|
||||
case args of
|
||||
"version":[] -> do
|
||||
putStrLn $ "using version " ++ display cabalVersion ++ " of the Cabal library"
|
||||
"print-setup-config":args' -> do
|
||||
mfile <- findFile ["dist"] "setup-config"
|
||||
|
||||
let file = case mfile of
|
||||
Just f -> f
|
||||
Nothing -> let !(f:[]) = args' in f
|
||||
|
||||
putStrLn =<< show <$> getConfigStateFile file
|
||||
|
||||
cmd:_ -> error $ "Unknown command: " ++ cmd
|
||||
[] -> error "No command given"
|
||||
Reference in New Issue
Block a user