packages feed

shake-ats 0.2.0.4 → 0.3.0.0

raw patch · 2 files changed

+26/−3 lines, 2 filesdep +hs2atsdep ~language-atsPVP ok

version bump matches the API change (PVP)

Dependencies added: hs2ats

Dependency ranges changed: language-ats

API changes (from Hackage documentation)

+ Development.Shake.ATS: ghcExport :: String -> Rules ()
- Development.Shake.ATS: atsBin :: String -> [String] -> Version -> Version -> Bool -> [String] -> String -> String -> Rules ()
+ Development.Shake.ATS: atsBin :: String -> [String] -> Version -> Version -> Bool -> [String] -> String -> [String] -> [(String, String)] -> String -> Rules ()

Files

shake-ats.cabal view
@@ -1,5 +1,5 @@ name:                shake-ats-version:             0.2.0.4+version:             0.3.0.0 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@@ -25,6 +25,7 @@   build-depends:       base >= 4.7 && < 5                      , language-ats                      , shake-ext+                     , hs2ats                      , directory                      , text                      , shake
src/Development/Shake/ATS.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-} {-# LANGUAGE FlexibleInstances    #-} {-# LANGUAGE ScopedTypeVariables  #-} {-# LANGUAGE TypeSynonymInstances #-}@@ -8,6 +9,7 @@                              , cleanATS                              , atsBin                              , atsLex+                             , ghcExport                              -- * Actions                              , patsHome                              -- Types@@ -25,6 +27,7 @@ import           Development.Shake import           Development.Shake.FilePath import           Language.ATS+import           Language.ATS.Generate import           System.Directory           (copyFile, createDirectoryIfMissing) import           System.Exit                (ExitCode (ExitSuccess)) @@ -34,6 +37,17 @@ instance Show Version where     show (Version is) = intercalate "." (show <$> is) +genATS :: FilePath -> FilePath -> Rules ()+genATS src target =+    target %> \out -> liftIO $ do+        contents <- readFile src+        writeFile out (generateATS contents)++ghcExport :: String -> Rules ()+ghcExport m =+    [ m ++ "_stub.h", m ++ ".o" ] &%> \[_,out] ->+        command [Cwd (takeDirectory out)] "ghc" ["-c", "-O", takeBaseName out -<.> "hs" ]+ -- | The directory @~/.atspkg@ pkgHome :: Action String pkgHome = fromMaybe "/usr/local/" <$> mh@@ -76,16 +90,24 @@        -> Bool -- ^ Whether to use the garbage collector        -> [String] -- ^ A list of libraries against which to link        -> String -- ^ Source file+       -> [String] -- ^ Haskell dependencies to track+       -> [(String, String)] -- ^ Files to be run through @hs2ats@.        -> String -- ^ Binary target        -> Rules ()-atsBin cc cFlags v v' gc libs sourceFile out =+atsBin cc cFlags v v' gc libs sourceFile hs atg out = do +    unless (null atg) $+        mapM_ (uncurry genATS) atg++    unless (null hs) $+        mapM_ ghcExport ((-<.> "") <$> hs)+     out %> \_ -> do         sources <- transitiveDeps [sourceFile]         h <- patsHome v'         h' <- pkgHome         let home = h ++ "lib/ats2-postiats-" ++ show v-        need sources+        need (sources ++ hs)         copySources v v' sources         cmd_ ["mkdir", "-p", dropDirectory1 out]         path <- fromMaybe "" <$> getEnv "PATH"