IDEA-110316 Compilation fails when including a .form file from another jar

This commit is contained in:
Eugene Zhuravlev
2016-09-20 00:46:12 +02:00
parent 28c80194f5
commit fee78fb169
@@ -144,8 +144,7 @@ public class FormsInstrumenter extends FormsBuilder {
final Map<File, Collection<File>> instrumented = new THashMap<File, Collection<File>>(FileUtil.FILE_HASHING_STRATEGY);
final Map<String, File> class2form = new HashMap<String, File>();
final MyNestedFormLoader nestedFormsLoader =
new MyNestedFormLoader(chunkSourcePath, ProjectPaths.getOutputPathsWithDependents(chunk));
final MyNestedFormLoader nestedFormsLoader = new MyNestedFormLoader(chunkSourcePath, ProjectPaths.getOutputPathsWithDependents(chunk), finder);
for (File formFile : forms) {
final LwRootContainer rootContainer;
@@ -266,15 +265,17 @@ public class FormsInstrumenter extends FormsBuilder {
private static class MyNestedFormLoader implements NestedFormLoader {
private final Map<File, String> mySourceRoots;
private final Collection<File> myOutputRoots;
private final InstrumentationClassFinder myClassFinder;
private final HashMap<String, LwRootContainer> myCache = new HashMap<String, LwRootContainer>();
/**
* @param sourceRoots all source roots for current module chunk and all dependent recursively
* @param outputRoots output roots for this module chunk and all dependent recursively
*/
public MyNestedFormLoader(Map<File, String> sourceRoots, Collection<File> outputRoots) {
public MyNestedFormLoader(Map<File, String> sourceRoots, Collection<File> outputRoots, InstrumentationClassFinder classFinder) {
mySourceRoots = sourceRoots;
myOutputRoots = outputRoots;
myClassFinder = classFinder;
}
public LwRootContainer loadForm(String formFileName) throws Exception {
@@ -303,6 +304,16 @@ public class FormsInstrumenter extends FormsBuilder {
}
}
InputStream fromLibraries = null;
try {
fromLibraries = myClassFinder.getResourceAsStream(relPath);
}
catch (IOException ignored) {
}
if (fromLibraries != null) {
return loadForm(formFileName, fromLibraries);
}
throw new Exception("Cannot find nested form file " + formFileName);
}