packages feed

shake-ext 0.4.0.0 → 0.4.0.1

raw patch · 5 files changed

+29/−7 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Development.Shake.ATS: atsBin :: [String] -> String -> String -> Rules ()
+ Development.Shake.FileDetect: getDhall :: Action [FilePath]
+ Development.Shake.Linters: checkDhall :: FilePath -> Action ()
- Development.Shake.ATS: cgen :: Rules ()
+ Development.Shake.ATS: cgen :: FilePath -> Rules ()

Files

shake-ext.cabal view
@@ -1,5 +1,5 @@ name:                shake-ext-version:             0.4.0.0+version:             0.4.0.1 synopsis:            Helper functions for linting with shake  description:         This package provides several linters out of the box, as well as functionality for building ATS source files with [shake](http://shakebuild.com/). homepage:            https://hub.darcs.net/vmchale/shake-ext
src/Development/Shake/ATS.hs view
@@ -3,12 +3,14 @@ module Development.Shake.ATS ( cgen                              , cgenPretty                              , cleanATS+                             , atsBin                              , patsHome                              ) where  import           Control.Monad              (filterM, forM_) import           Data.Either                (fromRight) import           Data.Maybe                 (fromMaybe)+import           Data.Semigroup             (Semigroup (..)) import           Development.Shake import           Development.Shake.FilePath import           Language.ATS@@ -22,11 +24,20 @@ -- TODO install the whole compiler? atsCommand :: CmdResult r => String -> String -> Action r atsCommand sourceFile out = do-    home <- patsHome+    let home = "/usr/local/lib/ats2-postiats-0.3.8"     let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]-        patsc = home ++ "/bin/patsopt"+        patsc = "patsopt" -- home ++ "/bin/patsopt"     command atsArgs patsc ["--output", out, "-dd", sourceFile, "-cc"] +atsBin :: [String] -> String -> String -> Rules ()+atsBin libs sourceFile out =+    out %> \_ -> do+        need [sourceFile]+        let home = "/usr/local/lib/ats2-postiats-0.3.8"+        cmd_ ["mkdir", "-p", dropDirectory1 out]+        let toLibs = fmap ("-l" <>)+        command [EchoStderr False, AddEnv "PATSHOME" home] "patscc" ([sourceFile, "-atsccomp", "gcc -flto -I/usr/local/lib/ats2-postiats-0.3.8/ccomp/runtime/ -I/usr/local/lib/ats2-postiats-0.3.8/", "-DATS_MEMALLOC_LIBC", "-o", out, "-cleanaft", "-O2", "-mtune=native"] <> toLibs libs)+ cleanATS :: Rules () cleanATS = @@ -38,13 +49,13 @@  -- | This provides rules for generating C code from ATS source files in the -- @ats-src@ directory.-cgen :: Rules ()-cgen = do+cgen :: FilePath -> Rules ()+cgen dir = do      atsDeps      "//*.c" %> \out -> do-        let sourceFile = "ats-src/" ++ (dropDirectory1 out -<.> "dats")+        let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")         need [sourceFile]         atsCommand sourceFile out 
src/Development/Shake/C.hs view
@@ -10,4 +10,5 @@     need [src]     home <- patsHome     let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]-    command atsArgs "gcc" ["-flto", "-I" ++ home ++ "/ccomp/runtime", "-I" ++ home, "-o", target, "-O2"]+    command atsArgs "gcc" [src, "-flto", "-I" ++ home ++ "/ccomp/runtime", "-I" ++ home, "-o", target, "-O2"]+        -- cmd ["strip", out]
src/Development/Shake/FileDetect.hs view
@@ -8,11 +8,15 @@     , getHappy     , getAlex     , getShell+    , getDhall     ) where  import           Control.Composition import           Data.Semigroup      ((<>)) import           Development.Shake++getDhall :: Action [FilePath]+getDhall = getAll ["dhall"]  getYml :: Action [FilePath] getYml = getAll ["yaml", "yml", "yamllint"]
src/Development/Shake/Linters.hs view
@@ -7,6 +7,7 @@                                  , ghc                                  , atsfmt                                  , stylishHaskell+                                 , checkDhall                                  , module Development.Shake.FileDetect                                  ) where @@ -14,6 +15,11 @@ import           Data.Char                    (isSpace) import           Development.Shake import           Development.Shake.FileDetect++checkDhall :: FilePath -> Action ()+checkDhall dh = do+    contents <- liftIO $ readFile dh+    command [Stdin contents] "dhall" []  trim :: String -> String trim = join fmap f