ats-setup 0.3.0.0 → 0.3.0.1
raw patch · 3 files changed
+17/−2 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Distribution.ATS: atsLibUserHooks :: [ATSDependency] -> UserHooks
Files
- ats-setup.cabal +1/−1
- src/Distribution/ATS.hs +13/−0
- src/Distribution/ATS/Compiler.hs +3/−1
ats-setup.cabal view
@@ -1,5 +1,5 @@ name: ats-setup-version: 0.3.0.0+version: 0.3.0.1 synopsis: ATS scripts for Cabal builds description: This package contains various scripts that go in a package's @Setup.hs@ to make building libraries with ATS dependencies easier. license: BSD3
src/Distribution/ATS.hs view
@@ -2,6 +2,7 @@ module Distribution.ATS ( cleanATSCabal , atsUserHooks+ , atsLibUserHooks , fetchDependencies -- * Types , ATSVersion@@ -22,6 +23,7 @@ import Control.Concurrent.ParallelIO.Global import Control.Monad import Data.Bool+import qualified Data.Dependency as Dep import Data.List (intercalate) import Distribution.ATS.Compiler import Distribution.PackageDescription@@ -48,6 +50,12 @@ putStrLn "Cleaning up ATS dependencies..." >> cleanATSCabal +fetchCompiler' :: IO ()+fetchCompiler' = fetchCompiler (Just "ats-deps") (Dep.Version [0,3,9])++setupCompiler' :: IO ()+setupCompiler' = setupCompiler (Just "ats-deps") (Dep.Version [0,3,9])+ -- | This generates user hooks for a Cabal distribution that has some ATS -- library dependencies. For an example of its use, see the @Setup.hs@ of -- [fast-arithmetic](https://hackage.haskell.org/package/fast-arithmetic)@@ -56,6 +64,11 @@ , postBuild = \_ _ _ -> maybeCleanBuild } +-- | Same as 'atsUserHooks', but installs @atslib@ as well.+atsLibUserHooks :: [ATSDependency] -> UserHooks+atsLibUserHooks deps = simpleUserHooks { preConf = \_ _ -> mconcat [ fetchCompiler', setupCompiler', fetchDependencies deps ] >> pure emptyHookedBuildInfo+ , postBuild = \_ _ _ -> maybeCleanBuild+ } -- TODO custom directory? cleanATSCabal :: IO () cleanATSCabal = do
src/Distribution/ATS/Compiler.hs view
@@ -13,6 +13,7 @@ import qualified Data.ByteString.Lazy as BS import Data.Dependency import Data.Maybe (fromMaybe)+import Data.Semigroup import Network.HTTP.Client hiding (decompress) import Network.HTTP.Client.TLS (tlsManagerSettings) import System.Directory@@ -22,8 +23,9 @@ import System.Process compilerDir :: Maybe FilePath -> Version -> IO FilePath-compilerDir mp v = fromMaybe <$> def <*> pure mp+compilerDir mp v = makeAbsolute =<< dir where def = (++ ("/.atspkg/" ++ show v)) <$> getEnv "HOME"+ dir = fromMaybe <$> def <*> pure ((<> ('/' : show v)) <$> mp) packageCompiler :: FilePath -> IO () packageCompiler directory = do