codex 0.4.0.8 → 0.4.0.10
raw patch · 4 files changed
+30/−30 lines, 4 filesdep ~codexdep ~machines
Dependency ranges changed: codex, machines
Files
- codex.cabal +3/−3
- src/Codex.hs +3/−3
- src/Codex/Internal.hs +11/−0
- src/Codex/Project.hs +13/−24
codex.cabal view
@@ -1,5 +1,5 @@ name: codex-version: 0.4.0.8+version: 0.4.0.10 synopsis: A ctags file generator for cabal project dependencies. description: This tool download and cache the source code of packages in your local hackage,@@ -41,7 +41,7 @@ , hackage-db >= 1.22 && < 2 , http-client >= 0.4 && < 0.5 , lens >= 4.6 && < 5- , machines >= 0.2 && < 0.6+ , machines >= 0.2 && < 0.7 , machines-directory >= 0.0.0.2 && < 0.3 , process >= 1.2.3 && < 1.4 , tar >= 0.4.0.1 && < 0.6@@ -77,7 +77,7 @@ , transformers , wreq , yaml - , codex == 0.4.0.8+ , codex == 0.4.0.10 source-repository head type: git
src/Codex.hs view
@@ -68,9 +68,9 @@ taggerCmd :: Tagger -> String taggerCmd Ctags = "ctags --tag-relative=no --recurse -f \"$TAGS\" \"$SOURCES\""-taggerCmd Hasktags = "hasktags --ctags --output=\"$TAGS\" \"$SOURCES\""-taggerCmd HasktagsEmacs = "hasktags --etags --output=\"$TAGS\" \"$SOURCES\""-taggerCmd HasktagsExtended = "hasktags --ctags --extendedctag --output=\"$TAGS\" \"$SOURCES\""+taggerCmd Hasktags = "hasktags --ctags --follow-symlinks --output=\"$TAGS\" \"$SOURCES\""+taggerCmd HasktagsEmacs = "hasktags --etags --follow-symlinks --output=\"$TAGS\" \"$SOURCES\""+taggerCmd HasktagsExtended = "hasktags --ctags --follow-symlinks --extendedctag --output=\"$TAGS\" \"$SOURCES\"" taggerCmdRun :: Codex -> FilePath -> FilePath -> Action FilePath taggerCmdRun cx sources tags' = do
src/Codex/Internal.hs view
@@ -9,6 +9,7 @@ import Data.Char (isSpace) import Data.Yaml+import Data.Maybe (mapMaybe) import Distribution.Package import Distribution.Text import GHC.Generics@@ -71,3 +72,13 @@ readStackPath :: String -> IO String readStackPath id' = init <$> readCreateProcess (shell ("stack path --" ++ id')) ""++stackListDependencies :: IO [PackageIdentifier]+stackListDependencies = do+ s <- readCreateProcess (shell ("stack list-dependencies")) ""+ return $ mapMaybe parsePackageIdentifier $ lines s+ where+ parsePackageIdentifier line =+ let line' = map (\c -> if c == ' ' then '-' else c)+ line+ in simpleParse line'
src/Codex/Project.hs view
@@ -17,11 +17,8 @@ import Distribution.PackageDescription.Parse import Distribution.Sandbox.Utils (findSandbox) import Distribution.Simple.Configure-import Distribution.Simple.Compiler import Distribution.Simple.LocalBuildInfo import Distribution.Simple.PackageIndex-import Distribution.Simple.Program (defaultProgramConfiguration)-import Distribution.Simple.Setup import Distribution.Verbosity import Distribution.Version import System.Directory@@ -30,7 +27,7 @@ import qualified Data.List as List import qualified Data.Map as Map -import Codex.Internal (Builder(..), readStackPath)+import Codex.Internal (Builder(..), stackListDependencies) newtype Workspace = Workspace [WorkspaceProject] deriving (Eq, Show)@@ -78,26 +75,18 @@ resolveInstalledDependencies :: Builder -> FilePath -> GenericPackageDescription -> IO (Either SomeException [PackageIdentifier]) resolveInstalledDependencies bldr root pd = try $ do- lbi <- case bldr of- Cabal -> withCabal- Stack -> withStack- let ipkgs = installedPkgs lbi- clbis = snd <$> allComponentsInBuildOrder lbi- pkgs = componentPackageDeps =<< clbis- ys = (maybeToList . lookupInstalledPackageId ipkgs) =<< fmap fst pkgs- xs = fmap sourcePackageId $ ys- return xs where- withCabal = getPersistBuildConfig $ root </> "dist"- withStack = do- cfs <- getConfigFlags- configure (pd, emptyHookedBuildInfo) cfs- where- getConfigFlags = do- snapshotDb <- readStackPath "snapshot-pkg-db"- localDb <- readStackPath "local-pkg-db"- return $ (defaultConfigFlags defaultProgramConfiguration) {- configPackageDBs = Just . SpecificPackageDB <$> [snapshotDb, localDb]- }+ case bldr of+ Cabal -> do+ lbi <- withCabal+ let ipkgs = installedPkgs lbi+ clbis = snd <$> allComponentsInBuildOrder lbi+ pkgs = componentPackageDeps =<< clbis+ ys = (maybeToList . lookupInstalledPackageId ipkgs) =<< fmap fst pkgs+ xs = fmap sourcePackageId $ ys+ return xs where+ withCabal = getPersistBuildConfig $ root </> "dist"+ Stack -> let self = package (packageDescription pd)+ in filter (/=self) <$> stackListDependencies resolveHackageDependencies :: Hackage -> GenericPackageDescription -> [GenericPackageDescription] resolveHackageDependencies db pd = maybeToList . resolveDependency db =<< allDependencies pd where