diff options
author | Scott Pollom <spollom@google.com> | 2022-08-23 13:51:53 -0700 |
---|---|---|
committer | Scott Pollom <spollom@google.com> | 2022-08-23 15:53:40 -0700 |
commit | 52ca81b62c1bb2d8b8dde166f2ff17d409ec36a9 (patch) | |
tree | 029aaa5c80f01bc533484d95e25bb1c12e0bd7ef | |
parent | 2dd2136888b7da1112473fef4106da56b0d51565 (diff) | |
download | data-binding-52ca81b62c1bb2d8b8dde166f2ff17d409ec36a9.tar.gz |
Migrate test project template to namespace DSL
Bug: 172361895
Test: existing
Change-Id: I9632d2771e3636d599b298127ac047e2659ba4c2
6 files changed, 13 insertions, 12 deletions
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt index 36f93ab3..8258ef9c 100644 --- a/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt +++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt @@ -46,7 +46,7 @@ private const val TEST_DATA_PATH = "tools/data-binding/compilationTests/testData private val pattern: Pattern = Pattern.compile("!@\\{([A-Za-z0-9_-]*)}") -const val KEY_MANIFEST_PACKAGE = "PACKAGE" +const val KEY_NAMESPACE = "NAMESPACE" const val KEY_DEPENDENCIES = "DEPENDENCIES" const val KEY_SETTINGS_INCLUDES = "SETTINGS_INCLUDES" const val DEFAULT_APP_PACKAGE = "com.android.databinding.compilationTest.test" @@ -193,7 +193,7 @@ abstract class DataBindingCompilationTestCase : AndroidGradleTestCase() { * depending on the key. * * If key is [KEY_DEPENDENCIES], then append the replacement. - * If key is [KEY_MANIFEST_PACKAGE] or [KEY_SETTINGS_INCLUDES], + * If key is [KEY_NAMESPACE] or [KEY_SETTINGS_INCLUDES], * then put if value doesn't already exist. */ private fun appendTestReplacements( @@ -205,8 +205,8 @@ abstract class DataBindingCompilationTestCase : AndroidGradleTestCase() { } else { mutableMap[KEY_DEPENDENCIES] = TEST_DEPENDENCIES } - if (!mutableMap.containsKey(KEY_MANIFEST_PACKAGE)) { - mutableMap[KEY_MANIFEST_PACKAGE] = DEFAULT_APP_PACKAGE + if (!mutableMap.containsKey(KEY_NAMESPACE)) { + mutableMap[KEY_NAMESPACE] = DEFAULT_APP_PACKAGE } if (!mutableMap.containsKey(KEY_SETTINGS_INCLUDES)) { mutableMap[KEY_SETTINGS_INCLUDES] = DEFAULT_SETTINGS_GRADLE diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt index a06b479c..d9db7ab8 100644 --- a/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt +++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt @@ -253,7 +253,7 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() { KEY_SETTINGS_INCLUDES to "include ':app'\ninclude ':module1'" ) ) - loadModule("module1", mapOf(KEY_MANIFEST_PACKAGE to "com.example.module1")) + loadModule("module1", mapOf(KEY_NAMESPACE to "com.example.module1")) copyTestData("layout/basic_layout.xml", "module1/src/main/res/layout/module_layout.xml") copyTestData("layout/basic_layout.xml", "app/src/main/res/layout/app_layout.xml") @@ -335,7 +335,7 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() { loadModule( "module1", mapOf( KEY_DEPENDENCIES to "implementation 'com.android.support:appcompat-v7:23.1.1'", - KEY_MANIFEST_PACKAGE to "com.example.module1" + KEY_NAMESPACE to "com.example.module1" ) ) copyTestData("layout/basic_layout.xml", "module1/src/main/res/layout/module_layout.xml") @@ -361,10 +361,10 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() { "module1", mapOf( KEY_DEPENDENCIES to "implementation project(':module2')", - KEY_MANIFEST_PACKAGE to "com.example.module1" + KEY_NAMESPACE to "com.example.module1" ) ) - loadModule("module2", mapOf(KEY_MANIFEST_PACKAGE to "com.example.module2")) + loadModule("module2", mapOf(KEY_NAMESPACE to "com.example.module2")) copyTestData( "layout/basic_layout.xml", "module2/src/main/res/layout/module2_layout.xml" diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt index dc2837f4..242b53e4 100644 --- a/compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt +++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt @@ -59,7 +59,7 @@ class TooManyLayoutsTest : DataBindingCompilationTestCase() { ) ) (0 until moduleCount).forEach { - loadModule("module$it", mapOf(KEY_MANIFEST_PACKAGE to "com.example.module$it")) + loadModule("module$it", mapOf(KEY_NAMESPACE to "com.example.module$it")) (0 until layoutsPerModule).forEach { layoutId -> copyTestData( "layout/basic_layout.xml", @@ -97,7 +97,7 @@ class TooManyLayoutsTest : DataBindingCompilationTestCase() { loadModule( "module$it", mapOf( - KEY_MANIFEST_PACKAGE to "com.example.module$it", + KEY_NAMESPACE to "com.example.module$it", KEY_DEPENDENCIES to deps ) ) // add dependency ? diff --git a/compilationTests/testData/AndroidManifest.xml b/compilationTests/testData/AndroidManifest.xml index 4923dbcb..bcb3c6dc 100644 --- a/compilationTests/testData/AndroidManifest.xml +++ b/compilationTests/testData/AndroidManifest.xml @@ -14,7 +14,6 @@ limitations under the License. --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="!@{PACKAGE}"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> </manifest> diff --git a/compilationTests/testData/app_build.gradle b/compilationTests/testData/app_build.gradle index ec1f85df..bc0f9a54 100644 --- a/compilationTests/testData/app_build.gradle +++ b/compilationTests/testData/app_build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { + namespace "!@{NAMESPACE}" compileSdkVersion rootProject.latestCompileSdk buildToolsVersion rootProject.buildToolsVersion defaultConfig { diff --git a/compilationTests/testData/module_build.gradle b/compilationTests/testData/module_build.gradle index 473243fa..2de34443 100644 --- a/compilationTests/testData/module_build.gradle +++ b/compilationTests/testData/module_build.gradle @@ -17,6 +17,7 @@ apply plugin: 'com.android.library' android { + namespace "!@{NAMESPACE}" compileSdkVersion rootProject.latestCompileSdk buildToolsVersion rootProject.buildToolsVersion defaultConfig { |