Skip to content

Commit ea6b99e

Browse files
committed
JS: Add shouldExtract predicate
1 parent 164a18f commit ea6b99e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.concurrent.ExecutorService;
3030
import java.util.concurrent.Executors;
3131
import java.util.concurrent.TimeUnit;
32+
import java.util.function.Predicate;
3233
import java.util.stream.Collectors;
3334
import java.util.stream.Stream;
3435

@@ -609,20 +610,21 @@ private void extractSource() throws IOException {
609610

610611
// extract remaining files
611612
extractFiles(
612-
filesToExtract, extractedFiles, defaultExtractor, customExtractors, hasTypeScriptFiles);
613+
filesToExtract, extractedFiles, defaultExtractor, customExtractors,
614+
f -> !(hasTypeScriptFiles && isFileDerivedFromTypeScriptFile(f, extractedFiles)));
613615
}
614616

615617
private void extractFiles(
616618
Set<Path> filesToExtract,
617619
Set<Path> extractedFiles,
618620
FileExtractor defaultExtractor,
619621
Map<String, FileExtractor> customExtractors,
620-
boolean hasTypeScriptFiles) {
622+
Predicate<Path> shouldExtract) {
621623

622624
for (Path f : filesToExtract) {
623625
if (extractedFiles.contains(f))
624626
continue;
625-
if (hasTypeScriptFiles && isFileDerivedFromTypeScriptFile(f, extractedFiles)) {
627+
if (!shouldExtract.test(f)) {
626628
continue;
627629
}
628630
extractedFiles.add(f);

0 commit comments

Comments
 (0)