Cacheable, multithreaded finder.

It can find every Android.bp in internal master in
about 2.5 sec the first time and 0.3 sec subsequent times

Bug: 62455338

Test: m -j blueprint_tools # which runs the unit tests

Test: m -j blueprint_tools && \
  out/soong/host/linux-x86/bin/finder \
    -v
    --db /tmp/mydb \
    --names Android.mk \
    --prune-files .android-out-dir \
    --exclude-dirs .git,.repo \
    . \
    >/tmp/finder-log 2>&1

Change-Id: I5ab2650459a1dae0d5d076faf411ec2d053c743d
This commit is contained in:
Jeff Gaston
2017-07-20 16:01:05 -07:00
parent 31384debd7
commit b6d161bf16
9 changed files with 4177 additions and 2 deletions

View File

@@ -145,13 +145,14 @@ func New(out io.Writer) *stdLogger {
// SetVerbose controls whether Verbose[f|ln] logs to stderr as well as the
// file-backed log.
func (s *stdLogger) SetVerbose(v bool) {
func (s *stdLogger) SetVerbose(v bool) *stdLogger {
s.verbose = v
return s
}
// SetOutput controls where the file-backed log will be saved. It will keep
// some number of backups of old log files.
func (s *stdLogger) SetOutput(path string) {
func (s *stdLogger) SetOutput(path string) *stdLogger {
if f, err := CreateFileWithRotation(path, 5); err == nil {
s.mutex.Lock()
defer s.mutex.Unlock()
@@ -164,6 +165,7 @@ func (s *stdLogger) SetOutput(path string) {
} else {
s.Fatal(err.Error())
}
return s
}
// Close disables logging to the file and closes the file handle.