buildwrapper 0.8.3 → 0.8.4
raw patch · 3 files changed
+34/−2 lines, 3 files
Files
- buildwrapper.cabal +1/−1
- src/Language/Haskell/BuildWrapper/Cabal.hs +4/−1
- src/Language/Haskell/BuildWrapper/GHC.hs +29/−0
buildwrapper.cabal view
@@ -1,5 +1,5 @@ name: buildwrapper-version: 0.8.3+version: 0.8.4 cabal-version: >= 1.8 build-type: Simple license: BSD3
src/Language/Haskell/BuildWrapper/Cabal.hs view
@@ -479,6 +479,8 @@ setOptions dist_dir tgs=do let setup_config = DSC.localBuildInfoFile dist_dir cv<-DCD.getCabalVersion setup_config + let optStr1 | cv>=Version [1,19,0] [] ="(compiler,_ ,_)<-configure normal Nothing Nothing defaultProgramDb" + | otherwise ="" let optStr | cv>=Version [1,19,0] [] ="renderGhcOptions compiler $ componentGhcOptions V.silent lbi{withOptimization=NoOptimisation} b clbi fp" | cv>=Version [1,15,0] [] ="renderGhcOptions ((fst $ head $ readP_to_S parseVersion \""++VERSION_ghc++"\") :: Version) $ componentGhcOptions V.silent lbi{withOptimization=NoOptimisation} b clbi fp" | otherwise ="ghcOptions lbi{withOptimization=NoOptimisation} b clbi fp" @@ -511,7 +513,8 @@ ,"let pkg=localPkgDescr lbi" ,"r<-newIORef DM.empty" ,"let fmp=DM."++ show fmp - ,withStr++" pkg lbi (\\c clbi->do" + , optStr1 + ,withStr++" pkg lbi (\\c clbi->do" ," let b=componentBuildInfo c" ," let n=foldComponent (const \"\") exeName testName benchmarkName c" ," let fp=fromJust $ DM.lookup n fmp"
src/Language/Haskell/BuildWrapper/GHC.hs view
@@ -443,6 +443,17 @@ BSC.putStrLn $ BS.append "build-wrapper-json:" $ encode ret hFlush stdout r1 t2 + -- occurrences+ 'o':xs->do+ input<- GMU.liftIO $ readFile fp+ ett<-occurrences' fp input (T.pack xs) (".lhs" == takeExtension fp)+ let ret= case ett of+ Right tt-> (tt,[])+ Left bw -> ([],[bw])+ GMU.liftIO $ do+ BSC.putStrLn $ BS.append "build-wrapper-json:" $ encode ret+ hFlush stdout+ r1 t2 -- thing at point 'p':xs->do GMU.liftIO $ do@@ -865,6 +876,24 @@ matchingVal (TokenDef v _)=query==v mkToken (L sp t)=TokenDef (tokenValue qualif t) (ghcSpanToLocation sp) in generateTokens projectRoot contents literate options (map mkToken) tokensMatching + + +-- | Extract occurrences based on lexing +occurrences' :: FilePath -- ^ Project root or base directory for absolute path conversion+ -> String -- ^ Contents to be parsed+ -> T.Text -- ^ Token value to find+ -> Bool -- ^ Literate source flag (True = literate, False = ordinary)+ -> Ghc (Either BWNote [TokenDef])+occurrences' projectRoot contents query literate = + let + qualif = isJust $ T.find (=='.') query+ -- Get the list of tokens matching the query for relevant token types+ tokensMatching :: [TokenDef] -> [TokenDef]+ tokensMatching = filter matchingVal+ matchingVal :: TokenDef -> Bool+ matchingVal (TokenDef v _)=query==v+ mkToken (L sp t)=TokenDef (tokenValue qualif t) (ghcSpanToLocation sp)+ in generateTokens' projectRoot contents literate (map mkToken) tokensMatching -- | Parse the current document, generating a TokenDef list, filtered by a function generateTokens :: FilePath -- ^ The project's root directory