packages feed

shake-ats 1.3.0.0 → 1.3.0.1

raw patch · 5 files changed

+24/−25 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Development.Shake.ATS: [hasPretty] :: ATSToolConfig -> Bool
- Development.Shake.ATS: ATSToolConfig :: Version -> Version -> ATSToolConfig
+ Development.Shake.ATS: ATSToolConfig :: Version -> Version -> Bool -> ATSToolConfig
- Development.Shake.ATS: atsLex :: Rules ()
+ Development.Shake.ATS: atsLex :: FilePattern -> Rules ()

Files

shake-ats.cabal view
@@ -1,5 +1,5 @@ name:                shake-ats-version:             1.3.0.0+version:             1.3.0.1 synopsis:            Utilities for building ATS projects with shake description:         Various helper functions for building [ATS](http://www.ats-lang.org/) with the [shake](http://shakebuild.com/) library homepage:            https://github.com/vmchale/shake-ats#readme
src/Development/Shake/ATS.hs view
@@ -47,7 +47,7 @@ atsCommand tc sourceFile out = do     h <- patsHome (compilerVer tc)     let home = h ++ "lib/ats2-postiats-" ++ show (libVersion tc)-    let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]+        atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]         patsc = home ++ "/bin/patsopt"     command atsArgs patsc ["--output", out, "-dd", sourceFile, "-cc"] @@ -58,7 +58,7 @@ -- Copy source files to the appropriate place. This is necessary because -- @#include@s in ATS are weird. copySources :: ATSToolConfig -> [FilePath] -> Action ()-copySources (ATSToolConfig v v') sources =+copySources (ATSToolConfig v v' _) sources =     forM_ sources $ \dep -> do         h <- patsHome v'         let home = h ++ "lib/ats2-postiats-" ++ show v@@ -81,7 +81,6 @@     hsExtra = bool ["--make", "-odir", ".atspkg", "-no-hs-main", "-package-db", "~/.cabal/store/ghc-" ++ ghcVersion ++ "/package.db/"] mempty noHs     noHs = null fc --- TODO ideally cache C files and use `gcc` on them? atsBin :: BinaryTarget -> Rules () atsBin BinaryTarget{..} = do @@ -96,9 +95,12 @@         h' <- pkgHome         let home = h ++ "lib/ats2-postiats-" ++ show (libVersion toolConfig)         sources <- transitiveDeps (snd <$> genTargets) [src]-        need (sources ++ (TL.unpack . objectFile <$> hsLibs))+        b' <- doesFileExist "atspkg.dhall"+        let hb = bool id ("atspkg.dhall" :) b'+        need (hb (sources ++ (TL.unpack . objectFile <$> hsLibs)))         copySources toolConfig sources +        let ccommand = unwords [ cc, "-I" ++ h ++ "ccomp/runtime/", "-I" ++ h, "-I" ++ h' ++ "include", "-L" ++  h' ++ "lib", "-L" ++ home ++ "/ccomp/atslib/lib"]         cmd_ ["mkdir", "-p", dropDirectory1 binTarget]         path <- fromMaybe "" <$> getEnv "PATH"         let toLibs = fmap ("-l" <>)@@ -107,7 +109,7 @@             [EchoStderr False, AddEnv "PATSHOME" home, AddEnv "PATH" (home ++ "/bin:" ++ path), AddEnv "PATSHOMELOCS" $ patsHomeLocs 5]             (home ++ "/bin/patscc")             (mconcat-                [ [src, "-atsccomp", cc ++ " -I" ++ h ++ "/ccomp/runtime/ -I" ++ h ++ " -L" ++ h' ++ "/lib" ++ " -L" ++ home ++ "/ccomp/atslib/lib", "-o", binTarget, "-cleanaft"]+                [ [src, "-atsccomp", ccommand, "-o", binTarget, "-cleanaft"]                 , makeCFlags cFlags hsLibs "8.2.2" gc                 , toLibs libs'                 ])@@ -153,7 +155,7 @@          let sourceFile = dir ++ "/" ++ (takeBaseName out -<.> "dats")         handleSource tc sourceFile-        (Exit c, Stderr err) :: (Exit, Stderr String) <- atsCommand tc sourceFile out+        (Exit c, Stderr err, Stdout _) :: (Exit, Stderr String, Stdout String) <- atsCommand tc sourceFile out         cmd_ [Stdin err] Shell "pats-filter"         if c /= ExitSuccess             then error "patscc failure"
src/Development/Shake/ATS/Environment.hs view
@@ -3,8 +3,8 @@                                          , patsHome                                          ) where -import           Data.Maybe                  (fromMaybe)-import qualified Data.Text.Lazy              as TL+import           Data.Maybe                 (fromMaybe)+import qualified Data.Text.Lazy             as TL import           Development.Shake import           Development.Shake.ATS.Type import           Development.Shake.FilePath
src/Development/Shake/ATS/Rules.hs view
@@ -12,8 +12,8 @@ import           Development.Shake.ATS.Type hiding (BinaryTarget (..)) import           Development.Shake.Cabal import           Development.Shake.FilePath-import           System.Directory           (copyFile, createDirectoryIfMissing, doesDirectoryExist, listDirectory) import           Language.ATS.Generate+import           System.Directory           (copyFile, createDirectoryIfMissing, doesDirectoryExist, listDirectory)  -- | Given a plain Haskell source file, generate a @.sats@ file containing -- analogous types.@@ -35,6 +35,7 @@             ss <- mapM getSubdirs ds'             pure $ ds' <> join ss +-- TODO - copy the .ghc.environment.* file to the current directory cabalExport :: ForeignCabal -> Rules () cabalExport (ForeignCabal cf' obf') = do @@ -58,17 +59,15 @@         liftIO $ copyFile hdr (takeDirectory out ++ "/" ++ takeFileName hdr)  -- | Build a @.lats@ file.-atsLex :: Rules ()-atsLex =-    "*.dats" %> \out -> do+atsLex :: FilePattern -> Rules ()+atsLex fp =+    fp %> \out -> do         lats <- liftIO $ readFile (out -<.> "lats")         (Stdout contents) <- command [Stdin lats] "atslex" []         liftIO $ writeFile out contents  cleanATS :: Rules ()-cleanATS =--    "clean" ~> do-        removeFilesAfter "." ["//*.c", "//tags"]-        removeFilesAfter ".atspkg" ["//*"]-        removeFilesAfter "ats-deps" ["//*"]+cleanATS = "clean" ~> do+    removeFilesAfter "." ["//*.c", "//tags"]+    removeFilesAfter ".atspkg" ["//*"]+    removeFilesAfter "ats-deps" ["//*"]
src/Development/Shake/ATS/Type.hs view
@@ -3,7 +3,6 @@   -- gcc -c -o lib1.o lib1.c--- ar rcs libout.a out1.o out2.o -- gcc ats-src/libnumbertheory.o -shared -o ats-src/libnumbertheory.so -- gcc number-theory-ffi_dats.c -c -fPIC -o ats-src/libnumbertheory.o -IATS2-Postiats-include-0.3.8/ -IATS2-Postiats-include-0.3.8/ccomp/runtime/ @@ -13,7 +12,6 @@                                   , ArtifactType (..)                                   , ATSToolConfig (..)                                   ) where- import           Data.Binary    (Binary (..)) import           Data.List      (intercalate) import qualified Data.Text.Lazy as TL@@ -53,8 +51,8 @@ -- | Information about where to find @patscc@ and @patsopt@. data ATSToolConfig = ATSToolConfig { libVersion  :: Version                                    , compilerVer :: Version-                                   -- , hasPretty   :: Bool -- ^ Whether to display errors via @pats-filter@-                                   }+                                   , hasPretty   :: Bool -- ^ Whether to display errors via @pats-filter@+                                   } deriving (Generic, Binary)  data BinaryTarget = BinaryTarget { cc         :: String -- ^ C compiler to be used.                                  , cFlags     :: [String] -- ^ Flags to be passed to the C compiler@@ -66,12 +64,12 @@                                  , genTargets :: [(String, String)] -- ^ Files to be run through @hs2ats@.                                  , binTarget  :: String -- ^ Binary target                                  , cDeps      :: [String] -- ^ Any C files necessary to compile the target-                                 }+                                 } deriving (Generic, Binary)  -- | Data type containing information about Haskell components of a build. data ForeignCabal = ForeignCabal { cabalFile  :: TL.Text -- ^ @.cabal@ file associated with the library                                  , objectFile :: TL.Text -- ^ Object file to be generated-                                 }+                                 } deriving (Eq, Show, Generic, Binary)  newtype Version = Version [Integer]     deriving (Eq, Generic, Binary)