weeder 0.1.12 → 0.1.13
raw patch · 4 files changed
+25/−11 lines, 4 files
Files
- CHANGES.txt +3/−0
- src/Cabal.hs +17/−6
- src/Stack.hs +4/−4
- weeder.cabal +1/−1
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for Weeder +0.1.13, released 2018-01-17+ #32, find .hi files in more places+ #32, always disable color when running stack 0.1.12, released 2018-01-16 Make available on Mac 0.1.11, released 2017-12-29
src/Cabal.hs view
@@ -39,14 +39,25 @@ [findHi his sect $ Right x | x <- filter (not . isPathsModule) cabalOtherModules] findHi :: Map.HashMap FilePathEq a -> CabalSection -> Either FilePath ModuleName -> Either ModuleName a- findHi his cabal@CabalSection{..} name = maybe (Left mname) Right $ firstJust (`Map.lookup` his) poss+ findHi his cabal@CabalSection{..} name =+ -- error $ show (poss, Map.keys his)+ maybe (Left mname) Right $ firstJust (`Map.lookup` his) poss where mname = either takeFileName id name- poss = [ filePathEq $ joinPath (root : x : either (return . dropExtension) (splitOn ".") name) <.> "dump-hi"- | extra <- [".",distDir]- , root <- ["build" </> extra </> x </> (x ++ "-tmp") | Just x <- [cabalSectionTypeName cabalSectionType]] ++- ["build", "build" </> distDir </> "build"]- , x <- cabalSourceDirs ++ ["."]]+ poss = map filePathEq $ possibleHi distDir cabalSourceDirs cabalSectionType $ either (return . dropExtension) (splitOn ".") name+++-- | This code is fragile and keeps going wrong, should probably try a less "guess everything"+-- and a more refined filter and test.+possibleHi :: FilePath -> [FilePath] -> CabalSectionType -> [String] -> [FilePath]+possibleHi distDir sourceDirs sectionType components =+ [ joinPath (root : x : components) <.> "dump-hi"+ | extra <- [".",distDir]+ , root <- concat [["build" </> extra </> x </> (x ++ "-tmp")+ ,"build" </> extra </> x </> (x ++ "-tmp") </> distDir </> "build" </> x </> (x ++ "-tmp")]+ | Just x <- [cabalSectionTypeName sectionType]] +++ ["build", "build" </> distDir </> "build"]+ , x <- sourceDirs ++ ["."]] data Cabal = Cabal
src/Stack.hs view
@@ -21,19 +21,19 @@ findStack :: FilePath -> IO String findStack dir = withCurrentDirectory dir $- fst . line1 <$> cmdStdout "stack" ["path","--config-location"]+ fst . line1 <$> cmdStdout "stack" ["path","--config-location","--color=never"] buildStack :: FilePath -> IO ()-buildStack file = cmd "stack" ["build","--stack-yaml=" ++ file,"--test","--bench","--no-run-tests","--no-run-benchmarks"]+buildStack file = cmd "stack" ["build","--stack-yaml=" ++ file,"--test","--bench","--no-run-tests","--no-run-benchmarks","--color=never"] -- | Note that in addition to parsing the stack.yaml file it also runs @stack@ to -- compute the dist-dir. parseStack :: Maybe FilePath -> FilePath -> IO Stack parseStack distDir file = do stackDistDir <- case distDir of- Nothing -> fst . line1 <$> cmdStdout "stack" ["path","--dist-dir","--stack-yaml=" ++ file]+ Nothing -> fst . line1 <$> cmdStdout "stack" ["path","--dist-dir","--stack-yaml=" ++ file,"--color=never"] Just x -> return x- stackPackages <- f . decodeYaml <$> cmdStdout "stack" ["query","locals","--stack-yaml=" ++ file]+ stackPackages <- f . decodeYaml <$> cmdStdout "stack" ["query","locals","--stack-yaml=" ++ file,"--color=never"] return Stack{..} where decodeYaml = either throw id . decodeEither' . BS.pack
weeder.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: weeder-version: 0.1.12+version: 0.1.13 license: BSD3 license-file: LICENSE category: Development