ghc-tags-plugin 0.2.1.0 → 0.2.2.0
raw patch · 5 files changed
+34/−17 lines, 5 filesdep +lukkodep ~basedep ~ghc
Dependencies added: lukko
Dependency ranges changed: base, ghc
Files
- app/check.hs +1/−2
- ghc-tags-plugin.cabal +12/−4
- lib/Plugin/GhcTags.hs +7/−1
- lib/Plugin/GhcTags/FileLock.hs +14/−9
- lib/Plugin/GhcTags/Options.hs +0/−1
app/check.hs view
@@ -10,7 +10,6 @@ import System.FilePath import System.IO import System.Environment-import GHC.IO.Handle import Plugin.GhcTags.FileLock @@ -18,7 +17,7 @@ main :: IO () main = do file :_ <- getArgs- withFileLock (lockFile file) ExclusiveLock ReadWriteMode $ \_h -> do+ withFileLock (lockFile file) ExclusiveLock $ \_h -> do numOfLines <- length . BSC.lines <$> BS.readFile file putStrLn (show numOfLines) where
ghc-tags-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: ghc-tags-plugin-version: 0.2.1.0+version: 0.2.2.0 synopsis: A compiler plugin which generates tags file from GHC parsed syntax tree. description: A [GHC compiler plugin](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/extending_ghc.html?highlight=compiler%20plugin#compiler-plugins)@@ -18,7 +18,7 @@ README.md homepage: https://github.com/coot/ghc-tags-plugin#readme bug-reports: https://github.com/coot/ghc-tags-plugin/issues-tested-with: GHC==8.6.3, GHC==8.8.3+tested-with: GHC==8.6.3, GHC==8.8.3, GHC==8.10.1 -- Don't build gtp-check command by default; it's a development tool. flag gtp-check@@ -37,13 +37,14 @@ other-modules: Plugin.GhcTags.CTag Paths_ghc_tags_plugin autogen-modules: Paths_ghc_tags_plugin- build-depends: base >=4.12.0.0 && <4.14,+ build-depends: base >=4.12.0.0 && <4.15, bytestring ^>=0.10, directory ^>=1.3, filepath ^>=1.4, filepath-bytestring ^>=1.4,- ghc >=8.4 && <8.9,+ ghc >=8.4 && <8.11,+ lukko ^>=0.1, mtl ^>=2.2, optparse-applicative ^>=0.15.1,@@ -57,6 +58,13 @@ default-language: Haskell2010 ghc-options: -Wall+ -Wno-unticked-promoted-constructors+ -Wcompat+ -Wincomplete-uni-patterns+ -Wincomplete-record-updates+ -Wpartial-fields+ -Widentities+ -Wredundant-constraints executable gtp-check
lib/Plugin/GhcTags.hs view
@@ -7,6 +7,8 @@ {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}+ module Plugin.GhcTags ( plugin, Options (..) ) where import Control.Exception@@ -56,8 +58,12 @@ , Plugin (..) ) import qualified GhcPlugins+#if __GLASGOW_HASKELL__ >= 810+import GHC.Hs (GhcPs, HsModule (..))+#else import HsExtension (GhcPs) import HsSyn (HsModule (..))+#endif import Outputable (($+$), ($$)) import qualified Outputable as Out import qualified PprColour@@ -144,7 +150,7 @@ -- file. This is needed when `cabal` compiles in parallel. -- We take the lock on the copy, otherwise the lock would be removed when -- we move the file.- withFileLock lockFile ExclusiveLock WriteMode $ \_ -> do+ withFileLock lockFile ExclusiveLock $ \_ -> do mbInSize <- if debug then Just <$> getFileSize tagsFile
lib/Plugin/GhcTags/FileLock.hs view
@@ -1,22 +1,27 @@+{-# LANGUAGE CPP #-}+ module Plugin.GhcTags.FileLock ( withFileLock , LockMode (..) ) where import Control.Exception-import System.IO-import GHC.IO.Handle-import GHC.IO.Handle.Lock +#if !defined(mingw32_HOST_OS)+import Lukko.FLock+#else+import Lukko.Windows+#endif+ -- | 'flock' base lock (on posix) or `LockFileEx` on Windows. ---withFileLock :: FilePath -> LockMode -> IOMode -> (Handle -> IO x) -> IO x-withFileLock path mode iomode k =+withFileLock :: FilePath -> LockMode -> (FD -> IO x) -> IO x+withFileLock path mode k = bracket- (openFile path iomode)- (\h -> hClose h)+ (fdOpen path)+ (\h -> fdClose h) $ \h -> bracket- (hLock h mode)- (\_ -> hUnlock h)+ (fdLock h mode)+ (\_ -> fdUnlock h) (\_ -> k h)
lib/Plugin/GhcTags/Options.hs view
@@ -11,7 +11,6 @@ import Data.Bool (bool) import Data.Monoid (Last (..)) import Data.Functor.Identity (Identity (..))-import System.IO (FilePath) import Options.Applicative