packages feed

hie-bios 0.7.0 → 0.7.1

raw patch · 29 files changed

+55/−122 lines, 29 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # ChangeLog hie-bios +## 2020-09-01 - 0.7.1++* Add explicit type for stack.yaml location [#243](https://github.com/mpickering/hie-bios/pull/243)+  * In particular, fixes a regression with `hie.yaml` and standalone-files for stack+* Reduce noise in Extra-Source-File field [#239](https://github.com/mpickering/hie-bios/pull/239)+ ## 2020-08-27 - 0.7.0  ### New Features
hie-bios.cabal view
@@ -1,6 +1,6 @@ Cabal-Version:          2.2 Name:                   hie-bios-Version:                0.7.0+Version:                0.7.1 Author:                 Matthew Pickering <matthewtpickering@gmail.com> Maintainer:             Matthew Pickering <matthewtpickering@gmail.com> License:                BSD-3-Clause@@ -16,37 +16,12 @@                         README.md                         wrappers/cabal                         wrappers/cabal.hs-                        tests/configs/bazel.yaml-                        tests/configs/bios-1.yaml-                        tests/configs/bios-2.yaml-                        tests/configs/bios-3.yaml-                        tests/configs/bios-4.yaml-                        tests/configs/bios-5.yaml-                        tests/configs/cabal-1.yaml-                        tests/configs/cabal-multi.yaml-                        tests/configs/ch-cabal.yaml-                        tests/configs/ch-stack.yaml-                        tests/configs/default.yaml-                        tests/configs/dependencies.yaml-                        tests/configs/direct.yaml-                        tests/configs/multi.yaml-                        tests/configs/multi-ch.yaml-                        tests/configs/multi-stack-with-yaml.yaml-                        tests/configs/keys-not-unique-fails.yaml-                        tests/configs/nested-cabal-multi.yaml-                        tests/configs/nested-stack-multi.yaml-                        tests/configs/none.yaml-                        tests/configs/obelisk.yaml-                        tests/configs/stack-config.yaml-                        tests/configs/stack-multi.yaml-                        tests/configs/stack-with-both.yaml-                        tests/configs/stack-with-yaml.yaml+                        tests/configs/*.yaml                         tests/projects/symlink-test/a/A.hs                         tests/projects/symlink-test/hie.yaml                         tests/projects/multi-direct/A.hs                         tests/projects/multi-direct/B.hs                         tests/projects/multi-direct/hie.yaml-                        tests/projects/multi-cabal/Setup.hs                         tests/projects/multi-cabal/app/Main.hs                         tests/projects/multi-cabal/cabal.project                         tests/projects/multi-cabal/hie.yaml@@ -56,11 +31,8 @@                         tests/projects/monorepo-cabal/hie.yaml                         tests/projects/monorepo-cabal/A/Main.hs                         tests/projects/monorepo-cabal/A/A.cabal-                        tests/projects/monorepo-cabal/A/Setup.hs                         tests/projects/monorepo-cabal/B/MyLib.hs                         tests/projects/monorepo-cabal/B/B.cabal-                        tests/projects/monorepo-cabal/B/Setup.hs-                        tests/projects/multi-stack/Setup.hs                         tests/projects/multi-stack/app/Main.hs                         tests/projects/multi-stack/cabal.project                         tests/projects/multi-stack/hie.yaml@@ -75,26 +47,20 @@                         tests/projects/failing-cabal/failing-cabal.cabal                         tests/projects/failing-cabal/hie.yaml                         tests/projects/failing-cabal/MyLib.hs-                        tests/projects/failing-cabal/Setup.hs                         tests/projects/failing-stack/failing-stack.cabal                         tests/projects/failing-stack/hie.yaml                         tests/projects/failing-stack/src/Lib.hs-                        tests/projects/failing-stack/Setup.hs                         tests/projects/nested-cabal/nested-cabal.cabal                         tests/projects/nested-cabal/cabal.project                         tests/projects/nested-cabal/hie.yaml                         tests/projects/nested-cabal/MyLib.hs-                        tests/projects/nested-cabal/Setup.hs                         tests/projects/nested-cabal/sub-comp/sub-comp.cabal                         tests/projects/nested-cabal/sub-comp/Lib.hs-                        tests/projects/nested-cabal/sub-comp/Setup.hs                         tests/projects/nested-stack/nested-stack.cabal                         tests/projects/nested-stack/hie.yaml                         tests/projects/nested-stack/MyLib.hs-                        tests/projects/nested-stack/Setup.hs                         tests/projects/nested-stack/sub-comp/sub-comp.cabal                         tests/projects/nested-stack/sub-comp/Lib.hs-                        tests/projects/nested-stack/sub-comp/Setup.hs                         tests/projects/simple-bios/A.hs                         tests/projects/simple-bios/B.hs                         tests/projects/simple-bios/hie-bios.sh@@ -109,8 +75,6 @@                         tests/projects/simple-bios-shell/hie.yaml                         tests/projects/simple-cabal/A.hs                         tests/projects/simple-cabal/B.hs-                        tests/projects/simple-cabal/CHANGELOG.md-                        tests/projects/simple-cabal/Setup.hs                         tests/projects/simple-cabal/cabal.project                         tests/projects/simple-cabal/hie.yaml                         tests/projects/simple-cabal/simple-cabal.cabal@@ -119,17 +83,13 @@                         tests/projects/simple-direct/hie.yaml                         tests/projects/simple-stack/A.hs                         tests/projects/simple-stack/B.hs-                        tests/projects/simple-stack/CHANGELOG.md-                        tests/projects/simple-stack/Setup.hs                         tests/projects/simple-stack/cabal.project                         tests/projects/simple-stack/hie.yaml                         tests/projects/simple-stack/simple-stack.cabal                         "tests/projects/space stack/A.hs"                         "tests/projects/space stack/B.hs"-                        "tests/projects/space stack/Setup.hs"                         "tests/projects/space stack/hie.yaml"                         "tests/projects/space stack/stackproj.cabal"-                        tests/projects/implicit-cabal/Setup.hs                         tests/projects/implicit-cabal/cabal.project                         tests/projects/implicit-cabal/implicit-cabal.cabal                         tests/projects/implicit-cabal/Main.hs@@ -141,23 +101,17 @@                         tests/projects/implicit-cabal-deep-project/cabal.project                         tests/projects/implicit-cabal-deep-project/foo/foo.cabal                         tests/projects/implicit-cabal-deep-project/foo/Main.hs-                        tests/projects/implicit-stack/Setup.hs                         tests/projects/implicit-stack/implicit-stack.cabal                         tests/projects/implicit-stack/Main.hs-                        tests/projects/implicit-stack-multi/Setup.hs                         tests/projects/implicit-stack-multi/implicit-stack-multi.cabal                         tests/projects/implicit-stack-multi/Main.hs-                        tests/projects/implicit-stack-multi/other-package/Setup.hs                         tests/projects/implicit-stack-multi/other-package/other-package.cabal                         tests/projects/implicit-stack-multi/other-package/Main.hs-                        tests/projects/multi-stack-with-yaml/appA/Setup.hs                         tests/projects/multi-stack-with-yaml/appA/appA.cabal                         tests/projects/multi-stack-with-yaml/appA/src/Lib.hs-                        tests/projects/multi-stack-with-yaml/appB/Setup.hs                         tests/projects/multi-stack-with-yaml/appB/appB.cabal                         tests/projects/multi-stack-with-yaml/appB/src/Lib.hs                         tests/projects/multi-stack-with-yaml/hie.yaml-                        tests/projects/stack-with-yaml/Setup.hs                         tests/projects/stack-with-yaml/app/Main.hs                         tests/projects/stack-with-yaml/hie.yaml                         tests/projects/stack-with-yaml/stack-with-yaml.cabal
src/HIE/Bios/Cradle.hs view
@@ -100,7 +100,11 @@         (CradleConfig cradleDeps           (Multi [(p, CradleConfig [] (Cabal $ dc <> c)) | (p, c) <- ms])         , wdir)-    Stack StackType{ stackComponent = mc, stackYaml = syaml} -> stackCradle wdir mc (fromMaybe "stack.yaml" syaml)+    Stack StackType{ stackComponent = mc, stackYaml = syaml} ->+      let+        stackYamlConfig = stackYamlFromMaybe wdir syaml+      in+        stackCradle wdir mc stackYamlConfig     StackMulti ds ms ->       getCradle buildCustomCradle $         (CradleConfig cradleDeps@@ -552,9 +556,30 @@   <|> findFileUpwards (\fp -> takeExtension fp == ".cabal") wdir  ------------------------------------------------------------------------++-- | Explicit data-type for stack.yaml configuration location.+-- It is basically a 'Maybe' type, but helps to document the API+-- and helps to avoid incorrect usage.+data StackYaml+  = NoExplicitYaml+  | ExplicitYaml FilePath++-- | Create an explicit StackYaml configuration from the+stackYamlFromMaybe :: FilePath -> Maybe FilePath -> StackYaml+stackYamlFromMaybe _wdir Nothing = NoExplicitYaml+stackYamlFromMaybe wdir (Just fp) = ExplicitYaml (wdir </> fp)++stackYamlProcessArgs :: StackYaml -> [String]+stackYamlProcessArgs (ExplicitYaml yaml) = ["--stack-yaml", yaml]+stackYamlProcessArgs NoExplicitYaml = []++stackYamlLocationOrDefault :: StackYaml -> FilePath+stackYamlLocationOrDefault NoExplicitYaml = "stack.yaml"+stackYamlLocationOrDefault (ExplicitYaml yaml) = yaml+ -- | Stack Cradle -- Works for by invoking `stack repl` with a wrapper script-stackCradle :: FilePath -> Maybe String -> FilePath -> Cradle a+stackCradle :: FilePath -> Maybe String -> StackYaml -> Cradle a stackCradle wdir mc syaml =   Cradle     { cradleRootDir    = wdir@@ -562,8 +587,9 @@         { actionName = Types.Stack         , runCradle = stackAction wdir mc syaml         , runGhcCmd = \args ->-            readProcessWithCwd-              wdir "stack" (["--stack-yaml", syaml, "exec", "--silent", "ghc", "--"] <> args) ""+            readProcessWithCwd wdir "stack"+              (stackYamlProcessArgs syaml <> ["exec", "--silent", "ghc", "--"] <> args)+              ""         }     } @@ -576,25 +602,27 @@ -- a '.cabal' file. -- -- Found dependencies are relative to 'rootDir'.-stackCradleDependencies :: FilePath -> FilePath -> FilePath -> IO [FilePath]+stackCradleDependencies :: FilePath -> FilePath -> StackYaml -> IO [FilePath] stackCradleDependencies wdir componentDir syaml = do   let relFp = makeRelative wdir componentDir   cabalFiles' <- findCabalFiles componentDir   let cabalFiles = map (relFp </>) cabalFiles'-  return $ map normalise $ cabalFiles ++ [relFp </> "package.yaml", syaml]+  return $ map normalise $+    cabalFiles ++ [relFp </> "package.yaml", stackYamlLocationOrDefault syaml] -stackAction :: FilePath -> Maybe String -> FilePath -> LoggingFunction -> FilePath -> IO (CradleLoadResult ComponentOptions)+stackAction :: FilePath -> Maybe String -> StackYaml -> LoggingFunction -> FilePath -> IO (CradleLoadResult ComponentOptions) stackAction work_dir mc syaml l _fp = do-  let ghcProcArgs = ("stack", ["--stack-yaml", syaml, "exec", "ghc", "--"])+  let ghcProcArgs = ("stack", stackYamlProcessArgs syaml <> ["exec", "ghc", "--"])   -- Same wrapper works as with cabal   withCabalWrapperTool ghcProcArgs work_dir $ \wrapper_fp -> do     (ex1, _stdo, stde, args) <-       readProcessWithOutputFile l work_dir $-        proc "stack" $ ["--stack-yaml", syaml, "repl", "--no-nix-pure", "--with-ghc", wrapper_fp]-                       ++ [ comp | Just comp <- [mc] ]+        stackProcess syaml+                      $  ["repl", "--no-nix-pure", "--with-ghc", wrapper_fp]+                      <> [ comp | Just comp <- [mc] ]     (ex2, pkg_args, stdr, _) <-       readProcessWithOutputFile l work_dir $-        proc "stack" ["--stack-yaml", syaml, "path", "--ghc-package-path"]+        stackProcess syaml ["path", "--ghc-package-path"]     let split_pkgs = concatMap splitSearchPath pkg_args         pkg_ghc_args = concatMap (\p -> ["-package-db", p] ) split_pkgs     case processCabalWrapperArgs args of@@ -617,6 +645,9 @@                     , ghc_args ++ pkg_ghc_args                     )                     deps++stackProcess :: StackYaml -> [String] -> CreateProcess+stackProcess syaml args = proc "stack" $ stackYamlProcessArgs syaml <> args  combineExitCodes :: [ExitCode] -> ExitCode combineExitCodes = foldr go ExitSuccess
src/HIE/Bios/Environment.hs view
@@ -58,7 +58,7 @@ makeTargetsAbsolute wdir = map (\target -> target {G.targetId = makeTargetIdAbsolute wdir (G.targetId target)})  makeTargetIdAbsolute :: FilePath -> G.TargetId -> G.TargetId-makeTargetIdAbsolute wdir (G.TargetFile fp phase) = G.TargetFile (prependIfRelative wdir fp) phase+makeTargetIdAbsolute wdir (G.TargetFile fp phase) = G.TargetFile (wdir </> fp) phase makeTargetIdAbsolute _ tid = tid  ----------------------------------------------------------------@@ -75,7 +75,7 @@                     -> IO (CradleLoadResult FilePath) getRuntimeGhcLibDir cradle = do   maybeNixLibDir <- lookupEnv "NIX_GHC_LIBDIR"-  case maybeNixLibDir of +  case maybeNixLibDir of     Just ld -> pure (CradleSuccess ld)     Nothing -> fmap (fmap trim) $       runGhcCmd (cradleOptsProg cradle) ["--print-libdir"]@@ -198,22 +198,17 @@ -- This makes the 'DynFlags' independent of the current working directory. makeDynFlagsAbsolute :: FilePath -> DynFlags -> DynFlags makeDynFlagsAbsolute work_dir df =-  mapOverIncludePaths (prependIfRelative work_dir)+  mapOverIncludePaths (work_dir </>)   $ df-    { importPaths = map (prependIfRelative work_dir) (importPaths df)+    { importPaths = map (work_dir </>) (importPaths df)     , packageDBFlags =         let makePackageDbAbsolute (PackageDB pkgConfRef) = PackageDB               $ case pkgConfRef of-                PkgConfFile fp -> PkgConfFile (prependIfRelative work_dir fp)+                PkgConfFile fp -> PkgConfFile (work_dir </> fp)                 conf -> conf             makePackageDbAbsolute db = db         in map makePackageDbAbsolute (packageDBFlags df)     }--prependIfRelative :: FilePath -> FilePath -> FilePath-prependIfRelative wdir f-  | isAbsolute f = f-  | otherwise = wdir </> f  -- partition_args, along with some of the other code in this file, -- was copied from ghc/Main.hs
− tests/projects/failing-cabal/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/failing-stack/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/implicit-cabal/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/implicit-stack-multi/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/implicit-stack-multi/other-package/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
tests/projects/implicit-stack-multi/other-package/other-package.cabal view
@@ -15,7 +15,6 @@ -- copyright: -- category: build-type:          Simple-extra-source-files:  CHANGELOG.md  executable other-package   main-is:             Main.hs
− tests/projects/implicit-stack/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/monorepo-cabal/A/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/monorepo-cabal/B/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/multi-cabal/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/multi-stack-with-yaml/appA/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/multi-stack-with-yaml/appB/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/multi-stack/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/nested-cabal/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/nested-cabal/sub-comp/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/nested-stack/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/nested-stack/sub-comp/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/simple-cabal/CHANGELOG.md
@@ -1,5 +0,0 @@-# Revision history for simple-cabal--## 0.1.0.0 -- YYYY-mm-dd--* First version. Released on an unsuspecting world.
− tests/projects/simple-cabal/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
tests/projects/simple-cabal/simple-cabal.cabal view
@@ -11,7 +11,6 @@ -- copyright: -- category: build-type:          Simple-extra-source-files:  CHANGELOG.md  library   exposed-modules: A B
− tests/projects/simple-stack/CHANGELOG.md
@@ -1,5 +0,0 @@-# Revision history for simple-cabal--## 0.1.0.0 -- YYYY-mm-dd--* First version. Released on an unsuspecting world.
− tests/projects/simple-stack/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
tests/projects/simple-stack/simple-stack.cabal view
@@ -11,7 +11,6 @@ -- copyright: -- category: build-type:          Simple-extra-source-files:  CHANGELOG.md  library   exposed-modules: A B
− tests/projects/space stack/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
− tests/projects/stack-with-yaml/Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain