add converter output caching

- add two level caching: per xml conversion result and complete resulting JetFile,
  so that only modified xmls are actually converted, and if no change has been
  made to any of those, last successfully built psi file is returned
- merge AndroidUIXmlPathProvider and AndroidUIXmlParser
- update tests
This commit is contained in:
Mikhail Mutcianko
2014-07-17 18:01:17 +04:00
committed by Yan Zhulanow
parent f5b9b155cd
commit eb7534f369
8 changed files with 108 additions and 40 deletions
@@ -8,6 +8,7 @@ import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.android.AndroidUIXmlParser;
import org.jetbrains.jet.lang.resolve.android.CliAndroidUIXmlParser;
import org.jetbrains.jet.test.TestCaseWithTmpdir;
import java.io.File;
@@ -49,9 +50,7 @@ public class AndroidXmlTest extends TestCaseWithTmpdir {
}
public void testCompileResult() throws Exception {
ArrayList<File> paths = new ArrayList<File>();
paths.add(singleFile);
String text = new AndroidUIXmlParser(null, paths).parseToString();
String text = new CliAndroidUIXmlParser(singleFile.getAbsolutePath()).parseToString();
JetCoreEnvironment jetCoreEnvironment = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(),
ConfigurationKind.ALL);
JetFile psiFile = JetTestUtils.createFile(singleFile.getName(), text, jetCoreEnvironment.getProject());
@@ -71,9 +70,7 @@ public class AndroidXmlTest extends TestCaseWithTmpdir {
}
public void testConverterOneFile() throws Exception {
ArrayList<File> paths = new ArrayList<File>();
paths.add(singleFile);
AndroidUIXmlParser parser = new AndroidUIXmlParser(null, paths);
AndroidUIXmlParser parser = new CliAndroidUIXmlParser(singleFile.getAbsolutePath());
String actual = parser.parseToString();
String expected = loadOrCreate(new File(getTestDataPath() + "/converter/singleFile/layout.kt"), actual);