Move Android compiler plugin tests to android-compiler-plugin module

This commit is contained in:
Yan Zhulanow
2014-11-06 15:20:20 +03:00
parent efff642635
commit fa62d3bcec
63 changed files with 70 additions and 79 deletions
@@ -1,8 +0,0 @@
package android.app
import android.view.View
import android.content.Context
abstract class Activity: Context {
abstract fun findViewById(id: Int): View?
}
@@ -1,3 +0,0 @@
package android.content
trait Context
@@ -1,5 +0,0 @@
package android.view
import android.content.Context
open class View(ctx: Context)
@@ -1,11 +0,0 @@
package android.widget
import android.view.View
import android.content.Context
open class Button(ctx: Context): View(ctx) {override fun toString() = "Button"}
open class EditText(ctx: Context): View(ctx) {override fun toString() = "EditText"}
open class TextView(ctx: Context): View(ctx) {override fun toString() = "TextView"}
open class FrameLayout(ctx: Context): View(ctx) {override fun toString() = "FrameLayout"}
open class RelativeLayout(ctx: Context): View(ctx) {override fun toString() = "RelativeLayout"}
open class ImageView(ctx: Context): View(ctx) {override fun toString() = "ImageView"}
@@ -1,33 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
import org.my.cool.MyButton
class R {
class id {
class object {
val login = 5
}
}
}
class MyActivity(): Activity() {
val buttonWidget = MyButton(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.login -> buttonWidget
else -> null
}
}
public fun box(): String {
return if (login.toString() == "MyButton") "OK" else ""
}
}
fun box(): String {
return MyActivity().box()
}
@@ -1,29 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
import org.my.cool.MyButton
class R {
class id {
class object {
val login = 5
}
}
}
class MyActivity(): Activity() {
val buttonWidget = MyButton(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.login -> buttonWidget
else -> null
}
}
}
fun box(): String {
return "OK"
}
@@ -1,33 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<permission android:name="android"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sample" >
<activity
android:name="com.example.android.basiccontactables.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,8 +0,0 @@
package org.my.cool
import android.widget.Button
import android.app.Activity
class MyButton(ctx: Activity): Button(ctx) {
override fun toString(): String {return "MyButton"}
}
@@ -1,15 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<view
class="org.my.cool.MyButton"
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,33 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
import org.my.cool.MyButton
class R {
class id {
class object {
val login = 5
}
}
}
class MyActivity(): Activity() {
val buttonWidget = MyButton(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.login -> buttonWidget
else -> null
}
}
public fun box(): String {
return if (login.toString() == "MyButton") "OK" else ""
}
}
fun box(): String {
return MyActivity().box()
}
@@ -1,29 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
import org.my.cool.MyButton
class R {
class id {
class object {
val login = 5
}
}
}
class MyActivity(): Activity() {
val buttonWidget = MyButton(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.login -> buttonWidget
else -> null
}
}
}
fun box(): String {
return "OK"
}
@@ -1,33 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<permission android:name="android"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sample" >
<activity
android:name="com.example.android.basiccontactables.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,8 +0,0 @@
package org.my.cool
import android.widget.Button
import android.content.Context
class MyButton(ctx: Context): Button(ctx) {
override fun toString(): String {return "MyButton"}
}
@@ -1,14 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<org.my.cool.MyButton
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1 +0,0 @@
fun box() = "OK"
@@ -1,33 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<permission android:name="android"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sample" >
<activity
android:name="com.example.android.basiccontactables.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/req_who_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"
android:gravity="left"
android:src="@drawable/icon" />
<TextView
android:id="@+id/req_state_who"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/req_who_icon"
android:textSize="10dip"
android:layout_alignParentRight="false"
android:layout_alignParentTop="false"
android:layout_alignWithParentIfMissing="true"
android:gravity="left"
android:text="who" />
<TextView
android:id="@+id/req_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/req_state_who"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:gravity="right"
android:text="No summary"
android:textSize="10dip"
android:textColor="#FFFF00" />
<TextView
android:id="@+id/req_summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/req_header"
android:layout_toRightOf="@id/req_state_who"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:gravity="right"
android:textSize="10dip"
android:text="No summary" />
<TextView
android:id="@+id/req_description"
android:layout_below="@id/req_summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/req_state_who"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:gravity="right"
android:ellipsize="marquee"
android:text="No description"
android:textSize="10dip" />
<ImageView
android:id="@+id/req_state_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/req_description"
android:layout_marginRight="6dip"/>
</RelativeLayout>
@@ -1,57 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
class R {
class id {
class object {
val item_detail_container = 0
val textView1 = 1
val password = 2
val textView2 = 3
val passwordConfirmation = 4
val login = 5
val passwordField = 6
val passwordCaption = 7
val loginButton = 8
}
}
}
class MyActivity(): Activity() {
val textViewWidget = TextView(this)
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
val textViewWidget2 = TextView(this)
val editTextWidget2 = EditText(this)
val buttonWidget2 = Button(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
R.id.passwordField -> textViewWidget2
R.id.passwordCaption -> editTextWidget2
R.id.loginButton -> buttonWidget2
else -> null
}
}
public fun box(): String{
return if (textView1.toString() == "TextView" &&
password.toString() == "EditText" &&
login.toString() == "Button" &&
passwordField.toString() == "TextView" &&
passwordCaption.toString() == "EditText" &&
loginButton.toString() == "Button")
"OK" else ""
}
}
fun box(): String {
return MyActivity().box()
}
@@ -1,37 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
class R {
class id {
class object {
val item_detail_container = 0
val textView1 = 1
val password = 2
val textView2 = 3
val passwordConfirmation = 4
val login = 5
}
}
}
class MyActivity(): Activity() {
val textViewWidget = TextView(this)
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
else -> null
}
}
}
fun box(): String {
return "OK"
}
@@ -1,33 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<permission android:name="android"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sample" >
<activity
android:name="com.example.android.basiccontactables.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,29 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter your password" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,29 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<TextView
android:id="@+id/passwordField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter your password" />
<EditText
android:id="@+id/passwordCaption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,44 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
class R {
class id {
class object {
val item_detail_container = 0
val textView1 = 1
val password = 2
val textView2 = 3
val passwordConfirmation = 4
val login = 5
}
}
}
class MyActivity(): Activity() {
val textViewWidget = TextView(this)
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
else -> null
}
}
public fun box(): String{
return if (textView1.toString() == "TextView" &&
password.toString() == "EditText" &&
login.toString() == "Button")
"OK" else ""
}
}
fun box(): String {
return MyActivity().box()
}
@@ -1,37 +0,0 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
class R {
class id {
class object {
val item_detail_container = 0
val textView1 = 1
val password = 2
val textView2 = 3
val passwordConfirmation = 4
val login = 5
}
}
}
class MyActivity(): Activity() {
val textViewWidget = TextView(this)
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
else -> null
}
}
}
fun box(): String {
return "OK"
}
@@ -1,33 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<permission android:name="android"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sample" >
<activity
android:name="com.example.android.basiccontactables.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,29 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter your password" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,7 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
</manifest>
@@ -1,11 +0,0 @@
package com.myapp
import android.app.Activity
class MyActivity: Activity() {
val button = this.MyButton
}
// 1 GETSTATIC
// 1 INVOKEVIRTUAL
// 1 CHECKCAST
@@ -1,15 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<view
class="android.widget.Button"
android:id="@+id/MyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,12 +0,0 @@
package com.myapp
import android.app.Activity
class MyActivity: Activity() {
val button = this.MyButton
}
// 1 GETSTATIC
// 1 INVOKEVIRTUAL
// 1 CHECKCAST
@@ -1,14 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<android.widget.Button
android:id="@+id/MyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,13 +0,0 @@
package com.myapp
import android.app.Activity
class MyActivity: Activity() {
val button = this.login
val button1 = this.loginButton
}
// 2 GETSTATIC
// 2 INVOKEVIRTUAL
// 2 CHECKCAST
@@ -1,29 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter your password" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,29 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<TextView
android:id="@+id/passwordField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter your password" />
<EditText
android:id="@+id/passwordCaption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,17 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,14 +0,0 @@
package com.myapp
import android.app.Activity
import android.os.Bundle
import java.io.File
public class MyActivity : Activity() {
{login}
}
// 1 GETSTATIC
// 1 INVOKEVIRTUAL
// 1 CHECKCAST