Android Extensions: Support @ContainerOptions in compiler plugin

This commit is contained in:
Yan Zhulanow
2017-06-05 18:05:03 +03:00
parent 6e1dd08fbb
commit d4b4bc71ee
19 changed files with 321 additions and 68 deletions
@@ -16,11 +16,13 @@
package org.jetbrains.kotlin.android.synthetic.test
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.codegen.AbstractBytecodeTextTest
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestJdkKind
import java.io.File
abstract class AbstractAndroidBytecodeShapeTest : AbstractBytecodeTextTest() {
@@ -30,7 +32,10 @@ abstract class AbstractAndroidBytecodeShapeTest : AbstractBytecodeTextTest() {
private fun createEnvironmentForConfiguration(configuration: CompilerConfiguration, path: String) {
val layoutPaths = getResPaths(path)
myEnvironment = createTestEnvironment(configuration, layoutPaths)
myEnvironment = createTestEnvironment(configuration, layoutPaths).apply {
val runtimeLibrary = File("out/production/android-extensions-runtime")
updateClasspath(listOf(JvmClasspathRoot(runtimeLibrary)))
}
}
override fun doTest(path: String) {
@@ -32,6 +32,12 @@ import java.util.regex.Pattern;
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class AndroidBytecodeShapeTestGenerated extends AbstractAndroidBytecodeShapeTest {
@TestMetadata("activityWithEntityOptionsNoCache")
public void testActivityWithEntityOptionsNoCache() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/activityWithEntityOptionsNoCache/");
doTest(fileName);
}
public void testAllFilesPresentInBytecodeShape() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
}
@@ -108,6 +114,12 @@ public class AndroidBytecodeShapeTestGenerated extends AbstractAndroidBytecodeSh
doTest(fileName);
}
@TestMetadata("fragmentWithEntityOptionsNoCache")
public void testFragmentWithEntityOptionsNoCache() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/fragmentWithEntityOptionsNoCache/");
doTest(fileName);
}
@TestMetadata("multiFile")
public void testMultiFile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/multiFile/");
@@ -179,4 +191,16 @@ public class AndroidBytecodeShapeTestGenerated extends AbstractAndroidBytecodeSh
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithCache/");
doTest(fileName);
}
@TestMetadata("viewWithDefaultNoCache")
public void testViewWithDefaultNoCache() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithDefaultNoCache/");
doTest(fileName);
}
@TestMetadata("viewWithEntityOptionsNoCache")
public void testViewWithEntityOptionsNoCache() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithEntityOptionsNoCache/");
doTest(fileName);
}
}