hiedb 0.3.0.0 → 0.3.0.1
raw patch · 4 files changed
+23/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +9/−0
- hiedb.cabal +1/−1
- src/HieDb/Create.hs +5/−0
- src/HieDb/Run.hs +8/−3
CHANGELOG.md view
@@ -1,10 +1,19 @@ # Revision history for hiedb +## 0.3.0.1 -- 2021-01-27++* Add additional sqlite indexes to prevent accidently quadratic behaviour while indexing+ ## 0.3.0.0 -- 2021-01-20 * Introduce `SourceFile` type * Add `deleteMissingRealFiles` to garbage collect missing/deleted files * Enforce `is_real => hs_src IS NOT NULL` constraint in database.+* Add option to show context for source spans+* Coloured output and other output improvements+* Garbage collection of typenames+* Added flag to reindex all files+* 'addRefsFrom' now returns a boolean indicating if the file was indexed or skipped ## 0.2.0.0 -- 2021-01-06
hiedb.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hiedb-version: 0.3.0.0+version: 0.3.0.1 synopsis: Generates a references DB from .hie files description: Tool and library to index and query a collection of `.hie` files bug-reports: https://github.com/wz1000/HieDb/issues
src/HieDb/Create.hs view
@@ -88,6 +88,7 @@ \, CONSTRAINT modid UNIQUE (mod, unit, is_boot) ON CONFLICT REPLACE \ \, CONSTRAINT real_has_src CHECK ( (NOT is_real) OR (hs_src IS NOT NULL) ) \ \)"+ execute_ conn "CREATE INDEX IF NOT EXISTS mod_hash ON mods(hieFile,hash)" execute_ conn "CREATE TABLE IF NOT EXISTS refs \ \( hieFile TEXT NOT NULL \@@ -100,6 +101,7 @@ \, ec INTEGER NOT NULL \ \, FOREIGN KEY(hieFile) REFERENCES mods(hieFile) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED \ \)"+ execute_ conn "CREATE INDEX IF NOT EXISTS refs_mod ON refs(hieFile)" execute_ conn "CREATE TABLE IF NOT EXISTS decls \ \( hieFile TEXT NOT NULL \@@ -111,6 +113,7 @@ \, is_root BOOL NOT NULL \ \, FOREIGN KEY(hieFile) REFERENCES mods(hieFile) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED \ \)"+ execute_ conn "CREATE INDEX IF NOT EXISTS decls_mod ON decls(hieFile)" execute_ conn "CREATE TABLE IF NOT EXISTS defs \ \( hieFile TEXT NOT NULL \@@ -122,6 +125,7 @@ \, FOREIGN KEY(hieFile) REFERENCES mods(hieFile) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED \ \, PRIMARY KEY(hieFile,occ) \ \)"+ execute_ conn "CREATE INDEX IF NOT EXISTS defs_mod ON defs(hieFile)" execute_ conn "CREATE TABLE IF NOT EXISTS typenames \ \( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT \@@ -143,6 +147,7 @@ \, FOREIGN KEY(hieFile) REFERENCES mods(hieFile) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED \ \)" execute_ conn "CREATE INDEX IF NOT EXISTS typeref_id ON typerefs(id)"+ execute_ conn "CREATE INDEX IF NOT EXISTS typerefs_mod ON typerefs(hieFile)" {-| Add names of types from @.hie@ file to 'HieDb'. Returns an Array mapping 'TypeIndex' to database ID assigned to the
src/HieDb/Run.hs view
@@ -55,6 +55,7 @@ defdb <- fromMaybe defaultLoc <$> lookupEnv "HIEDB" colr <- hSupportsANSIColor stdout hSetBuffering stdout NoBuffering+ hSetBuffering stderr NoBuffering (opts, cmd) <- execParser $ progParseInfo defdb colr runCommand libdir opts cmd @@ -230,14 +231,18 @@ doIndex conn opts h files = do nc <- newIORef =<< makeNc let progress' = if quiet opts then (\_ _ _ k -> k) else progress- start <- offsetTime++ istart <- offsetTime (length -> done, length -> skipped)<- runDbM nc $ partition id <$> zipWithM (\f n -> progress' h (length files) n (addRefsFrom conn) f) files [0..]+ indexTime <- istart++ start <- offsetTime when (done /= 0) $ void $ garbageCollectTypeNames conn+ gcTime <- start - end <- start unless (quiet opts) $- hPutStrLn h $ "\nCompleted! (" <> show done <> " indexed, " <> show skipped <> " skipped in " <> showDuration end <> ")"+ hPutStrLn h $ "\nCompleted! (" <> show done <> " indexed, " <> show skipped <> " skipped in " <> showDuration indexTime <> " + " <> showDuration gcTime <> " gc)" runCommand :: LibDir -> Options -> Command -> IO () runCommand libdir opts cmd = withHieDbAndFlags libdir (database opts) $ \dynFlags conn -> do