Skip to content

Commit 851e71c

Browse files
author
Max Schaefer
committed
JavaScript: Warn about externs trap cache absence/miss.
1 parent d9d4051 commit 851e71c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,24 @@ private void extractExterns() throws IOException {
380380
Path trapCachePath = SEMMLE_DIST.resolve(".cache").resolve("trap-cache").resolve("javascript");
381381
if (Files.isDirectory(trapCachePath)) {
382382
trapCache = new DefaultTrapCache(trapCachePath.toString(), null, Main.EXTRACTOR_VERSION) {
383+
boolean warnedAboutCacheMiss = false;
384+
383385
@Override
384386
public File lookup(String source, ExtractorConfig config, FileType type) {
385387
File f = super.lookup(source, config, type);
386388
// only return `f` if it exists; this has the effect of making the cache read-only
387-
return f.exists() ? f : null;
389+
if (f.exists())
390+
return f;
391+
// warn on first failed lookup
392+
if (!warnedAboutCacheMiss) {
393+
warn("Trap cache lookup for externs failed.");
394+
warnedAboutCacheMiss = true;
395+
}
396+
return null;
388397
}
389398
};
399+
} else {
400+
warn("No externs trap cache found");
390401
}
391402
}
392403

0 commit comments

Comments
 (0)