ats-pkg 2.4.0.3 → 2.4.0.6
raw patch · 11 files changed
+122/−13 lines, 11 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Language.ATS.Package: checkPkg :: FilePath -> Bool -> IO ATSDependency
Files
- README.md +29/−5
- ats-pkg.cabal +3/−1
- config.dhall +1/−0
- src/Language/ATS/Package.hs +2/−0
- src/Language/ATS/Package/Build.hs +2/−2
- src/Language/ATS/Package/Config.hs +3/−2
- src/Language/ATS/Package/Dhall.hs +13/−0
- src/Language/ATS/Package/Exec.hs +19/−2
- src/Language/ATS/Package/Type.hs +10/−0
- src/Quaalude.hs +39/−0
- stack.yaml +1/−1
README.md view
@@ -71,6 +71,34 @@ Note that `$HOME/.local/bin` will need to be on your `PATH`. +## Examples++### Quick Start++Install [pi](http://github.com/vmchale/project-init) with++```+curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git vmchale/project-init+```++Initialize an ATS project with++```+pi new ats project+```++Then build & run it:++```+cd project+atspkg run+```++### Further Documentation++You can find several examples with explanation+[here](https://github.com/vmchale/atspkg/blob/master/EXAMPLES.md)+ ## Global Configuration `atspkg` is configured via a file in `~/.config/atspkg/config.dhall`. You can@@ -79,6 +107,7 @@ ``` let cfg = { defaultPkgs = "https://raw.githubusercontent.com/vmchale/atspkg/master/pkgs/pkg-set.dhall"+ , path = ([] : Optional Text) } in cfg@@ -86,8 +115,3 @@ Package sets are simply sets of packages, so you can also use Dhall to concatenate custom package sets with the above.--## Examples--You can find several examples with explanation-[here](https://github.com/vmchale/atspkg/blob/master/EXAMPLES.md)
ats-pkg.cabal view
@@ -1,5 +1,5 @@ name: ats-pkg-version: 2.4.0.3+version: 2.4.0.6 synopsis: A build tool for ATS description: A collection of scripts to simplify building ATS projects. homepage: https://github.com/vmchale/atspkg#readme@@ -41,6 +41,8 @@ , Language.ATS.Package.Upgrade , Language.ATS.Package.Config , Language.ATS.Package.PackageSet+ , Language.ATS.Package.Dhall+ , Quaalude build-depends: base >= 4.7 && < 5 , http-client , bytestring
config.dhall view
@@ -1,6 +1,7 @@ let cfg = { defaultPkgs = "https://raw.githubusercontent.com/vmchale/atspkg/master/pkgs/pkg-set.dhall" , path = ([] : Optional Text)+ , githubUsername = "" } in cfg
src/Language/ATS/Package.hs view
@@ -10,6 +10,7 @@ , fetchDeps , mkBuildPlan , buildHelper+ , checkPkg -- * Types , Version (..) , Pkg (..)@@ -25,6 +26,7 @@ import Language.ATS.Package.Build import Language.ATS.Package.Compiler import Language.ATS.Package.Dependency+import Language.ATS.Package.Dhall import Language.ATS.Package.PackageSet import Language.ATS.Package.Type import Language.ATS.Package.Upgrade
src/Language/ATS/Package/Build.hs view
@@ -11,7 +11,6 @@ , check ) where -import Control.Composition import Control.Concurrent.ParallelIO.Global import Control.Lens import Control.Monad.IO.Class (MonadIO)@@ -35,6 +34,7 @@ import Language.ATS.Package.Dependency import Language.ATS.Package.Type hiding (version) import Paths_ats_pkg+import Quaalude import System.Directory (doesFileExist, getCurrentDirectory) import qualified System.Environment as SE @@ -229,7 +229,7 @@ targets = fmap (((cedar <> "/") <>) . (-<.> "c") . takeBaseName . TL.unpack) as want targets hasPF <- patsFilter- mapM_ (cgen $ ATSToolConfig v v' hasPF (ccFromString cc')) atsSourceDirs+ mapM_ (cgen (ATSToolConfig v v' hasPF (ccFromString cc')) [".atspkg/deps", ".atspkg/config"]) atsSourceDirs cc' = maybe (TL.unpack ccLocal) (<> "-gcc") tgt deps = (".atspkg/deps":) . (".atspkg/config":) . fmap TL.unpack
src/Language/ATS/Package/Config.hs view
@@ -18,8 +18,9 @@ import System.Directory (createDirectoryIfMissing) import System.Environment (getEnv) -data UserConfig = UserConfig { defaultPkgs :: Text- , path :: Maybe Text+data UserConfig = UserConfig { defaultPkgs :: Text+ , path :: Maybe Text+ , githubUsername :: Text } deriving (Generic, Interpret, Binary) cfgFile :: String
+ src/Language/ATS/Package/Dhall.hs view
@@ -0,0 +1,13 @@+module Language.ATS.Package.Dhall ( checkPkg+ ) where++import Data.Bool (bool)+import qualified Data.Text.Lazy as TL+import Dhall hiding (bool)+import Language.ATS.Package.Type++checkPkg :: FilePath -> Bool -> IO ATSDependency+checkPkg path details = do+ x <- input auto (TL.pack ('.' : '/' : path))+ let f = bool id detailed details+ f (pure (x :: ATSDependency))
src/Language/ATS/Package/Exec.hs view
@@ -43,6 +43,7 @@ | Upgrade | Valgrind { _targets :: [String] } | Run { _targets :: [String] }+ | Check { _filePath :: String, _details :: Bool } command' :: Parser Command command' = hsubparser@@ -55,8 +56,19 @@ <> command "upgrade" (info (pure Upgrade) (progDesc "Upgrade to the latest version of atspkg")) <> command "valgrind" (info valgrind (progDesc "Run generated binaries through valgrind")) <> command "run" (info run' (progDesc "Run generated binaries"))+ <> command "check" (info check' (progDesc "Check pkg.dhall file to ensure it is well-typed.")) ) +check' :: Parser Command+check' = Check+ <$> targetP completions id "check"+ <*> switch+ (long "detailed"+ <> short 'd'+ <> help "Enable detailed error messages")++ where completions = completer (bashCompleter "file -X '!*.dhall' -o plusdirs")+ run' :: Parser Command run' = Run <$> targets "run" @@ -67,10 +79,14 @@ valgrind = Valgrind <$> targets "run with valgrind" targets :: String -> Parser [String]-targets s = many+targets = targetP mempty many++targetP :: Mod ArgumentFields String -> (Parser String -> a) -> String -> a+targetP completions f s = f (argument str (metavar "TARGET"- <> help ("Targets to " <> s)))+ <> help ("Targets to " <> s)+ <> completions)) build' :: Parser Command build' = Build@@ -124,6 +140,7 @@ =<< check Nothing run :: Command -> IO ()+run (Check p b) = print =<< checkPkg p b run Upgrade = upgradeAtsPkg run Nuke = cleanAll run (Fetch u) = fetchPkg u
src/Language/ATS/Package/Type.hs view
@@ -55,6 +55,7 @@ deriving instance Interpret ForeignCabal + data Bin = Bin { src :: Text -- ^ Source file (should end with @.dats@) , target :: Text -- ^ Binary to be built , libs :: [Text] -- ^ Libraries to link against (e.g. @[ "pthread" ]@)@@ -65,6 +66,15 @@ , extras :: [Text] -- ^ Extra source files the build depends on } deriving (Show, Eq, Generic, Interpret, Binary)++-- data Lib = Lib { src :: [Text] -- ^ Source files (should end with @.dats@) to be compiled to object files+-- , target :: Text+-- , hsDeps :: [ForeignCabal] -- ^ Haskell @.cabal@ files associated with object files+-- , hs2ats :: [TargetPair] -- ^ Sources and targets for @hs2ats@+-- , cSources :: [Text] -- ^ C source files the build depends on+-- , extras :: [Text] -- ^ Other source files the build depends on+-- }+-- deriving (Show, Eq, Generic, Interpret, Binary) -- TODO make binaries optional -- | Data type associated with @atspkg.dhall@ file.
+ src/Quaalude.hs view
@@ -0,0 +1,39 @@+{-# LANGUAGE CPP #-}++module Quaalude ( bool+ , void+ , unless+ , when+ , join+ , zipWithM+ , pack+ , unpack+ , encode+ , decode+ , fromMaybe+ , isPrefixOf+ , isSuffixOf+ , on+ , Text+ , Generic+ , Binary+ , (.*)+ , (<>)+ , (***)+ , (&&&)+ , first+ , second+ ) where++import Control.Arrow+#if __GLASGOW_HASKELL__ < 804+import Data.Semigroup+#endif+import Control.Composition+import Control.Monad+import Data.Binary+import Data.Bool (bool)+import Data.List (isPrefixOf, isSuffixOf)+import Data.Maybe (fromMaybe)+import Data.Text.Lazy (pack, unpack)+import Dhall hiding (bool)
stack.yaml view
@@ -1,5 +1,5 @@ ----resolver: lts-10.4+resolver: lts-10.5 packages: - '.' - 'dependency'