diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-02-27 15:01:38 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-02-27 15:01:38 +0000 |
commit | 960330f5eab58b4148f7d14640bf375ec3470c1a (patch) | |
tree | d32a8fdeb0b4477d247c9365a670e4d1f3b06672 | |
parent | 921e44da4cea0df298339be99400105133ea9e32 (diff) | |
parent | 6ee6004fea4c079ba2d61d1a17596318dc2fe060 (diff) | |
download | data-binding-960330f5eab58b4148f7d14640bf375ec3470c1a.tar.gz |
Snap for 6241532 from 6ee6004fea4c079ba2d61d1a17596318dc2fe060 to studio-4.1-release
Change-Id: I7b38637e23b81fea0b21971380ef3185e31fcd1b
11 files changed, 251 insertions, 4 deletions
diff --git a/BUILD.bazel b/BUILD.bazel index 61de9557..c924440e 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -108,7 +108,7 @@ iml_module( "//tools/idea/.idea/libraries:Guava", "//tools/idea/.idea/libraries:kotlin-stdlib-jdk8", "//prebuilts/tools/common/m2/repository/com/squareup/javapoet/1.10.0:jar", - "//prebuilts/tools/common/m2/repository/com/android/tools/build/jetifier/jetifier-core/1.0.0-beta08:jar", + "//prebuilts/tools/common/m2/repository/com/android/tools/build/jetifier/jetifier-core/1.0.0-beta09:jar", "//tools/idea/.idea/libraries:gson", "//tools/idea/.idea/libraries:compile-testing[test]", "//tools/idea/.idea/libraries:truth[test]", diff --git a/compilerCommon/db-compilerCommon.iml b/compilerCommon/db-compilerCommon.iml index 8fb500cb..6ca4a6e5 100644 --- a/compilerCommon/db-compilerCommon.iml +++ b/compilerCommon/db-compilerCommon.iml @@ -55,9 +55,9 @@ </orderEntry> <orderEntry type="module-library"> <library name="jetifier-core" type="repository"> - <properties maven-id="com.android.tools.build.jetifier:jetifier-core:1.0.0-beta08" /> + <properties maven-id="com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09" /> <CLASSES> - <root url="jar://$MAVEN_REPOSITORY$/com/android/tools/build/jetifier/jetifier-core/1.0.0-beta08/jetifier-core-1.0.0-beta08.jar!/" /> + <root url="jar://$MAVEN_REPOSITORY$/com/android/tools/build/jetifier/jetifier-core/1.0.0-beta09/jetifier-core-1.0.0-beta09.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -69,4 +69,4 @@ <orderEntry type="library" name="jaxb-api" level="project" /> <orderEntry type="library" name="jaxb-runtime" level="project" /> </component> -</module>
\ No newline at end of file +</module> diff --git a/integration-tests/ViewBindingTestApp/app-with-features/build.gradle b/integration-tests/ViewBindingTestApp/app-with-features/build.gradle new file mode 100644 index 00000000..ef5ef7f2 --- /dev/null +++ b/integration-tests/ViewBindingTestApp/app-with-features/build.gradle @@ -0,0 +1,45 @@ +/* + * 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. + */ + +apply plugin: 'com.android.application' + +android { + compileSdkVersion rootProject.latestCompileSdk + + defaultConfig { + applicationId 'com.example.viewbinding' + minSdkVersion 14 + targetSdkVersion rootProject.latestCompileSdk + versionCode 1 + versionName '1.0' + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + buildFeatures.viewBinding = true + + dynamicFeatures = [ + ":feature", + ] +} + +dependencies { + implementation project(':lib-with-view-binding') + implementation project(':lib-without-view-binding') +} diff --git a/integration-tests/ViewBindingTestApp/app-with-features/src/main/AndroidManifest.xml b/integration-tests/ViewBindingTestApp/app-with-features/src/main/AndroidManifest.xml new file mode 100644 index 00000000..ce59c106 --- /dev/null +++ b/integration-tests/ViewBindingTestApp/app-with-features/src/main/AndroidManifest.xml @@ -0,0 +1,17 @@ +<!-- + ~ 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. + --> + +<manifest + xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.viewbinding.withfeatures" + /> diff --git a/integration-tests/ViewBindingTestApp/app-with-features/src/main/res/layout/include_from_library.xml b/integration-tests/ViewBindingTestApp/app-with-features/src/main/res/layout/include_from_library.xml new file mode 100644 index 00000000..c261017a --- /dev/null +++ b/integration-tests/ViewBindingTestApp/app-with-features/src/main/res/layout/include_from_library.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + > + <include + layout="@layout/simple_with_view_binding" + android:id="@+id/with" + /> + <include + layout="@layout/simple_without_view_binding" + android:id="@+id/without" + /> +</LinearLayout> diff --git a/integration-tests/ViewBindingTestApp/app-with-features/src/main/res/values/strings.xml b/integration-tests/ViewBindingTestApp/app-with-features/src/main/res/values/strings.xml new file mode 100644 index 00000000..7fcbfd58 --- /dev/null +++ b/integration-tests/ViewBindingTestApp/app-with-features/src/main/res/values/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> +<resources> + <string name="feature_name">Feature</string> +</resources>
\ No newline at end of file diff --git a/integration-tests/ViewBindingTestApp/feature/build.gradle b/integration-tests/ViewBindingTestApp/feature/build.gradle new file mode 100644 index 00000000..34d8db22 --- /dev/null +++ b/integration-tests/ViewBindingTestApp/feature/build.gradle @@ -0,0 +1,41 @@ +/* + * 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.dynamic-feature' + +android { + compileSdkVersion rootProject.latestCompileSdk + + defaultConfig { + minSdkVersion 14 + targetSdkVersion rootProject.latestCompileSdk + testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + buildFeatures.viewBinding = true +} + +dependencies { + implementation project(':app-with-features') + + androidTestImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' +} diff --git a/integration-tests/ViewBindingTestApp/feature/src/androidTest/java/com/example/feature/IncludeFromAppTest.java b/integration-tests/ViewBindingTestApp/feature/src/androidTest/java/com/example/feature/IncludeFromAppTest.java new file mode 100644 index 00000000..28cb90f8 --- /dev/null +++ b/integration-tests/ViewBindingTestApp/feature/src/androidTest/java/com/example/feature/IncludeFromAppTest.java @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package com.example.feature; + +import static org.junit.Assert.assertNotNull; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.view.LayoutInflater; +import android.view.View; +import com.example.feature.databinding.IncludeFromAppBinding; +import org.junit.Test; + +public final class IncludeFromAppTest { + private final Context context = InstrumentationRegistry.getTargetContext(); + private final LayoutInflater inflater = LayoutInflater.from(context); + + @Test public void inflate() { + IncludeFromAppBinding binding = IncludeFromAppBinding.inflate(inflater); + + // TODO(b/142939794): This should be of type com.example.viewbinding.databinding.IncludeFromLibraryBinding + View with = binding.fromApp; + assertNotNull(with); + } +} diff --git a/integration-tests/ViewBindingTestApp/feature/src/main/AndroidManifest.xml b/integration-tests/ViewBindingTestApp/feature/src/main/AndroidManifest.xml new file mode 100644 index 00000000..4951cf29 --- /dev/null +++ b/integration-tests/ViewBindingTestApp/feature/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> + +<manifest + xmlns:dist="http://schemas.android.com/apk/distribution" + package="com.example.feature" + > + <dist:module + dist:onDemand="true" + dist:title="@string/feature_name" + > + <dist:fusing dist:include="true" /> + </dist:module> +</manifest> diff --git a/integration-tests/ViewBindingTestApp/feature/src/main/res/layout/include_from_app.xml b/integration-tests/ViewBindingTestApp/feature/src/main/res/layout/include_from_app.xml new file mode 100644 index 00000000..43dc08ab --- /dev/null +++ b/integration-tests/ViewBindingTestApp/feature/src/main/res/layout/include_from_app.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + > + <include + layout="@layout/include_from_library" + android:id="@+id/from_app" + /> +</LinearLayout> diff --git a/integration-tests/ViewBindingTestApp/settings.gradle b/integration-tests/ViewBindingTestApp/settings.gradle index 9f1b48a1..67c31f2e 100644 --- a/integration-tests/ViewBindingTestApp/settings.gradle +++ b/integration-tests/ViewBindingTestApp/settings.gradle @@ -1,4 +1,6 @@ include ':app' include ':app-test' +include ':app-with-features' +include ':feature' include ':lib-with-view-binding' include ':lib-without-view-binding' |