packages feed

ghcflags 1.0.2 → 1.0.3

raw patch · 2 files changed

+12/−12 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

GhcFlags/Plugin.hs view
@@ -45,24 +45,25 @@   unless written write   pure core --- TODO support incremental compilation--- -- This only supports ghc being called with directories and home modules. That -- means we don't support incremental compilation where ghc is called with -- explicit filenames and dependencies. There are cases where the .ghc.flags may--- get out of date, e.g. adding / removing home modules. To handle those cases--- we need to detect them and write to a different (per-file) .ghc.flags--- location. Text editors need to be aware of both kinds of ghc flags files and--- use the most recent.+-- get out of date, e.g. adding / removing home modules. The simple solution is+-- that tools using .ghc.flags should recalculate the home modules if they want+-- to support incremental compilation. write :: (MonadIO m, GHC.HasDynFlags m) => m () write = do   dflags <- GHC.getDynFlags   args <- liftIO $ getArgs+  ghcPath <- liftIO $ lookupEnv "PATH"    -- downstream tools shouldn't use this plugin, or all hell will break loose   let ghcFlags = unwords $ replace ["-fplugin", "GhcFlags.Plugin"] [] args       paths = GHC.importPaths dflags       writeGhcFlags path = writeDifferent (path <> "/.ghc.flags") ghcFlags+      writeGhcPath path = case ghcPath of+        Just p -> writeDifferent (path <> "/.ghc.path") p+        Nothing -> pure ()       enable = case GHC.hscTarget dflags of         GHC.HscInterpreted -> False         GHC.HscNothing -> False@@ -70,6 +71,7 @@    when enable $ liftIO $ do     traverse_ writeGhcFlags paths+    traverse_ writeGhcPath paths  -- Only writes out the file when it will result in changes, and silently fails -- on exceptions because the plugin should never interrupt normal ghc work. The
ghcflags.cabal view
@@ -1,17 +1,15 @@ cabal-version: 2.2 name:          ghcflags-version:       1.0.2+version:       1.0.3 synopsis:      Dump the ghc flags during compilation license:       BSD-2-Clause license-file:  LICENSE author:        Tseen She maintainer:    Tseen She copyright:     2019 Tseen She-bug-reports:   https://gitlab.com/tseenshe/hsinspect/merge_requests-tested-with:   GHC ^>=8.4.4 || ^>=8.6.5 || ^>=8.8.1+tested-with:   GHC ^>=8.4.4 || ^>=8.6.5 || ^>=8.8.3 category:      Building-description:-  Generate @.ghc.flags@ files during compilation+description:   Generate @.ghc.flags@ and @.ghc.path@ files during compilation  source-repository head   type:     git@@ -33,5 +31,5 @@   import:          deps   hs-source-dirs:  . -  -- cabal-fmt: expand plugin+  -- cabal-fmt: expand . -LICENSE   exposed-modules: GhcFlags.Plugin