packages feed

cdeps 0.1.2.4 → 0.1.3.0

raw patch · 8 files changed

+60/−25 lines, 8 filesdep +criteriondep ~basePVP ok

version bump matches the API change (PVP)

Dependencies added: criterion

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Language.C.Dependency: getIncludesStr :: String -> Either String [FilePath]

Files

CHANGELOG.md view
@@ -1,5 +1,13 @@ # cdeps +## 0.1.3.0++  * Add `getIncludesStr` function++## 0.1.2.5++  * Add benchmark suite+ ## 0.1.2.4    * No nested comments since C doesn't have them
LICENSE view
@@ -1,4 +1,4 @@-Copyright Vanessa McHale (c) 2018+Copyright Vanessa McHale (c) 2018-2019  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 
README.md view
@@ -1,4 +1,8 @@ # cdeps +[![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/cdeps/badge)](https://matrix.hackage.haskell.org/package/cdeps)+[![Hackage](https://img.shields.io/hackage/v/cdeps.svg)](http://hackage.haskell.org/package/cdeps)+[![Dependencies of latest version on Hackage](https://img.shields.io/hackage-deps/v/cdeps.svg)](https://hackage.haskell.org/package/cdeps)+ This package provides the ability to extract C dependencies from source code. It can be used with [shake](https://shakebuild.com) or for other purposes.
app/Main.hs view
@@ -57,4 +57,4 @@     <> header "cdeps - a tool for tracking build dependencies")  main :: IO ()-main = execParser wrapper >>= run+main = run =<< execParser wrapper
+ bench/Bench.hs view
@@ -0,0 +1,16 @@+module Main (main) where++import           Criterion.Main+import qualified Data.ByteString.Lazy  as BSL+import           Language.C.Dependency (getAll, getIncludes)++main :: IO ()+main =+    defaultMain [ env file $ \ f ->+                  bgroup "getIncludes"+                      [ bench "lzlib.c" $ nf getIncludes f ]+                , bgroup "getAll"+                      [ bench "lzlib.c" $ nfIO (getAll [] "bench/data/lzlib.c") ]+                ]+    where file = BSL.readFile "bench/data/sqlite3.c"+
cdeps.cabal view
@@ -1,9 +1,9 @@ cabal-version:   1.18 name:            cdeps-version:         0.1.2.4+version:         0.1.3.0 license:         BSD3 license-file:    LICENSE-copyright:       Copyright: (c) 2018 Vanessa McHale+copyright:       Copyright: (c) 2018-2019 Vanessa McHale maintainer:      vamchale@gmail.com author:          Vanessa McHale synopsis:        Extract dependencies from C code.@@ -18,18 +18,13 @@  source-repository head     type:     darcs-    location: https://hub.darcs.net/vamchale/cdeps+    location: https://hub.darcs.net/vmchale/cdeps  flag cross     description: Set this flag when cross-compiling     default:     False     manual:      True -flag development-    description: Enable `-Werror`-    default:     False-    manual:      True- library     exposed-modules:  Language.C.Dependency     hs-source-dirs:   src@@ -47,9 +42,6 @@     if !flag(cross)         build-tools: alex -any -    if (flag(development) && impl(ghc <8.4))-        ghc-options: -Werror-     if impl(ghc >=8.0)         ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -67,9 +59,6 @@         cdeps -any,         optparse-applicative -any -    if (flag(development) && impl(ghc <8.4))-        ghc-options: -Werror-     if impl(ghc >=8.0)         ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -87,8 +76,22 @@         cdeps -any,         hspec -any -    if flag(development)-        ghc-options: -Werror+    if impl(ghc >=8.0)+        ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates++    if impl(ghc >=8.4)+        ghc-options: -Wmissing-export-lists++benchmark cdeps-bench+    type:             exitcode-stdio-1.0+    main-is:          Bench.hs+    hs-source-dirs:   bench+    default-language: Haskell2010+    build-depends:+        base -any,+        cdeps -any,+        bytestring -any,+        criterion -any      if impl(ghc >=8.0)         ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates
src/Language/C/Dependency.x view
@@ -2,6 +2,7 @@ {-# OPTIONS_GHC -fno-warn-unused-imports #-} module Language.C.Dependency ( getIncludes                              , getIncludesText+                             , getIncludesStr                              , getCDepends                              , getAll                              ) where@@ -34,16 +35,15 @@  tokens :- -    $white+                      ;-    "//".*                       ;+    $white+                        ;+    "//".*                         ; -    -- FIXME: no nested comments in C     "/*" @comment_inner_char* "*/" ; -    @include                     { \_ _ -> alex Include }-    @string                      { tok (\_ s -> alex (StringTok (TL.unpack (decodeUtf8 s)))) }+    @include                       { \_ _ -> alex Include }+    @string                        { tok (\_ s -> alex (StringTok (TL.unpack (decodeUtf8 s)))) } -    $printable                   ;+    $printable                     ;  { @@ -65,6 +65,10 @@  getIncludesText :: TL.Text -> Either String [FilePath] getIncludesText = getIncludes . encodeUtf8++-- | @since 0.1.3.0+getIncludesStr :: String -> Either String [FilePath]+getIncludesStr = getIncludesText . TL.pack  extractDeps :: [Token] -> [FilePath] extractDeps [] = []
test/Spec.hs view
@@ -11,4 +11,4 @@         it "should work (2/3)" $             getIncludes "#include \\\n\"gmp.cats\"" `shouldBe` Right ["gmp.cats"]         it "should work (3/3)" $-            getIncludes "/* block commend /* */\n#include \\\n\"gmp.cats\"" `shouldBe` Right ["gmp.cats"]+            getIncludes "/* block comment /* */\n#include \\\n\"gmp.cats\"" `shouldBe` Right ["gmp.cats"]