packages feed

implicit-hie-cradle 0.2.0.1 → 0.3.0.0

raw patch · 3 files changed

+18/−52 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for implicit-hie-cradle +## 0.3.0.0+Match `implicit-hie`'s cradle type ordering.+This is technically a breaking change.+ ## 0.2.0.0  - @jneira updated hie-bios 0.5.1 => 0.7.0
implicit-hie-cradle.cabal view
@@ -7,7 +7,7 @@ -- hash: 5c092074b2128d5593e67e2ace6e214ab27a89b73a7a71a71b212a4b34868b86  name:               implicit-hie-cradle-version:            0.2.0.1+version:            0.3.0.0 description:        Auto generate a stack or cabal multi component cradles category:           Development, Tools, Hie, HLS synopsis:           Auto generate hie-bios cradles
src/Hie/Implicit/Cradle.hs view
@@ -16,32 +16,17 @@ import Control.Monad import Control.Monad.IO.Class import Control.Monad.Trans.Maybe-import Data.List import Data.Maybe-import Data.Ord (Down (..))-import qualified Data.Text as T import Data.Void-import qualified Data.Yaml as Yaml-import GHC.Fingerprint (fingerprintString) import HIE.Bios.Config hiding (cabalComponent, stackComponent) import HIE.Bios.Cradle-import HIE.Bios.Environment (getCacheDir) import HIE.Bios.Types hiding (ActionName (..))-import qualified HIE.Bios.Types as Types-import HIE.Bios.Wrappers import Hie.Cabal.Parser import Hie.Locate import Hie.Yaml import System.Directory hiding (findFile)-import System.Environment-import System.Exit import System.FilePath-import System.IO import System.IO.Error (isPermissionError)-import System.IO.Temp-import System.Info.Extra (isWindows)-import System.PosixCompat.Files-import System.Process  -- | Given root\/foo\/bar.hs, load an implicit cradle loadImplicitHieCradle :: FilePath -> IO (Cradle a)@@ -67,7 +52,7 @@     --   <|> (Bazel,) <$> rulesHaskellWorkDir fp     <|> (cabalExecutable >> cabalProjectDir fp >> cabalDistDir fp >>= cabal)     <|> (stackExecutable >> stackYamlDir fp >> stackWorkDir fp >>= stack)-    <|> (cabalExecutable >> cabalProjectDir fp >>= cabal)+    <|> (cabalExecutable >> (cabalProjectDir fp <|> cabalDistDir fp) >>= cabal)     <|> (stackExecutable >> stackYamlDir fp >>= stack)     <|> (cabalExecutable >> cabalFile fp >>= cabal)   where@@ -86,24 +71,8 @@      cabalComponent' n c = CabalType . Just <$> cabalComponent n c     stackComponent' n c = flip StackType Nothing . Just <$> stackComponent n c---------------------------------------------------------------------------- Cabal Cradle--- Works for new-build by invoking `v2-repl` does not support components--- yet.-cabalCradleDependencies :: FilePath -> IO [FilePath]-cabalCradleDependencies rootDir = do-  cabalFiles <- findCabalFiles rootDir-  return $ cabalFiles ++ ["cabal.project", "cabal.project.local"] -findCabalFiles :: FilePath -> IO [FilePath]-findCabalFiles wdir = do-  dirContent <- listDirectory wdir-  return $ filter ((== ".cabal") . takeExtension) dirContent---- | GHC process information.--- Consists of the filepath to the ghc executable and--- arguments to the executable.-type GhcProc = (FilePath, [String])+------------------------------------------------------------------------  cabalExecutable :: MaybeT IO FilePath cabalExecutable = MaybeT $ findExecutable "cabal"@@ -117,7 +86,9 @@ cabalProjectDir :: FilePath -> MaybeT IO FilePath cabalProjectDir = findFileUpwards isCabal   where-    isCabal name = name == "cabal.project"+    isCabal "cabal.project" = True+    isCabal "cabal.project.local" = True+    isCabal _ = False  cabalFile :: FilePath -> MaybeT IO FilePath cabalFile = findFileUpwards isCabal@@ -128,17 +99,6 @@ -- Stack Cradle -- Works for by invoking `stack repl` with a wrapper script -stackCradleDependencies :: FilePath -> IO [FilePath]-stackCradleDependencies wdir = do-  cabalFiles <- findCabalFiles wdir-  return $ cabalFiles ++ ["package.yaml", "stack.yaml"]--combineExitCodes :: [ExitCode] -> ExitCode-combineExitCodes = foldr go ExitSuccess-  where-    go ExitSuccess b = b-    go a _ = a- stackExecutable :: MaybeT IO FilePath stackExecutable = MaybeT $ findExecutable "stack" @@ -156,17 +116,19 @@ -- to match the predicate. findSubdirUpwards :: (FilePath -> Bool) -> FilePath -> MaybeT IO FilePath findSubdirUpwards p dir = findContentUpwards p' dir-  where p' subdir = do-          exists <- doesDirectoryExist $ dir </> subdir-          return $ (p subdir) && exists+  where+    p' subdir = do+      exists <- doesDirectoryExist $ dir </> subdir+      return $ (p subdir) && exists  -- | Searches upwards for the first directory containing a file to match -- the predicate. findFileUpwards :: (FilePath -> Bool) -> FilePath -> MaybeT IO FilePath findFileUpwards p dir = findContentUpwards p' dir-  where p' file = do-          exists <- doesFileExist $ dir </> file-          return $ (p file) && exists+  where+    p' file = do+      exists <- doesFileExist $ dir </> file+      return $ (p file) && exists  findContentUpwards :: (FilePath -> IO Bool) -> FilePath -> MaybeT IO FilePath findContentUpwards p dir = do