If a dependency file appears as a src instead of dep also remove the relative path of ES6 modules from the list of provides.
@@ -430,18 +430,7 @@ public class DepsGenerator {
reportNoDepsInDepsFile(file.getName());
} else {
for (DependencyInfo info : depInfos) {
- // DepsFileParser adds an ES6 module's relative path to closure as a provide so that
- // the resulting depgraph is valid. But we don't want to write this "fake" provide
- // back out, so remove it here.
- depsFiles.put(
- info.getPathRelativeToClosureBase(),
- SimpleDependencyInfo.Builder.from(info)
- .setProvides(
- info.getProvides()
- .stream()
- .filter(p -> !p.equals(info.getPathRelativeToClosureBase()))
- .collect(Collectors.toList()))
- .build());
+ depsFiles.put(info.getPathRelativeToClosureBase(), removeRelativePathProvide(info));
}
}
}
@@ -455,7 +444,7 @@ public class DepsGenerator {
List<DependencyInfo> srcInfos =
depsParser.parseFileReader(src.getName(), src.getCodeReader());
for (DependencyInfo info : srcInfos) {
- depsFiles.put(info.getPathRelativeToClosureBase(), info);
+ depsFiles.put(info.getPathRelativeToClosureBase(), removeRelativePathProvide(info));
}
}
}
@@ -463,6 +452,18 @@ public class DepsGenerator {
return depsFiles;
}
+ private DependencyInfo removeRelativePathProvide(DependencyInfo info) {
+ // DepsFileParser adds an ES6 module's relative path to closure as a provide so that
+ // the resulting depgraph is valid. But we don't want to write this "fake" provide
+ // back out, so remove it here.
+ return SimpleDependencyInfo.Builder.from(info)
+ .setProvides(
+ info.getProvides().stream()
+ .filter(p -> !p.equals(info.getPathRelativeToClosureBase()))
+ .collect(Collectors.toList()))
+ .build();
+ }
+
/**
* Parses all source files for dependency information.
* @param preparsedFiles A set of closure-relative paths.
