ats-pkg 2.0.0.6 → 2.0.0.7
raw patch · 7 files changed
+38/−27 lines, 7 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Language.ATS.Package: build :: [String] -> IO ()
+ Language.ATS.Package: buildAll :: Maybe FilePath -> IO ()
Files
- README.md +2/−2
- ats-pkg.cabal +1/−1
- src/Language/ATS/Package.hs +2/−0
- src/Language/ATS/Package/Build.hs +24/−2
- src/Language/ATS/Package/Dependency.hs +3/−2
- src/Language/ATS/Package/Exec.hs +4/−18
- stack.yaml +2/−2
README.md view
@@ -10,7 +10,7 @@ The easiest way to install is via a script, viz. ```bash- $ curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | bash -s+curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | bash -s ``` Alternately, you can download@@ -18,7 +18,7 @@ [GHC](https://www.haskell.org/ghc/download.html) and install with ```bash- $ cabal new-install ats-pkg --symlink-bindir ~/.local/bin+cabal new-install ats-pkg --symlink-bindir ~/.local/bin ``` ## Examples
ats-pkg.cabal view
@@ -1,5 +1,5 @@ name: ats-pkg-version: 2.0.0.6+version: 2.0.0.7 synopsis: Package manager for ATS description: A collection of scripts to make building ATS projects easy. homepage: https://github.com/vmchale/ats-pkg#readme
src/Language/ATS/Package.hs view
@@ -2,6 +2,8 @@ , pkgToAction , fetchCompiler , setupCompiler+ , build+ , buildAll -- * Types , Version (..) , Pkg (..)
src/Language/ATS/Package/Build.hs view
@@ -2,7 +2,9 @@ module Language.ATS.Package.Build ( mkPkg , pkgToAction- , getConfig+ , build+ , buildAll+ , check ) where import Control.Composition@@ -21,10 +23,30 @@ import Development.Shake.FilePath import Development.Shake.Man import Dhall hiding (bool)+import Language.ATS.Package.Compiler import Language.ATS.Package.Dependency import Language.ATS.Package.Type import System.Directory (doesFileExist, getCurrentDirectory)+import qualified System.Environment as SE +check :: Maybe FilePath -> IO Bool+check p = do+ home <- SE.getEnv "HOME"+ v <- wants p+ doesFileExist (home ++ "/.atspkg/" ++ show v ++ "/bin/patscc")++wants :: Maybe FilePath -> IO Version+wants p = compiler <$> getConfig p++-- | Build in current directory or indicated directory+buildAll :: Maybe FilePath -> IO ()+buildAll p = on (>>) (=<< wants p) fetchCompiler setupCompiler++-- | Build a set of targets+build :: [String] -- ^ Targets+ -> IO ()+build rs = bool (mkPkg [buildAll Nothing] rs) (mkPkg mempty rs) =<< check Nothing+ -- TODO clean generated ATS mkClean :: Rules () mkClean =@@ -123,7 +145,7 @@ unless (rs == ["clean"]) $ let cdps = if any gc bs then libcAtomicOps : libcGC (Version [7,6,4]) : cds else cds in- liftIO $ fetchDeps False setup ds cdps >> stopGlobalPool+ liftIO $ fetchDeps False setup ds cdps (null as) >> stopGlobalPool mapM_ g (bs ++ ts) let bins = TL.unpack . target <$> bs
src/Language/ATS/Package/Dependency.hs view
@@ -39,9 +39,10 @@ -> [IO ()] -- ^ Setup steps that can be performed concurrently -> [Dependency] -- ^ ATS dependencies -> [Dependency] -- ^ C Dependencies+ -> Bool -- ^ Whether to perform setup anyhow. -> IO ()-fetchDeps b setup' deps cdeps =- unless (null deps && null cdeps) $ do+fetchDeps b setup' deps cdeps b' =+ unless (null deps && null cdeps && b') $ do putStrLn "Checking ATS dependencies..." d <- (<> "lib/") <$> pkgHome let libs' = fmap (buildHelper b) deps
src/Language/ATS/Package/Exec.hs view
@@ -15,11 +15,9 @@ import Language.ATS.Package.Build import Language.ATS.Package.Compiler import Language.ATS.Package.Dependency-import Language.ATS.Package.Type hiding (test, version) import Options.Applicative hiding (auto) import Paths_ats_pkg import System.Directory-import System.Environment (getEnv) import System.IO.Temp (withSystemTempDirectory) wrapper :: ParserInfo Command@@ -43,13 +41,13 @@ (command "install" (info (pure Install) (progDesc "Install all binaries to $HOME/.local/bin")) <> command "clean" (info (pure Clean) (progDesc "Clean current project directory")) <> command "remote" (info fetch (progDesc "Fetch and install a binary package"))- <> command "build" (info build (progDesc "Build current package targets"))+ <> command "build" (info build' (progDesc "Build current package targets")) <> command "test" (info (pure Test) (progDesc "Test current package")) <> command "nuke" (info (pure Nuke) (progDesc "Uninstall all globally installed libraries")) ) -build :: Parser Command-build = Build+build' :: Parser Command+build' = Build <$> many (argument str (metavar "TARGET"@@ -64,12 +62,6 @@ (metavar "URL" <> help "URL pointing to a tarball containing the package to be installed.") -check :: Maybe FilePath -> IO Bool-check p = do- home <- getEnv "HOME"- v <- want p- doesFileExist (home ++ "/.atspkg/" ++ show v ++ "/bin/patscc")- getSubdirs :: FilePath -> IO [FilePath] getSubdirs p = do ds <- listDirectory p@@ -80,7 +72,7 @@ fetchPkg :: String -> IO () fetchPkg pkg = withSystemTempDirectory "atspkg" $ \p -> do let (lib, dirName, url') = ("atspkg", p, pkg) & each %~ TL.pack- fetchDeps True mempty [Dependency lib dirName url' undefined] []+ fetchDeps True mempty [Dependency lib dirName url' undefined] [] True ps <- getSubdirs p pkgDir <- fromMaybe p <$> findFile (p:ps) "atspkg.dhall" let a = withCurrentDirectory (takeDirectory pkgDir) (mkPkg mempty ["install"])@@ -99,9 +91,3 @@ g (Build ts _) = ts g Test = ["test"] g _ = undefined--want :: Maybe FilePath -> IO Version-want p = compiler <$> getConfig p--buildAll :: Maybe FilePath -> IO ()-buildAll p = on (>>) (=<< want p) fetchCompiler setupCompiler
stack.yaml view
@@ -4,9 +4,9 @@ - '.' extra-deps: - shake-ext-1.5.0.0- - shake-ats-0.3.0.5+ - shake-ats-0.3.0.6 - composition-prelude-1.1.0.2- - language-ats-0.1.1.8+ - language-ats-0.1.1.9 - cli-setup-0.1.0.3 - hs2ats-0.2.0.0 flags: