Removes dependency on Cabal to reduce build time
This commit is contained in:
parent
0960d01f8d
commit
b3b85c4583
@ -16,8 +16,7 @@ cabal-version: >=1.18
|
|||||||
executable ringo
|
executable ringo
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
other-modules: Ringo.ArgParser,
|
other-modules: Ringo.ArgParser,
|
||||||
Ringo.InputParser,
|
Ringo.InputParser
|
||||||
Distribution.CurrentPackageDescription
|
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
build-depends: base >=4.7 && <5,
|
build-depends: base >=4.7 && <5,
|
||||||
text >=1.2 && <1.3,
|
text >=1.2 && <1.3,
|
||||||
@ -30,8 +29,6 @@ executable ringo
|
|||||||
directory >=1.2 && <1.4,
|
directory >=1.2 && <1.4,
|
||||||
filepath >=1.3 && <1.5,
|
filepath >=1.3 && <1.5,
|
||||||
aeson >=0.8 && <1.3,
|
aeson >=0.8 && <1.3,
|
||||||
Cabal >=1.18 && <2.1,
|
|
||||||
template-haskell >=2.9 && <2.13,
|
|
||||||
ringo-core
|
ringo-core
|
||||||
ghc-options: -Wall -fwarn-incomplete-uni-patterns -fno-warn-unused-do-bind
|
ghc-options: -Wall -fwarn-incomplete-uni-patterns -fno-warn-unused-do-bind
|
||||||
-fno-warn-orphans -funbox-strict-fields -O2
|
-fno-warn-orphans -funbox-strict-fields -O2
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
|
|
||||||
module Distribution.CurrentPackageDescription
|
|
||||||
( currentPackageDescription
|
|
||||||
, getField
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Prelude.Compat
|
|
||||||
import Distribution.PackageDescription
|
|
||||||
import Distribution.PackageDescription.Parse
|
|
||||||
import Distribution.Verbosity
|
|
||||||
|
|
||||||
import Data.List (isSuffixOf)
|
|
||||||
import Language.Haskell.TH (stringE, runIO, Q, Exp)
|
|
||||||
import System.Directory (getCurrentDirectory, getDirectoryContents)
|
|
||||||
|
|
||||||
|
|
||||||
getField :: (PackageDescription -> String) -> Q Exp
|
|
||||||
getField f = runIO currentPackageDescription >>= stringE . f
|
|
||||||
|
|
||||||
currentPackageDescription :: IO PackageDescription
|
|
||||||
currentPackageDescription = fmap packageDescription $ do
|
|
||||||
dir <- getCurrentDirectory
|
|
||||||
cs <- cabalFiles dir
|
|
||||||
case cs of
|
|
||||||
#if MIN_VERSION_base(4,10,0)
|
|
||||||
(c:_) -> readGenericPackageDescription silent c
|
|
||||||
#else
|
|
||||||
(c:_) -> readPackageDescription silent c
|
|
||||||
#endif
|
|
||||||
[] -> error $ "Couldn't find a cabal file in the current working directory (" ++ dir ++ ")"
|
|
||||||
|
|
||||||
cabalFiles :: FilePath -> IO [FilePath]
|
|
||||||
cabalFiles dir = filter (".cabal" `isSuffixOf`) <$> getDirectoryContents dir
|
|
@ -1,14 +1,9 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
|
|
||||||
module Ringo.ArgParser (ProgArgs(..), parseArgs) where
|
module Ringo.ArgParser (ProgArgs(..), parseArgs) where
|
||||||
|
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
import qualified Distribution.Package as P
|
|
||||||
import qualified Distribution.PackageDescription as P
|
|
||||||
import qualified Distribution.CurrentPackageDescription as P
|
|
||||||
import qualified Distribution.Text as DText
|
|
||||||
|
|
||||||
import Data.List (intercalate)
|
import Data.List (intercalate)
|
||||||
import Data.Monoid ((<>))
|
import Data.Monoid ((<>))
|
||||||
@ -109,9 +104,10 @@ progArgsParser =
|
|||||||
versionParser :: String -> Parser (a -> a)
|
versionParser :: String -> Parser (a -> a)
|
||||||
versionParser progName = infoOption (progName ++ " " ++ version)
|
versionParser progName = infoOption (progName ++ " " ++ version)
|
||||||
(long "version"
|
(long "version"
|
||||||
|
<> short 'v'
|
||||||
<> help "Print version information")
|
<> help "Print version information")
|
||||||
where
|
where
|
||||||
version = $(P.getField (DText.display . P.pkgVersion . P.package))
|
version = "0.1.0"
|
||||||
|
|
||||||
parseArgs :: IO ProgArgs
|
parseArgs :: IO ProgArgs
|
||||||
parseArgs = do
|
parseArgs = do
|
||||||
@ -119,6 +115,6 @@ parseArgs = do
|
|||||||
execParser $
|
execParser $
|
||||||
info (helper <*> versionParser progName <*> progArgsParser)
|
info (helper <*> versionParser progName <*> progArgsParser)
|
||||||
(fullDesc
|
(fullDesc
|
||||||
<> progDesc $(P.getField P.description)
|
<> progDesc "Tool to transform Postgres OLTP schemas to OLAP star schemas automatically"
|
||||||
<> header (progName ++ " - " ++ $(P.getField P.synopsis))
|
<> header (progName ++ " - OLTP to OLAP schema transformer for Postgres")
|
||||||
<> footer ("© " ++ $(P.getField P.copyright) ++ ". " ++ $(P.getField P.homepage)))
|
<> footer "© 2015-2017 Quintype Inc, Nilenso Software LLP, Abhinav Sarkar. http://github.com/abhin4v/ringo")
|
||||||
|
Loading…
Reference in New Issue
Block a user