shake-ats 1.8.0.6 → 1.9.0.0
raw patch · 6 files changed
+22/−75 lines, 6 filesdep +shake-cdep −microlens-thdep ~shake-extPVP ok
version bump matches the API change (PVP)
Dependencies added: shake-c
Dependencies removed: microlens-th
Dependency ranges changed: shake-ext
API changes (from Hackage documentation)
- Development.Shake.ATS: atsTarget :: Lens' ATSGen FilePath
- Development.Shake.ATS: binTarget :: Lens' ATSTarget FilePath
- Development.Shake.ATS: cFlags :: Lens' ATSTarget [String]
- Development.Shake.ATS: cc :: Lens' ATSToolConfig CCompiler
- Development.Shake.ATS: cpphs :: Lens' ATSGen Bool
- Development.Shake.ATS: gc :: Lens' ATSTarget Bool
- Development.Shake.ATS: genTargets :: Lens' ATSTarget [ATSGen]
- Development.Shake.ATS: hasPretty :: Lens' ATSToolConfig Bool
- Development.Shake.ATS: hsFile :: Lens' ATSGen FilePath
- Development.Shake.ATS: hsLibs :: Lens' ATSTarget [ForeignCabal]
- Development.Shake.ATS: libs :: Lens' ATSTarget [String]
- Development.Shake.ATS: linkATSLib :: Lens' ATSToolConfig Bool
- Development.Shake.ATS: linkStatic :: Lens' ATSToolConfig Bool
- Development.Shake.ATS: linkTargets :: Lens' ATSTarget [HATSGen]
- Development.Shake.ATS: otherDeps :: Lens' ATSTarget [FilePath]
- Development.Shake.ATS: patsFlags :: Lens' ATSToolConfig [String]
- Development.Shake.ATS: patsHome :: Lens' ATSToolConfig String
- Development.Shake.ATS: patsHomeLocs :: Lens' ATSToolConfig String
- Development.Shake.ATS: solver :: Lens' ATSToolConfig Solver
- Development.Shake.ATS: src :: Lens' ATSTarget [FilePath]
- Development.Shake.ATS: strip :: Lens' ATSTarget Bool
- Development.Shake.ATS: tgtType :: Lens' ATSTarget ArtifactType
- Development.Shake.ATS: toolConfig :: Lens' ATSTarget ATSToolConfig
Files
- shake-ats.cabal +4/−5
- src/Development/Shake/ATS.hs +9/−33
- src/Development/Shake/ATS/Environment.hs +2/−2
- src/Development/Shake/ATS/Generate.hs +1/−1
- src/Development/Shake/ATS/Rules.hs +4/−4
- src/Development/Shake/ATS/Type.hs +2/−30
shake-ats.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: shake-ats-version: 1.8.0.6+version: 1.9.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale@@ -35,22 +35,21 @@ Development.Shake.ATS.Generate default-language: Haskell2010 other-extensions: RecordWildCards DeriveGeneric DeriveAnyClass- TemplateHaskell ghc-options: -Wall build-depends: base >=4.9 && <5, hashable -any, language-ats -any,- shake-ext >=2.9.0.0,+ shake-ext >=3.0.0.0, hs2ats >=0.2.0.1, directory -any, microlens -any,- microlens-th -any, text -any, dependency -any, shake >=0.14, binary -any,- shake-cabal -any+ shake-cabal -any,+ shake-c -any if flag(development) ghc-options: -Werror
src/Development/Shake/ATS.hs view
@@ -26,30 +26,6 @@ , ATSGen (..) , HATSGen (..) , Solver (..)- -- * Lenses- , atsTarget- , cFlags- , binTarget- , cc- , gc- , hasPretty- , genTargets- , hsLibs- , patsHome- , patsHomeLocs- , libs- , linkStatic- , linkTargets- , otherDeps- , src- , tgtType- , toolConfig- , cpphs- , hsFile- , strip- , solver- , linkATSLib- , patsFlags ) where import Control.Arrow@@ -69,7 +45,7 @@ import Development.Shake.FilePath import Development.Shake.Version import Language.ATS-import Lens.Micro+-- import Lens.Micro import System.Directory (copyFile, createDirectoryIfMissing, doesFileExist) import System.Environment (getEnv) import System.Exit (ExitCode (ExitSuccess))@@ -108,8 +84,8 @@ copySources :: ATSToolConfig -> [FilePath] -> Action () copySources ATSToolConfig{..} sources = forM_ sources $ \dep -> do- liftIO $ createDirectoryIfMissing True (_patsHome ++ "/" ++ takeDirectory dep)- liftIO $ copyFile dep (_patsHome ++ "/" ++ dep)+ liftIO $ createDirectoryIfMissing True (_patsHome </> takeDirectory dep)+ liftIO $ copyFile dep (_patsHome </> dep) makeCFlags :: [String] -- ^ Inputs -> [ForeignCabal] -- ^ Haskell libraries@@ -118,9 +94,9 @@ -> [String] makeCFlags ss fc ghcV' b = gcFlag' : (hsExtra <> ss) where gcFlag' = bool ("-optc" <>) id noHs $ gcFlag b- hsExtra = bool (["--make", "-I.", "-odir", ".atspkg", "-no-hs-main", "-package-db", "~/.cabal/store/ghc-" ++ ghcV' ++ "/package.db/"] ++ packageDbs) mempty noHs+ hsExtra = bool (["--make", "-I.", "-odir", ".atspkg", "-no-hs-main", "-package-db", "~/.cabal/store/ghc-" ++ ghcV' </> "package.db/"] ++ packageDbs) mempty noHs noHs = null fc- packageDbs = (\x -> ["-package-db", x ++ "/dist-newstyle/packagedb/ghc-" ++ ghcV']) =<< libToDirs fc+ packageDbs = (\x -> ["-package-db", x </> "dist-newstyle" </> "packagedb" </> "ghc-" ++ ghcV']) =<< libToDirs fc libToDirs :: [ForeignCabal] -> [String] libToDirs = fmap (takeDirectory . TL.unpack . h)@@ -144,16 +120,16 @@ f = bool id ("atslib":) (_linkATSLib tc) h' <- pkgHome cc' let libs'' = f $ bool libs' ("gc" : libs') gc'- pure $ CConfig [h ++ "/ccomp/runtime/", h, h' ++ "include", ".atspkg/contrib"] libs'' [h' ++ "lib", _patsHome tc ++ "/ccomp/atslib/lib"] extras (_linkStatic tc)+ pure $ CConfig [h </> "ccomp" </> "runtime", h, h' </> "include", ".atspkg" </> "contrib"] libs'' [h' </> "lib", _patsHome tc </> "ccomp" </> "atslib" </> "lib"] extras (_linkStatic tc) patsEnv :: ATSToolConfig -> FilePath -> [CmdOption] patsEnv cfg path = EchoStderr False : zipWith AddEnv ["PATSHOME", "PATH", "PATSHOMELOCS", "LIBGMP"]- [_patsHome cfg, _patsHome cfg ++ "/bin:" ++ path, _patsHomeLocs cfg ]+ [_patsHome cfg, _patsHome cfg </> "bin:" ++ path, _patsHomeLocs cfg ] atsToC :: FilePath -> FilePath-atsToC = (-<.> "c") . (".atspkg/c/" <>)+atsToC = (-<.> "c") . ((".atspkg" </> "c") </>) ghcV :: CCompiler -> [ForeignCabal] -> Action String ghcV (GHC _ suff) hsLibs' = maybe def' (fmap (drop 1)) (pure <$> suff) where@@ -198,7 +174,7 @@ cconfig' <- cconfig _toolConfig _libs _gc (makeCFlags _cFlags mempty (pure undefined) _gc) - let atsGen = (hatsFile <$> _linkTargets) <> ((^.atsTarget) <$> _genTargets)+ let atsGen = (hatsFile <$> _linkTargets) <> (_atsTarget <$> _genTargets) atsExtras = _otherDeps <> (TL.unpack . objectFile <$> _hsLibs) zipWithM_ (cgen _toolConfig atsExtras atsGen) _src cTargets
src/Development/Shake/ATS/Environment.hs view
@@ -13,12 +13,12 @@ -- installed artifacts. This is used to keep libraries built for different -- platforms separate. ccToDir :: CCompiler -> String-ccToDir (GCC (Just s)) = reverse (drop 1 $ reverse s) ++ "/"+ccToDir (GCC (Just s)) = reverse (drop 1 $ reverse s) ++ [pathSeparator] ccToDir _ = "" -- | The directory @~/.atspkg@ pkgHome :: MonadIO m => CCompiler -> m String-pkgHome cc' = liftIO $ (++ ("/.atspkg/" ++ ccToDir cc')) <$> getEnv "HOME"+pkgHome cc' = liftIO $ (</> (".atspkg" </> ccToDir cc')) <$> getEnv "HOME" fixDir :: FilePath -> String -> String fixDir p =
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]) 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
@@ -44,7 +44,7 @@ case ds of [] -> pure [] xs -> do- ds' <- filterM doesDirectoryExist (((p <> "/") <>) <$> xs)+ ds' <- filterM doesDirectoryExist ((p </>) <$> xs) ss <- mapM getSubdirs ds' pure $ ds' <> join ss @@ -69,17 +69,17 @@ command_ [Cwd obfDir] "cabal" ["new-build", "all", "-w", "ghc-" ++ ghcV] -- TODO move this to the @shake-ext@ package?- let subdir = takeDirectory cbp ++ "/"+ let subdir = takeDirectory cbp correctDir = (== "build") endsBuild = correctDir . last . splitPath- pkgDir = subdir ++ "dist-newstyle/build/" ++ platform ++ "/ghc-" ++ ghcV ++ "/" ++ libName ++ "-" ++ prettyShow v ++ "/"+ pkgDir = subdir </> "dist-newstyle" </> "build" </> platform </> "ghc-" ++ ghcV </> libName ++ "-" ++ prettyShow v dir <- filter endsBuild <$> liftIO (getSubdirs pkgDir) let obj = head dir ++ "/" ++ takeFileName obf liftIO $ copyFile obj out let hdr = dropExtension obj ++ "_stub.h"- liftIO $ copyFile hdr (takeDirectory out ++ "/" ++ takeFileName hdr)+ liftIO $ copyFile hdr (takeDirectory out </> takeFileName hdr) cabalForeign _ _ = mempty -- | Build a @.lats@ file using @atslex@.
src/Development/Shake/ATS/Type.hs view
@@ -1,7 +1,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE DeriveAnyClass #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-} module Development.Shake.ATS.Type ( ForeignCabal (..) , Version (..)@@ -11,30 +10,6 @@ , ATSGen (..) , HATSGen (..) , Solver (..)- -- * Lenses- , atsTarget- , hasPretty- , cFlags- , otherDeps- , toolConfig- , cc- , linkStatic- , src- , gc- , binTarget- , genTargets- , hsLibs- , libs- , patsHome- , patsHomeLocs- , tgtType- , linkTargets- , cpphs- , hsFile- , strip- , solver- , linkATSLib- , patsFlags ) where import Data.Binary (Binary (..))@@ -43,7 +18,6 @@ import qualified Data.Text.Lazy as TL import Development.Shake.C import GHC.Generics (Generic)-import Lens.Micro.TH -- We should have four build types: --@@ -125,5 +99,3 @@ , cabalFile :: TL.Text -- ^ @.cabal@ file associated with the library , objectFile :: TL.Text -- ^ Object file to be generated } deriving (Eq, Show, Generic, Binary, Hashable)--mconcat <$> traverse makeLenses [''ATSGen, ''ATSTarget, ''ATSToolConfig]