repro for kapt failure
Bug: 161814391
Test: KotlinTestApp
Change-Id: Ie4de154eac97f80161e666fa02770a3df945167a
diff --git a/integration-tests/KotlinTestApp/app/build.gradle b/integration-tests/KotlinTestApp/app/build.gradle
index 37d2612..76c4bfe 100644
--- a/integration-tests/KotlinTestApp/app/build.gradle
+++ b/integration-tests/KotlinTestApp/app/build.gradle
@@ -45,6 +45,7 @@
def lifecycleVersion = "2.0.0"
def testingVersion = "1.1.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation project(":library1")
implementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.kotlinVersion"
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion"
diff --git a/integration-tests/KotlinTestApp/app/src/androidTest/java/androidx/databinding/kotlintestapp/AdapterFromLibraryTest.kt b/integration-tests/KotlinTestApp/app/src/androidTest/java/androidx/databinding/kotlintestapp/AdapterFromLibraryTest.kt
new file mode 100644
index 0000000..53cea95
--- /dev/null
+++ b/integration-tests/KotlinTestApp/app/src/androidTest/java/androidx/databinding/kotlintestapp/AdapterFromLibraryTest.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.databinding.kotlintestapp
+
+import androidx.databinding.kotlintestapp.databinding.AdapterFromLibraryBinding
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.matcher.ViewMatchers.withText
+import androidx.test.runner.AndroidJUnit4
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class AdapterFromLibraryTest {
+ @Suppress("MemberVisibilityCanPrivate")
+ @Rule
+ @JvmField
+ val rule = BindingActivityRule<AdapterFromLibraryBinding>(R.layout.adapter_from_library)
+
+ @Test
+ fun test() {
+ rule.runOnUiThread {
+ rule.binding.text = "foo"
+ rule.executePendingBindings()
+ }
+ onView(withId(R.id.library1TextView))
+ .check(matches(withText("library1: foo")))
+ }
+}
\ No newline at end of file
diff --git a/integration-tests/KotlinTestApp/app/src/main/res/layout/adapter_from_library.xml b/integration-tests/KotlinTestApp/app/src/main/res/layout/adapter_from_library.xml
new file mode 100644
index 0000000..c301f86
--- /dev/null
+++ b/integration-tests/KotlinTestApp/app/src/main/res/layout/adapter_from_library.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <data>
+ <variable
+ name="text"
+ type="String" />
+ </data>
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/library1TextView"
+ app:setTextViaLibrary1="@{text}"/>
+ </LinearLayout>
+</layout>
\ No newline at end of file
diff --git a/integration-tests/KotlinTestApp/library1/build.gradle b/integration-tests/KotlinTestApp/library1/build.gradle
new file mode 100644
index 0000000..1fc6a24
--- /dev/null
+++ b/integration-tests/KotlinTestApp/library1/build.gradle
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ `*/
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-kapt'
+android {
+ compileSdkVersion rootProject.latestCompileSdk
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion rootProject.latestCompileSdk
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildFeatures {
+ dataBinding = true
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.kotlinVersion"
+}
diff --git a/integration-tests/KotlinTestApp/library1/src/main/AndroidManifest.xml b/integration-tests/KotlinTestApp/library1/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..7742b93
--- /dev/null
+++ b/integration-tests/KotlinTestApp/library1/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2018 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="androidx.databinding.kotlintestapp.library1">
+</manifest>
\ No newline at end of file
diff --git a/integration-tests/KotlinTestApp/library1/src/main/java/androidx/databinding/kotlintestapp/library1/Library1BindingAdapters.kt b/integration-tests/KotlinTestApp/library1/src/main/java/androidx/databinding/kotlintestapp/library1/Library1BindingAdapters.kt
new file mode 100644
index 0000000..c711911
--- /dev/null
+++ b/integration-tests/KotlinTestApp/library1/src/main/java/androidx/databinding/kotlintestapp/library1/Library1BindingAdapters.kt
@@ -0,0 +1,9 @@
+package androidx.databinding.kotlintestapp.library1
+
+import android.widget.TextView
+import androidx.databinding.BindingAdapter
+
+@BindingAdapter("setTextViaLibrary1")
+fun TextView.setViaLibrary1Adapter(data:String) {
+ setText("library1: $data")
+}
\ No newline at end of file
diff --git a/integration-tests/KotlinTestApp/settings.gradle b/integration-tests/KotlinTestApp/settings.gradle
index 9b40b07..111408b 100644
--- a/integration-tests/KotlinTestApp/settings.gradle
+++ b/integration-tests/KotlinTestApp/settings.gradle
@@ -15,3 +15,4 @@
*/
include ':app'
+include ':library1'