Kaynağa Gözat

Removes dependency on Cabal to reduce build time

Abhinav Sarkar 3 yıl önce
ebeveyn
işleme
b3b85c4583

+ 1
- 4
ringo/ringo.cabal Dosyayı Görüntüle

@@ -16,8 +16,7 @@ cabal-version:       >=1.18
16 16
 executable ringo
17 17
   hs-source-dirs:      src
18 18
   other-modules:       Ringo.ArgParser,
19
-                       Ringo.InputParser,
20
-                       Distribution.CurrentPackageDescription
19
+                       Ringo.InputParser
21 20
   main-is:             Main.hs
22 21
   build-depends:       base                 >=4.7     && <5,
23 22
                        text                 >=1.2     && <1.3,
@@ -30,8 +29,6 @@ executable ringo
30 29
                        directory            >=1.2     && <1.4,
31 30
                        filepath             >=1.3     && <1.5,
32 31
                        aeson                >=0.8     && <1.3,
33
-                       Cabal                >=1.18    && <2.1,
34
-                       template-haskell     >=2.9     && <2.13,
35 32
                        ringo-core
36 33
   ghc-options:         -Wall -fwarn-incomplete-uni-patterns -fno-warn-unused-do-bind
37 34
                        -fno-warn-orphans -funbox-strict-fields -O2

+ 0
- 35
ringo/src/Distribution/CurrentPackageDescription.hs Dosyayı Görüntüle

@@ -1,35 +0,0 @@
1
-{-# LANGUAGE NoImplicitPrelude #-}
2
-{-# LANGUAGE CPP #-}
3
-
4
-module Distribution.CurrentPackageDescription
5
-  ( currentPackageDescription
6
-  , getField
7
-  ) where
8
-
9
-import Prelude.Compat
10
-import Distribution.PackageDescription
11
-import Distribution.PackageDescription.Parse
12
-import Distribution.Verbosity
13
-
14
-import Data.List           (isSuffixOf)
15
-import Language.Haskell.TH (stringE, runIO, Q, Exp)
16
-import System.Directory    (getCurrentDirectory, getDirectoryContents)
17
-
18
-
19
-getField :: (PackageDescription -> String) -> Q Exp
20
-getField f = runIO currentPackageDescription >>= stringE . f
21
-
22
-currentPackageDescription :: IO PackageDescription
23
-currentPackageDescription = fmap packageDescription $ do
24
-  dir <- getCurrentDirectory
25
-  cs  <- cabalFiles dir
26
-  case cs of
27
-#if MIN_VERSION_base(4,10,0)
28
-    (c:_) -> readGenericPackageDescription silent c
29
-#else
30
-    (c:_) -> readPackageDescription silent c
31
-#endif
32
-    []    -> error $ "Couldn't find a cabal file in the current working directory (" ++ dir ++ ")"
33
-
34
-cabalFiles :: FilePath -> IO [FilePath]
35
-cabalFiles dir = filter (".cabal" `isSuffixOf`) <$> getDirectoryContents dir

+ 5
- 9
ringo/src/Ringo/ArgParser.hs Dosyayı Görüntüle

@@ -1,14 +1,9 @@
1 1
 {-# LANGUAGE OverloadedStrings #-}
2 2
 {-# LANGUAGE RecordWildCards #-}
3
-{-# LANGUAGE TemplateHaskell #-}
4 3
 
5 4
 module Ringo.ArgParser (ProgArgs(..), parseArgs) where
6 5
 
7 6
 import qualified Data.Text as Text
8
-import qualified Distribution.Package as P
9
-import qualified Distribution.PackageDescription as P
10
-import qualified Distribution.CurrentPackageDescription as P
11
-import qualified Distribution.Text as DText
12 7
 
13 8
 import Data.List           (intercalate)
14 9
 import Data.Monoid         ((<>))
@@ -109,9 +104,10 @@ progArgsParser =
109 104
 versionParser :: String -> Parser (a -> a)
110 105
 versionParser progName = infoOption (progName ++ " " ++ version)
111 106
   (long "version"
107
+   <> short 'v'
112 108
    <> help "Print version information")
113 109
   where
114
-    version = $(P.getField (DText.display . P.pkgVersion . P.package))
110
+    version = "0.1.0"
115 111
 
116 112
 parseArgs :: IO ProgArgs
117 113
 parseArgs = do
@@ -119,6 +115,6 @@ parseArgs = do
119 115
   execParser $
120 116
     info (helper <*> versionParser progName <*> progArgsParser)
121 117
          (fullDesc
122
-          <> progDesc $(P.getField P.description)
123
-          <> header (progName ++ " - " ++ $(P.getField P.synopsis))
124
-          <> footer ("© " ++ $(P.getField P.copyright) ++ ". " ++ $(P.getField P.homepage)))
118
+          <> progDesc "Tool to transform Postgres OLTP schemas to OLAP star schemas automatically"
119
+          <> header (progName ++ " - OLTP to OLAP schema transformer for Postgres")
120
+          <> footer "© 2015-2017 Quintype Inc, Nilenso Software LLP, Abhinav Sarkar. http://github.com/abhin4v/ringo")

Loading…
İptal
Kaydet