diff --git a/compiler/testData/cli/jvm/androidPlugin/AndroidManifest.xml b/compiler/testData/cli/jvm/androidPlugin/AndroidManifest.xml new file mode 100644 index 00000000000..a24ec73c5fb --- /dev/null +++ b/compiler/testData/cli/jvm/androidPlugin/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/compiler/testData/cli/jvm/androidPlugin/androidApp.kt b/compiler/testData/cli/jvm/androidPlugin/androidApp.kt new file mode 100644 index 00000000000..5ae840472ca --- /dev/null +++ b/compiler/testData/cli/jvm/androidPlugin/androidApp.kt @@ -0,0 +1,9 @@ +package android.app + +public open class Activity { + public open fun findViewById([suppress("UNUSED_PARAMETER")] id: Int): android.view.View = null!! +} + +public open class Fragment { + public open fun getView(): android.view.View = null!! +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/androidPlugin/androidView.kt b/compiler/testData/cli/jvm/androidPlugin/androidView.kt new file mode 100644 index 00000000000..873d04cca35 --- /dev/null +++ b/compiler/testData/cli/jvm/androidPlugin/androidView.kt @@ -0,0 +1,5 @@ +package android.view + +public open class View { + public open fun findViewById([suppress("UNUSED_PARAMETER")] id: Int): android.view.View = null!! +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/androidPlugin/androidWidget.kt b/compiler/testData/cli/jvm/androidPlugin/androidWidget.kt new file mode 100644 index 00000000000..57c6d10400d --- /dev/null +++ b/compiler/testData/cli/jvm/androidPlugin/androidWidget.kt @@ -0,0 +1,5 @@ +package android.widget + +public open class TextView : android.view.View() { + public fun setText([suppress("UNUSED_PARAMETER")] text: String) {} +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/androidPlugin/res/layout/layout.xml b/compiler/testData/cli/jvm/androidPlugin/res/layout/layout.xml new file mode 100644 index 00000000000..b09180109f7 --- /dev/null +++ b/compiler/testData/cli/jvm/androidPlugin/res/layout/layout.xml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/compiler/testData/cli/jvm/pluginSimple.args b/compiler/testData/cli/jvm/pluginSimple.args new file mode 100644 index 00000000000..146f285fac8 --- /dev/null +++ b/compiler/testData/cli/jvm/pluginSimple.args @@ -0,0 +1,12 @@ +-d +$TEMP_DIR$ +-Xplugin +dist/kotlinc/lib/android-compiler-plugin.jar +-P +plugin:org.jetbrains.kotlin.android:androidManifest=$TESTDATA_DIR$/androidPlugin/AndroidManifest.xml +-P +plugin:org.jetbrains.kotlin.android:androidRes=$TESTDATA_DIR$/androidPlugin/res +$TESTDATA_DIR$/pluginSimple.kt +$TESTDATA_DIR$/androidPlugin/androidApp.kt +$TESTDATA_DIR$/androidPlugin/androidView.kt +$TESTDATA_DIR$/androidPlugin/androidWidget.kt \ No newline at end of file diff --git a/compiler/testData/cli/jvm/pluginSimple.kt b/compiler/testData/cli/jvm/pluginSimple.kt new file mode 100644 index 00000000000..5b0491b0085 --- /dev/null +++ b/compiler/testData/cli/jvm/pluginSimple.kt @@ -0,0 +1,8 @@ +import android.view.* +import android.app.* +import android.widget.* +import kotlinx.android.synthetic.layout.* + +class MyActivity : Activity() { + init { textView.setText("Some text") } +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/pluginSimple.out b/compiler/testData/cli/jvm/pluginSimple.out new file mode 100644 index 00000000000..a0aba9318ad --- /dev/null +++ b/compiler/testData/cli/jvm/pluginSimple.out @@ -0,0 +1 @@ +OK \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliCommonTest.java b/compiler/tests/org/jetbrains/kotlin/cli/CliCommonTest.java index 1c690533b38..bd3d407c33b 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/CliCommonTest.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliCommonTest.java @@ -72,4 +72,9 @@ public class CliCommonTest extends CliBaseTest { public void suppressAllWarningsJS() throws Exception { executeCompilerCompareOutputJS(); } + + @Test + public void pluginSimple() throws Exception { + executeCompilerCompareOutputJVM(); + } } diff --git a/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java index a3fa53b7fbb..47d8bf4aebb 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java @@ -102,6 +102,18 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes doJvmTest(fileName); } + @TestMetadata("pluginSimple.args") + public void testPluginSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/pluginSimple.args"); + doJvmTest(fileName); + } + + @TestMetadata("pluginSimpleUsage.args") + public void testPluginSimpleUsage() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/pluginSimpleUsage.args"); + doJvmTest(fileName); + } + @TestMetadata("signatureClash.args") public void testSignatureClash() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/signatureClash.args");