fay-builder 0.1.0.7 → 0.2
raw patch · 5 files changed
+63/−12 lines, 5 filesdep +safedep ~textnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: safe
Dependency ranges changed: text
API changes (from Hackage documentation)
+ Fay.Builder: readField :: Read a => String -> a -> PackageDescription -> a
- Fay.Builder: fayConfig :: Maybe FilePath -> [String] -> FilePath -> [FilePath] -> Config
+ Fay.Builder: fayConfig :: Maybe FilePath -> [String] -> FilePath -> [FilePath] -> [String] -> Bool -> Config
Files
- CHANGELOG.md +10/−0
- LICENSE +30/−0
- README.md +1/−1
- fay-builder.cabal +4/−2
- src/Fay/Builder.hs +18/−9
CHANGELOG.md view
@@ -1,5 +1,15 @@ # Changelog +## 0.2++* Add flag x-fay-strict-modules, specifying modules that should get a+ strict wrapper.+* Add flag x-fay-library, indicating that no main function should be+ called.+* Export new `readField` function.+* Signature for `fayConfig` has changed.+* Clarify license as BSD3.+ #### 0.1.0.7 (2014-04-29) * Use `fay 0.20`
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Silk B.V.++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Silk B.V. nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md view
@@ -6,7 +6,7 @@ ## Installation -fay-builder available on [Hackage](http://hackage.haskell.org/package/fay-builder), to install it:+fay-builder is available on [Hackage](http://hackage.haskell.org/package/fay-builder), to install it: ```shell cabal install fay-builder
fay-builder.cabal view
@@ -1,8 +1,9 @@ name: fay-builder-version: 0.1.0.7+version: 0.2 synopsis: Compile Fay code on cabal install, and ad-hoc recompile during development description: Compile Fay code on cabal install, and ad-hoc recompile during development-license: OtherLicense+license: BSD3+license-file: LICENSE author: Silk B.V. bug-reports: https://github.com/silkapp/fay-builder/issues maintainer: code@silk.co@@ -31,5 +32,6 @@ , directory >= 1.1 && < 1.3 , fay == 0.20.* , filepath == 1.3.*+ , safe == 0.3.* , split >= 0.2.2 && < 0.3 , text >= 0.11 && < 1.2
src/Fay/Builder.hs view
@@ -5,6 +5,7 @@ , listField_ , field , field_+ , readField , fayConfig , defaultFayHook , postBuildHook@@ -24,6 +25,7 @@ import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Setup import Fay+import Safe import qualified Distribution.PackageDescription.Parse as PD (readPackageDescription) import qualified Distribution.Verbosity as Verbosity @@ -34,11 +36,13 @@ -- | Compile code build :: PackageDescription -> Maybe FilePath -> IO () build packageDesc pkgDb = do- let packages = listField_ "x-fay-packages" packageDesc- roots = listField_ "x-fay-root-modules" packageDesc- includePaths = listField_ "x-fay-include-paths" packageDesc- sourceDir = field_ "x-fay-source-dir" packageDesc- outputDir = field_ "x-fay-output-dir" packageDesc+ let packages = listField_ "x-fay-packages" packageDesc+ roots = listField_ "x-fay-root-modules" packageDesc+ includePaths = listField_ "x-fay-include-paths" packageDesc+ sourceDir = field_ "x-fay-source-dir" packageDesc+ outputDir = field_ "x-fay-output-dir" packageDesc+ stricts = listField_ "x-fay-strict-modules" packageDesc+ lib = readField "x-fay-library" False packageDesc forM_ (zip roots [(1::Int)..]) $ \(name, i) -> do let candidate = sourceDir </> name <.> "hs"@@ -47,7 +51,7 @@ if exists then do putStrLn $ "fay: [" ++ show i ++ " of " ++ show (length roots) ++ "] Compiling " ++ name ++ " ( " ++ candidate ++ ", " ++ out ++ " )"- compileFromTo (fayConfig pkgDb packages sourceDir includePaths) candidate (Just out)+ compileFromTo (fayConfig pkgDb packages sourceDir includePaths stricts lib) candidate (Just out) else error $ "fay-builder: Could not find " ++ candidate @@ -59,7 +63,7 @@ listField_ :: String -> PackageDescription -> [String] listField_ fn = fromMaybe [] . listField fn --- | Tyr to read a field's value+-- | Try to read a field's value field :: String -> PackageDescription -> Maybe String field key = fmap strip . lookup key . customFieldsPD @@ -67,14 +71,19 @@ field_ :: String -> PackageDescription -> String field_ key = fromMaybe (error $ key ++ "is missing") . field key +readField :: Read a => String -> a -> PackageDescription -> a+readField key d = fromMaybe d . (readMay <=< field key)+ -- | Default config, TODO make this optional-fayConfig :: Maybe FilePath -> [String] -> FilePath -> [FilePath] -> Config-fayConfig pkgDb packages dir includePs =+fayConfig :: Maybe FilePath -> [String] -> FilePath -> [FilePath] -> [String] -> Bool -> Config+fayConfig pkgDb packages dir includePs stricts lib = addConfigDirectoryIncludePaths (dir : includePs) . addConfigPackages packages $ def { configWall = True , configPrettyPrint = True , configPackageConf = pkgDb+ , configStrict = stricts+ , configLibrary = lib } -- | Default build hook for your Setup.hs