packages feed

shake-ats 1.8.0.2 → 1.8.0.4

raw patch · 5 files changed

+33/−29 lines, 5 filesdep ~basedep ~shake-ext

Dependency ranges changed: base, shake-ext

Files

shake-ats.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: shake-ats-version: 1.8.0.2+version: 1.8.0.4 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale@@ -34,9 +34,11 @@         Development.Shake.ATS.Environment         Development.Shake.ATS.Generate     default-language: Haskell2010+    other-extensions: RecordWildCards DeriveGeneric DeriveAnyClass+                      TemplateHaskell     ghc-options: -Wall     build-depends:-        base >=4.11 && <5,+        base >=4.9 && <5,         hashable -any,         language-ats -any,         shake-ext >=2.9.0.0,
src/Development/Shake/ATS.hs view
@@ -1,8 +1,5 @@ {-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}-{-# LANGUAGE FlexibleInstances    #-}-{-# LANGUAGE RecordWildCards      #-}-{-# LANGUAGE ScopedTypeVariables  #-}-{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE RecordWildCards #-}  module Development.Shake.ATS ( -- * Shake Rules                                atsBin@@ -52,6 +49,7 @@                              , strip                              , solver                              , linkATSLib+                             , patsFlags                              ) where  import           Control.Arrow@@ -88,7 +86,7 @@                 Ignore -> ("--constraint-ignore":)                 _      -> id -    command env patsc (f ["--output", out, "-dd", sourceFile, "-cc"])+    command env patsc (f ["--output", out, "-dd", sourceFile, "-cc"] ++ _patsFlags tc)  -- | Filter any generated errors with @pats-filter@. withPF :: Action (Exit, Stderr String, Stdout String) -- ^ Result of a 'cmd' or 'command'@@ -107,10 +105,10 @@ -- Copy source files to the appropriate place. This is necessary because -- @#include@s in ATS are weird. copySources :: ATSToolConfig -> [FilePath] -> Action ()-copySources (ATSToolConfig home' _ _ _ _ _ _) sources =+copySources ATSToolConfig{..} sources =     forM_ sources $ \dep -> do-        liftIO $ createDirectoryIfMissing True (home' ++ "/" ++ takeDirectory dep)-        liftIO $ copyFile dep (home' ++ "/" ++ dep)+        liftIO $ createDirectoryIfMissing True (_patsHome ++ "/" ++ takeDirectory dep)+        liftIO $ copyFile dep (_patsHome ++ "/" ++ dep)  makeCFlags :: [String] -- ^ Inputs            -> [ForeignCabal] -- ^ Haskell libraries@@ -157,10 +155,12 @@ atsToC :: FilePath -> FilePath atsToC = (-<.> "c") . (".atspkg/c/" <>) -ghcV :: [ForeignCabal] -> Action String-ghcV hsLibs' = case hsLibs' of-    [] -> pure undefined-    _  -> ghcVersion+ghcV :: CCompiler -> [ForeignCabal] -> Action String+ghcV (GHC _ suff) hsLibs' = maybe def' (fmap (drop 1)) (pure <$> suff) where+    def' = case hsLibs' of+        [] -> pure undefined+        _  -> quietly ghcVersion+ghcV _ _ = pure undefined  doLib :: ArtifactType -> Rules () -> Rules () doLib Executable = pure mempty@@ -184,7 +184,7 @@      mapM_ hsAts _genTargets -    mapM_ cabalForeign _hsLibs+    mapM_ (cabalForeign (_cc _toolConfig)) _hsLibs      let cTargets = atsToC <$> _src @@ -208,7 +208,7 @@          need (h' cTargets) -        ghcV' <- ghcV _hsLibs+        ghcV' <- ghcV (_cc _toolConfig) _hsLibs          cconfig'' <- cconfig _toolConfig _libs _gc (makeCFlags _cFlags _hsLibs ghcV' _gc) 
src/Development/Shake/ATS/Generate.hs view
@@ -8,7 +8,7 @@ generateLinks = fmap (printATS . generateLinks') . parseM  generateLinks' :: ATS a -> ATS a-generateLinks' (ATS ds) = ATS (fmap g ds <> [macDecl]) --  ATS [Local undefined (ATS (fmap g ds <> [macDecl])) (ATS mempty)]+generateLinks' (ATS ds) = ATS (fmap g ds ++ [macDecl]) --  ATS [Local undefined (ATS (fmap g ds ++ [macDecl])) (ATS mempty)]     where g f@Func{} = Extern undefined (set (fun.preF.expression) expr f)           g x        = x           expr = Just (StringLit "\"mac#\"")
src/Development/Shake/ATS/Rules.hs view
@@ -12,7 +12,8 @@ import           Development.Shake              hiding (doesDirectoryExist) import           Development.Shake.ATS.Generate import           Development.Shake.ATS.Type     hiding (ATSTarget (..))-import           Development.Shake.Cabal+import           Development.Shake.C+import           Development.Shake.Cabal        hiding (GHC) import           Development.Shake.FilePath import           Development.Shake.Version import           Language.ATS.Generate@@ -49,8 +50,8 @@  -- | These rules take a @.cabal@ file and the @.o@ file to be produced from -- them, building the @.o@ file.-cabalForeign :: ForeignCabal -> Rules ()-cabalForeign (ForeignCabal cbp' cf' obf') = do+cabalForeign :: CCompiler -> ForeignCabal -> Rules ()+cabalForeign (GHC _ suff) (ForeignCabal cbp' cf' obf') = do      let cf = TL.unpack cf'         cbp = maybe cf TL.unpack cbp'@@ -61,11 +62,13 @@     (v, trDeps) <- liftIO $ getCabalDeps cf     obf %> \out -> do +        ghcV' <- quietly ghcVersion+        let ghcV = maybe ghcV' (drop 1) suff+         need (cf : fmap ((obfDir <> "/") <>) trDeps)-        command_ [Cwd obfDir] "cabal" ["new-build", "all"]+        command_ [Cwd obfDir] "cabal" ["new-build", "all", "-w", "ghc-" ++ ghcV]          -- TODO move this to the @shake-ext@ package?-        ghcV <- quietly ghcVersion         let subdir = takeDirectory cbp ++ "/"             correctDir = (== "build")             endsBuild = correctDir . last . splitPath@@ -77,6 +80,7 @@          let hdr = dropExtension obj ++ "_stub.h"         liftIO $ copyFile hdr (takeDirectory out ++ "/" ++ takeFileName hdr)+cabalForeign _ _ = mempty  -- | Build a @.lats@ file using @atslex@. atsLex :: FilePath -- ^ Filepath of @.lats@ file
src/Development/Shake/ATS/Type.hs view
@@ -1,8 +1,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE DeriveAnyClass     #-}-{-# LANGUAGE DeriveGeneric      #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# LANGUAGE TemplateHaskell    #-}+{-# LANGUAGE DeriveAnyClass  #-}+{-# LANGUAGE DeriveGeneric   #-}+{-# LANGUAGE TemplateHaskell #-}  module Development.Shake.ATS.Type ( ForeignCabal (..)                                   , Version (..)@@ -35,6 +34,7 @@                                   , strip                                   , solver                                   , linkATSLib+                                  , patsFlags                                   ) where  import           Control.Lens@@ -72,9 +72,6 @@ -- -- * Also binary caches are good. -deriving instance Generic CCompiler-deriving instance Binary CCompiler- data ArtifactType = StaticLibrary                   | Executable                   | SharedLibrary@@ -93,6 +90,7 @@                                    , _linkStatic   :: Bool -- ^ Force static linking                                    , _solver       :: Solver                                    , _linkATSLib   :: Bool -- ^ Whether to link against atslib+                                   , _patsFlags :: [String] -- ^ Additional flags to pass to @patsopt@.                                    } deriving (Generic, Binary)  data HATSGen = HATSGen { satsFile :: FilePath -- ^ @.sats@ file containing type definitions