summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmchale <>2018-09-08 03:37:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-09-08 03:37:00 (GMT)
commitdf492c875f09e4f193b174403976eaa7a60c9fc8 (patch)
treef5dc74445238fa110c6e313d2d5bc7d338ec7f63
parentc15ca5c4d345167c9016b891e66e33e1049a7a48 (diff)
version 1.9.0.51.9.0.5
-rw-r--r--CHANGELOG.md13
-rw-r--r--shake-ats.cabal3
-rw-r--r--src/Development/Shake/ATS.hs12
-rw-r--r--src/Development/Shake/ATS/Rules.hs7
4 files changed, 31 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..b85c15a
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,13 @@
+# shake-ats
+
+## 1.9.0.5
+
+ * Bugfix for recent version of `shake-cabal`
+
+## 1.9.0.4
+
+ * Remove timestamp from generated `.c` files.
+
+## 1.9.0.3
+
+ * Use `getAppUserDirectory` for better portability
diff --git a/shake-ats.cabal b/shake-ats.cabal
index aa93ec2..ac126c6 100644
--- a/shake-ats.cabal
+++ b/shake-ats.cabal
@@ -1,6 +1,6 @@
cabal-version: 1.18
name: shake-ats
-version: 1.9.0.3
+version: 1.9.0.5
license: BSD3
license-file: LICENSE
copyright: Copyright: (c) 2018 Vanessa McHale
@@ -13,6 +13,7 @@ description:
category: Development, Build, ATS, Shake
build-type: Simple
extra-doc-files: README.md
+ CHANGELOG.md
source-repository head
type: darcs
diff --git a/src/Development/Shake/ATS.hs b/src/Development/Shake/ATS.hs
index 49dfdf7..93a8cf8 100644
--- a/src/Development/Shake/ATS.hs
+++ b/src/Development/Shake/ATS.hs
@@ -36,6 +36,8 @@ import Data.Either (fromRight)
import Data.Foldable
import Data.Maybe (fromMaybe)
import Data.Semigroup (Semigroup (..))
+import qualified Data.Text as T
+import qualified Data.Text.IO as TIO
import qualified Data.Text.Lazy as TL
import Development.Shake hiding (doesFileExist, getEnv)
import Development.Shake.ATS.Environment
@@ -62,7 +64,15 @@ atsCommand tc sourceFile out = do
Ignore -> ("--constraint-ignore":)
_ -> id
- command env patsc (f ["--output", out, "-dd", sourceFile, "-cc"] ++ _patsFlags tc)
+ (<*)
+ (command env patsc (f ["--output", out, "-dd", sourceFile, "-cc"] ++ _patsFlags tc))
+ (liftIO $ deleteLine out)
+
+-- TODO: consider removing and caching that?
+deleteLine :: FilePath -> IO ()
+deleteLine fp = TIO.writeFile fp . del =<< TIO.readFile fp
+ where del = T.unlines . fmap snd . filter p . zip [(1::Int)..] . T.lines
+ p = (4 /=) . fst
-- | Filter any generated errors with @pats-filter@.
withPF :: Action (Exit, Stderr String, Stdout String) -- ^ Result of a 'cmd' or 'command'
diff --git a/src/Development/Shake/ATS/Rules.hs b/src/Development/Shake/ATS/Rules.hs
index 56f16d2..3600918 100644
--- a/src/Development/Shake/ATS/Rules.hs
+++ b/src/Development/Shake/ATS/Rules.hs
@@ -6,8 +6,10 @@ module Development.Shake.ATS.Rules ( atsLex
, genLinks
) where
+import Control.Arrow (second)
import Control.Monad
import Data.Foldable
+import Data.List (isSuffixOf)
import Data.Semigroup (Semigroup (..))
import qualified Data.Text.Lazy as TL
import Development.Shake hiding (doesDirectoryExist)
@@ -61,7 +63,8 @@ cabalForeign (GHC _ suff) (ForeignCabal cbp' cf' obf') = do
libName = takeBaseName cf
obf %> \out -> do
- (v, trDeps) <- liftIO $ getCabalDeps cf
+ let isHaskell path = not (".cabal" `isSuffixOf` path)
+ (v, trDeps) <- liftIO $ second (filter isHaskell) <$> getCabalDeps cf
ghcV' <- quietly ghcVersion
let ghcV = maybe ghcV' (drop 1) suff
@@ -80,7 +83,7 @@ cabalForeign (GHC _ suff) (ForeignCabal cbp' cf' obf') = do
let hdr = dropExtension obj ++ "_stub.h"
liftIO $ copyFile hdr (takeDirectory out </> takeFileName hdr)
-cabalForeign _ _ = mempty -- FXIME error here?
+cabalForeign _ _ = error "CCompiler must be GHC"
-- | Build a @.lats@ file using @atslex@.
atsLex :: FilePath -- ^ Filepath of @.lats@ file