ats-pkg 1.0.0.0 → 1.1.0.0
raw patch · 5 files changed
+32/−23 lines, 5 filesdep ~shake-extPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: shake-ext
API changes (from Hackage documentation)
- Language.ATS.Package.Exec: compiler :: IO ()
+ Language.ATS.Package: Version :: [Integer] -> Version
+ Language.ATS.Package: newtype Version
+ Language.ATS.Package.Exec: buildAll :: IO ()
- Language.ATS.Package: fetchCompiler :: IO ()
+ Language.ATS.Package: fetchCompiler :: Version -> IO ()
- Language.ATS.Package: nuke :: IO ()
+ Language.ATS.Package: nuke :: Version -> IO ()
- Language.ATS.Package: setupCompiler :: IO ()
+ Language.ATS.Package: setupCompiler :: Version -> IO ()
Files
- ats-pkg.cabal +2/−2
- src/Language/ATS/Package.hs +21/−13
- src/Language/ATS/Package/Exec.hs +7/−7
- src/Language/ATS/Package/Type.hs +1/−0
- stack.yaml +1/−1
ats-pkg.cabal view
@@ -1,5 +1,5 @@ name: ats-pkg-version: 1.0.0.0+version: 1.1.0.0 synopsis: Package manager for ATS description: A collection of scripts to make building ATS projects easy. homepage: https://github.com/vmchale/ats-pkg#readme@@ -43,7 +43,7 @@ , parallel-io , unix , dhall- , shake-ext >= 1.0.0.0+ , shake-ext >= 1.1.0.0 , composition-prelude >= 1.1.0.1 default-language: Haskell2010 if flag(development)
src/Language/ATS/Package.hs view
@@ -5,6 +5,7 @@ , nuke , fetchCompiler , setupCompiler+ , Version (..) ) where import qualified Codec.Archive.Tar as Tar@@ -20,20 +21,21 @@ import System.Posix.Files import System.Process -nuke :: IO ()-nuke = do+nuke :: Version -> IO ()+nuke v = do putStrLn "Cleaning everything..."- b <- doesDirectoryExist =<< compilerDir+ b <- doesDirectoryExist =<< compilerDir v when b- (removeDirectoryRecursive =<< compilerDir)+ (removeDirectoryRecursive =<< compilerDir v) newtype Version = Version [Integer] instance Show Version where show (Version is) = intercalate "." (show <$> is) -compilerDir :: IO FilePath-compilerDir = (++ "/.atspkg/compiler") <$> getEnv "HOME"+-- TODO depend on version+compilerDir :: Version -> IO FilePath+compilerDir v = (++ ("/.atspkg/" ++ show v)) <$> getEnv "HOME" packageCompiler :: FilePath -> IO () packageCompiler directory = do@@ -41,27 +43,32 @@ bytes <- fmap Tar.write . Tar.pack directory $ fmap (drop $ length (directory :: String) + 1) files BS.writeFile (directory ++ ".tar.gz") (compress bytes) -fetchCompiler :: IO ()-fetchCompiler = do+pkgUrl :: Version -> String+pkgUrl v = "https://github.com/vmchale/fastcat/releases/download/0.1.5/ATS2-Postiats-" ++ show v ++ ".tar.gz" - cd <- compilerDir+-- "https://downloads.sourceforge.net/project/ats2-lang/ats2-lang/ats2-postiats-" ++ show v ++ "/ATS2-Postiats-" ++ show v ++ ".tgz"++fetchCompiler :: Version -> IO ()+fetchCompiler v = do++ cd <- compilerDir v needsSetup <- not <$> doesDirectoryExist cd when needsSetup $ do putStrLn "Fetching compiler..." manager <- newManager tlsManagerSettings- initialRequest <- parseRequest "https://github.com/vmchale/fastcat/releases/download/0.1.5/ATS2-Postiats-0.3.8.tar.gz"+ initialRequest <- parseRequest $ pkgUrl v -- "https://github.com/vmchale/fastcat/releases/download/0.1.5/ATS2-Postiats-0.3.8.tar.gz" response <- responseBody <$> httpLbs (initialRequest { method = "GET" }) manager putStrLn "Unpacking compiler..." Tar.unpack cd . Tar.read . decompress $ response -setupCompiler :: IO ()-setupCompiler = do+setupCompiler :: Version -> IO ()+setupCompiler v = do putStrLn "configuring compiler..."- cd <- compilerDir+ cd <- compilerDir v let configurePath = cd ++ "/configure" setFileMode configurePath ownerModes setFileMode (cd ++ "/autogen.sh") ownerModes@@ -70,3 +77,4 @@ putStrLn "building compiler..." void $ readCreateProcess ((proc "make" []) { cwd = Just cd, std_err = CreatePipe }) ""+ void $ readCreateProcess ((proc "make" ["install"]) { cwd = Just cd, std_err = CreatePipe }) ""
src/Language/ATS/Package/Exec.hs view
@@ -1,5 +1,5 @@ module Language.ATS.Package.Exec ( exec- , compiler+ , buildAll ) where import Data.Bool (bool)@@ -11,15 +11,15 @@ check :: IO Bool check = do home <- getEnv "HOME"- doesFileExist (home ++ "/.atspkg/compiler/bin/patsopt")+ doesFileExist (home ++ "/.atspkg/0.3.8/bin/patscc") -- FIXME version exec :: IO ()-exec = mkPkg+exec = bool (buildAll >> mkPkg) mkPkg =<< check -compiler :: IO ()-compiler = bool buildAll printConfig =<< check+latest :: Version+latest = Version [0,3,8] buildAll :: IO () buildAll =- fetchCompiler >>- setupCompiler+ fetchCompiler latest >>+ setupCompiler latest
src/Language/ATS/Package/Type.hs view
@@ -24,6 +24,7 @@ options :: ShakeOptions options = shakeOptions { shakeFiles = ".atspkg" , shakeThreads = 4+ , shakeProgress = progressSimple } mkPkg :: IO ()
stack.yaml view
@@ -3,7 +3,7 @@ packages: - '.' extra-deps:- - shake-ext-1.0.0.0+ - shake-ext-1.1.0.0 - composition-prelude-1.1.0.1 - language-ats-0.1.0.3 flags: