summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Xu <peterx@google.com>2021-01-14 15:12:28 -0800
committerPeter Xu <peterx@google.com>2021-01-14 17:25:52 -0800
commitbd442ae6a9b4b12d90ca4a3d2d3fd3848b155734 (patch)
tree8577bc9e53bc9e3e02db0c83b2f6ef996f500bc8
parentdd5f8a2338874973993b524d49d15f9f36f3d1d4 (diff)
downloaddata-binding-bd442ae6a9b4b12d90ca4a3d2d3fd3848b155734.tar.gz
Clean up compilationTests module
Clean up by moving files back to their original packages. Delete leftover resources. Test: n/a Bug: 173134729 Change-Id: Ie54ed34f89f74979882459da82fa378a3cbb0426
-rw-r--r--compilationTests/BUILD.bazel1
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/AppCompatResourcesTest.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/AppCompatResourcesTest.kt)3
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/BaseCompilationTest.java456
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/DataBindingCompilationTestCase.kt)18
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestUtils.kt71
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/InverseMethodTest.java (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/InverseMethodTest.java)3
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/MultiLayoutVerificationTest.java (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/MultiLayoutVerificationTest.java)17
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/NonEnglishLocaleTest.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/NonEnglishLocaleTest.kt)2
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/ObservableGetDetectionTest.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/ObservableGetDetectionTest.kt)2
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/RecursiveObservableTest.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/RecursiveObservableTest.kt)2
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/SimpleCompilationTest.kt)12
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/TemporaryBuildFolder.java82
-rw-r--r--compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt (renamed from compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/TooManyLayoutsTest.kt)5
-rw-r--r--compilationTests/src/test/resources/AndroidManifest.xml20
-rw-r--r--compilationTests/src/test/resources/app_build.gradle33
-rw-r--r--compilationTests/src/test/resources/commonBuildScript.gradle39
-rw-r--r--compilationTests/src/test/resources/layout/basic_layout.xml28
-rw-r--r--compilationTests/src/test/resources/layout/layout_with_include.xml30
-rw-r--r--compilationTests/src/test/resources/layout/layout_with_view_id.xml30
-rw-r--r--compilationTests/src/test/resources/layout/root_tag.xml29
-rw-r--r--compilationTests/src/test/resources/layout/safe_unbox_layout.xml28
-rw-r--r--compilationTests/src/test/resources/module_build.gradle42
-rw-r--r--compilationTests/src/test/resources/project_build.gradle5
-rw-r--r--compilationTests/src/test/resources/settings.gradle1
24 files changed, 29 insertions, 930 deletions
diff --git a/compilationTests/BUILD.bazel b/compilationTests/BUILD.bazel
index c0ad20f3..202f5c3d 100644
--- a/compilationTests/BUILD.bazel
+++ b/compilationTests/BUILD.bazel
@@ -15,7 +15,6 @@ iml_module(
"//tools/base/build-system:gradle-distrib",
"//tools/base/build-system:studio_repo.zip",
] + glob(["testData/**"]),
- test_resources = ["src/test/resources"],
test_shard_count = 4,
test_srcs = ["src/test/java"],
test_timeout = "long",
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/AppCompatResourcesTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/AppCompatResourcesTest.kt
index aab7e994..7b35bc14 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/AppCompatResourcesTest.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/AppCompatResourcesTest.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_DEPENDENCIES
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.containsString
import org.hamcrest.MatcherAssert.assertThat
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/BaseCompilationTest.java b/compilationTests/src/test/java/androidx/databinding/compilationTest/BaseCompilationTest.java
deleted file mode 100644
index 5afc1abb..00000000
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/BaseCompilationTest.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Copyright (C) 2015 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.compilationTest;
-
-import android.databinding.tool.processing.ScopedErrorReport;
-import android.databinding.tool.store.Location;
-import android.databinding.tool.util.Preconditions;
-import com.android.annotations.NonNull;
-import com.google.common.util.concurrent.SimpleTimeLimiter;
-import com.google.common.util.concurrent.TimeLimiter;
-import kotlin.Pair;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.filefilter.IOFileFilter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.SystemUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URISyntaxException;
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import static androidx.databinding.compilationTest.DataBindingCompilationTestUtilsKt.copyResourceToFile;
-import static androidx.databinding.compilationTest.DataBindingCompilationTestUtilsKt.copyResourceWithReplacement;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-
-public class BaseCompilationTest {
-
- private static final String PRINT_ENCODED_ERRORS_PROPERTY
- = "android.injected.invoked.from.ide";
- private static final String ENABLE_V2_PROPERTY
- = "android.databinding.enableV2";
- private static final String USE_ANDROID_X_PROPERTY =
- "android.useAndroidX";
- @Rule
- public TestName name = new TestName();
-
- public static final String KEY_MANIFEST_PACKAGE = "PACKAGE";
- public static final String KEY_DEPENDENCIES = "DEPENDENCIES";
- public static final String KEY_SETTINGS_INCLUDES = "SETTINGS_INCLUDES";
- public static final String DEFAULT_APP_PACKAGE = "com.android.databinding.compilationTest.test";
- public static final String KEY_CLASS_NAME = "CLASSNAME";
- public static final String KEY_CLASS_TYPE = "CLASSTYPE";
- public static final String KEY_IMPORT_TYPE = "IMPORTTYPE";
- public static final String KEY_INCLUDE_ID = "INCLUDEID";
- public static final String KEY_VIEW_ID = "VIEWID";
-
- /**
- * Maximum time allowed when reading the output stream, error stream, and waiting for
- * completion of the launched Gradle build process.
- */
- @NonNull private static final Duration GRADLE_BUILD_TIMEOUT = Duration.ofMinutes(5);
-
- @Rule
- public TemporaryBuildFolder tmpBuildFolder =
- new TemporaryBuildFolder(new File("./build", "build-test"), false);
-
- File testFolder;
-
- protected void copyResourceTo(String name, String path) throws IOException {
- copyResourceToFile(name, new File(testFolder, path));
- }
-
- protected void writeFile(String path, String contents) throws IOException {
- File targetFile = new File(testFolder, path);
- FileUtils.forceMkdir(targetFile.getParentFile());
- try(FileOutputStream fos = new FileOutputStream(targetFile)) {
- IOUtils.write(contents, fos);
- }
- }
-
- protected void copyResourceTo(String name, String path, Map<String, String> replacements)
- throws IOException {
- copyResourceWithReplacement(name, new File(testFolder, path), replacements);
- }
-
- @Before
- public void clear() throws IOException {
- testFolder = tmpBuildFolder.getFolder();
- }
-
- /**
- * Extracts the text in the given location from the the at the given application path.
- *
- * @param pathInApp The path, relative to the root of the application under test
- * @param location The location to extract
- * @return The string that is contained in the given location
- * @throws IOException If file is invalid.
- */
- protected String extract(String pathInApp, Location location) throws IOException {
- File file = new File(testFolder, pathInApp);
- assertTrue(file.exists());
- StringBuilder result = new StringBuilder();
- List<String> lines = FileUtils.readLines(file);
- for (int i = location.startLine; i <= location.endLine; i++) {
- if (i > location.startLine) {
- result.append("\n");
- }
- String line = lines.get(i);
- int start = 0;
- if (i == location.startLine) {
- start = location.startOffset;
- }
- int end = line.length() - 1; // inclusive
- if (i == location.endLine) {
- end = location.endOffset;
- }
- result.append(line.substring(start, end + 1));
- }
- return result.toString();
- }
-
- protected static Map<String, String> toMap(String... keysAndValues) {
- assertEquals(0, keysAndValues.length % 2);
- Map<String, String> map = new HashMap<String, String>();
- for (int i = 0; i < keysAndValues.length; i += 2) {
- map.put(keysAndValues[i], keysAndValues[i + 1]);
- }
- return map;
- }
-
- protected void prepareProject() throws IOException, URISyntaxException {
- prepareApp(null);
- }
-
- private Map<String, String> addDefaults(Map<String, String> map) {
- if (map == null) {
- map = new HashMap<String, String>();
- }
- if (!map.containsKey(KEY_MANIFEST_PACKAGE)) {
- map.put(KEY_MANIFEST_PACKAGE, DEFAULT_APP_PACKAGE);
- }
- if (!map.containsKey(KEY_SETTINGS_INCLUDES)) {
- map.put(KEY_SETTINGS_INCLUDES, "include ':app'");
- }
- return map;
- }
-
- protected void prepareApp(Map<String, String> replacements) throws IOException,
- URISyntaxException {
- replacements = addDefaults(replacements);
- // how to get build folder, pass from gradle somehow ?
- FileUtils.forceMkdir(testFolder);
- copyResourceWithReplacement("/AndroidManifest.xml",
- new File(testFolder, "app/src/main/AndroidManifest.xml"), replacements);
- copyResourceWithReplacement("/project_build.gradle",
- new File(testFolder, "build.gradle"), replacements);
- copyResourceWithReplacement("/app_build.gradle",
- new File(testFolder, "app/build.gradle"), replacements);
- copyResourceWithReplacement("/settings.gradle",
- new File(testFolder, "settings.gradle"), replacements);
- copyGradle(testFolder);
- }
-
- private void copyCommonBuildScript(File checkoutRoot) throws IOException {
- Map<String, String> replacements = new HashMap<>();
- replacements.put("CHECKOUT_ROOT", checkoutRoot.getAbsolutePath());
- copyResourceWithReplacement("/commonBuildScript.gradle",
- new File(testFolder.getParentFile(), "commonBuildScript.gradle"),
- replacements);
- }
-
- private void createLocalProperties(File checkoutRoot) throws IOException {
- File container = new File(checkoutRoot, "prebuilts/studio/sdk");
- File sdkFile;
- if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
- sdkFile = new File(container, "darwin");
- } else {
- sdkFile = new File(container, "linux");
- }
- Properties properties = new Properties();
- properties.setProperty("sdk.dir", sdkFile.getAbsolutePath());
- try(FileOutputStream fos = FileUtils.openOutputStream(new File(testFolder, "local"
- + ".properties"))) {
- properties.store(fos, "");
- }
- }
-
- protected void prepareModule(String moduleName, String packageName,
- Map<String, String> replacements) throws IOException, URISyntaxException {
- replacements = addDefaults(replacements);
- replacements.put(KEY_MANIFEST_PACKAGE, packageName);
- File moduleFolder = new File(testFolder, moduleName);
- if (moduleFolder.exists()) {
- FileUtils.forceDelete(moduleFolder);
- }
- FileUtils.forceMkdir(moduleFolder);
- copyResourceWithReplacement("/AndroidManifest.xml",
- new File(moduleFolder, "src/main/AndroidManifest.xml"), replacements);
- copyResourceWithReplacement("/module_build.gradle", new File(moduleFolder, "build.gradle"),
- replacements);
- }
-
- protected CompilationResult runGradle(String... params)
- throws IOException, InterruptedException {
- File pathToExecutable = new File(testFolder, "gradlew");
- List<String> args = new ArrayList<String>();
- args.add(pathToExecutable.getAbsolutePath());
- args.add("-P" + PRINT_ENCODED_ERRORS_PROPERTY + "=true");;
- args.add("-P" + USE_ANDROID_X_PROPERTY + "=true");
- args.add("--no-daemon");
- // Temporarily limit the number of workers to reduce the chance that the Gradle build
- // process hangs (bug 148496072).
- // TODO(148496072): Remove this once the bug is fixed.
- args.add("--max-workers=4");
- if ("true".equals(System.getProperties().getProperty("useReleaseVersion", "false"))) {
- args.add("-PuseReleaseVersion=true");
- }
- if ("true".equals(System.getProperties().getProperty("addRemoteRepos", "false"))) {
- args.add("-PaddRemoteRepos=true");
- }
- Collections.addAll(args, params);
- ProcessBuilder builder = new ProcessBuilder(args);
- builder.environment().putAll(System.getenv());
- String javaHome = System.getProperty("java.home");
- if (StringUtils.isNotBlank(javaHome)) {
- builder.environment().put("JAVA_HOME", javaHome);
- }
- builder.environment().put("ANDROID_SDK_HOME", new File(testFolder, "/android_sdk_home").getAbsolutePath());
- // to debug uncomment the next line
- // builder.environment().put("GRADLE_OPTS", "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006");
- builder.directory(testFolder);
- Process process = builder.start();
- Pair<Boolean, String> outputInfo =
- readInputStreamWithTimeout(process.getInputStream(), GRADLE_BUILD_TIMEOUT);
- Pair<Boolean, String> errorInfo =
- readInputStreamWithTimeout(process.getErrorStream(), GRADLE_BUILD_TIMEOUT);
- boolean executionInfo =
- process.waitFor(GRADLE_BUILD_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
- ensureProcessCompleted(process, outputInfo, errorInfo, executionInfo, GRADLE_BUILD_TIMEOUT);
- return new CompilationResult(
- process.exitValue(), outputInfo.getSecond(), errorInfo.getSecond());
- }
-
- private void copyGradle(File outFolder) throws IOException {
- File toolsDir = findToolsDir();
- copyCommonBuildScript(toolsDir.getParentFile());
- createLocalProperties(toolsDir.getParentFile());
- File gradleDir = new File(toolsDir, "external/gradle");
- File propsFile = new File(toolsDir, "gradle/wrapper/gradle-wrapper.properties");
- Properties properties = new Properties();
-
- try (FileInputStream propStream = FileUtils.openInputStream(propsFile)) {
- properties.load(propStream);
- }
- String distributionUrl = properties.getProperty("distributionUrl");
- String[] sections = distributionUrl.split("/");
- String version = sections[sections.length - 1];
- File distroFile = new File(gradleDir, version);
- Preconditions.check(distroFile.exists(), "cannot find gradle distro");
- properties.setProperty("distributionUrl", distroFile.getCanonicalFile().toURI().toString());
- FileUtils.copyDirectory(new File(toolsDir, "gradle"), new File(outFolder, "gradle"),
- new IOFileFilter() {
- @Override
- public boolean accept(File file) {
- return !file.getName().endsWith(".git");
- }
-
- @Override
- public boolean accept(File file, String s) {
- return !s.endsWith(".git");
- }
- });
- try (FileOutputStream propsOutStream = FileUtils.openOutputStream(
- new File(outFolder, "gradle/wrapper/gradle-wrapper"
- + ".properties"))) {
- properties.store(propsOutStream, "");
- }
- File gradlew = new File(outFolder, "gradlew");
- FileUtils.copyFile(new File(toolsDir, "gradlew"), gradlew);
- gradlew.setExecutable(true);
- }
-
- @NonNull
- private File findToolsDir() throws IOException {
- File toolsFolder = new File(".").getCanonicalFile();
- while (toolsFolder.exists()) {
- File dataBinding = new File(toolsFolder, "data-binding");
- File base = new File(toolsFolder, "base");
- if (dataBinding.exists() && dataBinding.isDirectory() &&
- base.exists() && base.isDirectory()) {
- break;
- } else {
- if (toolsFolder.getParentFile() == null ||
- toolsFolder.getParentFile().equals(toolsFolder)) {
- throw new IllegalStateException("Cannot find tools folder");
- }
- toolsFolder = toolsFolder.getParentFile();
- }
- }
- return toolsFolder;
- }
-
- /**
- * Finds the error file referenced in the given error report.
- * Handles possibly relative paths.
- *
- * Throws an assertion exception if the error file reported cannot be found.
- */
- @NonNull
- File requireErrorFile(ScopedErrorReport report) {
- String path = report.getFilePath();
- assertNotNull(path);
- File file = new File(path);
- if (file.exists()) {
- return file;
- }
- // might be relative, try in test project folder
- file = new File(testFolder, path);
- assertTrue("required error file is missing in " + file.getAbsolutePath(), file.exists());
- return file;
- }
-
- /**
- * Checks whether the given process has completed.
- *
- * If the process timed out, this method will
- * - destroy the process (see bug 148598093)
- * - throw a runtime exception containing the output and error logs from the process so far
- * for debugging (see bug 148496072).
- *
- * @param process the process to check
- * @param outputInfo the result of reading the process's output (see readInputStreamWithTimeout)
- * @param errorInfo the result of reading the process's error (see readInputStreamWithTimeout)
- * @param executionInfo the result of calling Process.waitFor() on the process
- * @param timeout the timeout used when obtaining outputInfo, errorInfo, and executionInfo
- */
- @SuppressWarnings("StringConcatenationInsideStringBufferAppend")
- private void ensureProcessCompleted(
- @NonNull Process process,
- @NonNull Pair<Boolean, String> outputInfo,
- @NonNull Pair<Boolean, String> errorInfo,
- boolean executionInfo,
- @SuppressWarnings("SameParameterValue") @NonNull Duration timeout) {
- boolean processCompleted = outputInfo.getFirst() && errorInfo.getFirst() && executionInfo;
- if (!processCompleted) {
- process.destroyForcibly();
- StringBuilder message = new StringBuilder();
- if (!outputInfo.getFirst()) {
- message.append("Timeout (" + timeout.getSeconds() + "s) when reading output logs.\n");
- }
- if (!errorInfo.getFirst()) {
- message.append("Timeout (" + timeout.getSeconds() + "s) when reading error logs.\n");
- }
- if (!executionInfo) {
- message.append("Timeout (" + timeout.getSeconds() + "s) when waiting for process to complete.\n");
- }
- if (outputInfo.getSecond().isEmpty()) {
- message.append("Output logs: (empty)\n");
- } else {
- message.append("Output logs:\n" + outputInfo.getSecond() + "\n");
- }
- if (errorInfo.getSecond().isEmpty()) {
- message.append("Error logs: (empty)\n");
- } else {
- message.append("Error logs:\n" + errorInfo.getSecond() + "\n");
- }
- throw new RuntimeException(message.toString());
- }
- }
-
- /**
- * Reads the input stream and stores the result in the given StringBuilder. This is so that if
- * this method times out, the caller may still be able to get the result so far, see
- * readInputStreamWithTimeout method.
- */
- private static void readInputStream(
- @NonNull InputStream inputStream, @NonNull StringBuilder result) throws IOException {
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
- String line;
- while ((line = reader.readLine()) != null) {
- // Synchronize result as it may be read from another thread, see
- // readInputStreamWithTimeout method
- //noinspection SynchronizationOnLocalVariableOrMethodParameter
- synchronized (result) {
- result.append(line).append("\n");
- }
- }
- }
- }
-
- /**
- * Reads the input stream with a timeout.
- *
- * @return a pair of value. The first value is `true` if reading was successful (did not time
- * out). The second value is what has been read so far (could be incomplete if it timed
- * out).
- */
- @NonNull
- private static Pair<Boolean, String> readInputStreamWithTimeout(
- @NonNull InputStream inputStream,
- @SuppressWarnings("SameParameterValue") @NonNull Duration timeout) {
- StringBuilder result = new StringBuilder();
- Callable<Void> callable = () -> {
- readInputStream(inputStream, result);
- return null;
- };
- @SuppressWarnings("UnstableApiUsage")
- TimeLimiter timeLimiter = SimpleTimeLimiter.create(Executors.newSingleThreadExecutor());
- try {
- timeLimiter.callWithTimeout(callable, timeout.toMillis(), TimeUnit.MILLISECONDS);
- } catch (TimeoutException e) {
- // The launched thread that does the actual reading of the input stream should have been
- // cancelled with InterruptedException by the TimeLimiter, so no need to clean it up
- // here.
- // Synchronize result as the launched thread may still be running for a bit longer and
- // writing to the result after this thread sent the cancellation signal (see
- // readInputStream method).
- synchronized (result) {
- return new Pair<>(false, result.toString());
- }
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- // Synchronize result, see above comment
- synchronized (result) {
- return new Pair<>(true, result.toString());
- }
- }
-}
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/DataBindingCompilationTestCase.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt
index 62604ac6..e25f32f9 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/DataBindingCompilationTestCase.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestCase.kt
@@ -13,16 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
import android.databinding.tool.processing.ScopedErrorReport
import android.databinding.tool.store.Location
-import androidx.databinding.compilationTest.BaseCompilationTest.DEFAULT_APP_PACKAGE
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_DEPENDENCIES
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_MANIFEST_PACKAGE
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_SETTINGS_INCLUDES
-import androidx.databinding.compilationTest.CompilationResult
-import androidx.databinding.compilationTest.pattern
import com.android.testutils.TestUtils
import com.android.tools.idea.gradle.project.build.invoker.GradleBuildInvoker
import com.android.tools.idea.testing.AndroidGradleTestCase
@@ -37,12 +31,20 @@ import java.io.File
import java.io.IOException
import java.nio.charset.StandardCharsets
import java.nio.file.Files
+import java.util.regex.Pattern
private const val TEST_DEPENDENCIES = "implementation 'androidx.fragment:fragment:+'"
private const val DEFAULT_SETTINGS_GRADLE = "include ':app'"
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_DEPENDENCIES = "DEPENDENCIES"
+const val KEY_SETTINGS_INCLUDES = "SETTINGS_INCLUDES"
+const val DEFAULT_APP_PACKAGE = "com.android.databinding.compilationTest.test"
+
abstract class DataBindingCompilationTestCase : AndroidGradleTestCase() {
protected fun loadApp() {
@@ -173,7 +175,7 @@ abstract class DataBindingCompilationTestCase : AndroidGradleTestCase() {
): Map<String, String> {
val mutableMap = map.toMutableMap()
if (mutableMap.containsKey(KEY_DEPENDENCIES)) {
- mutableMap[KEY_DEPENDENCIES] += "\n${TEST_DEPENDENCIES}"
+ mutableMap[KEY_DEPENDENCIES] += "\n$TEST_DEPENDENCIES"
} else {
mutableMap[KEY_DEPENDENCIES] = TEST_DEPENDENCIES
}
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestUtils.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestUtils.kt
deleted file mode 100644
index 0109727b..00000000
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/DataBindingCompilationTestUtils.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2021 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.compilationTest
-
-import org.apache.commons.io.FileUtils
-import org.apache.commons.io.IOUtils
-import java.io.File
-import java.nio.charset.StandardCharsets
-import java.util.regex.Pattern
-
-val pattern: Pattern = Pattern.compile("!@\\{([A-Za-z0-9_-]*)}")
-
-/**
- * Copies the resource to the target file.
- */
-fun copyResourceToFile(name: String, targetFile: File) {
- val directory = targetFile.parentFile
- FileUtils.forceMkdir(directory)
- BaseCompilationTest::class.java.getResourceAsStream(name).use { input ->
- FileUtils.copyInputStreamToFile(input, targetFile)
- }
-}
-
-/**
- * Looks for special sentinel [pattern] in the resource and perform replacements. If replacement for
- * a key is not provided, then the sentinel will be replaced with blank string.
- *
- * Then copies the replaced resource to target.
- */
-fun copyResourceWithReplacement(
- name: String,
- targetFile: File,
- replacements: Map<String, String> = emptyMap()
-) {
- BaseCompilationTest::class.java.getResourceAsStream(name).use { inputStream ->
- val contents = IOUtils.toString(inputStream, StandardCharsets.UTF_8)
- val out = StringBuilder(contents.length)
- val matcher = pattern.matcher(contents)
- var location = 0
- while (matcher.find()) {
- val start = matcher.start()
- if (start > location) {
- out.append(contents, location, start)
- }
- val key = matcher.group(1)
- val replacement = replacements[key]
- if (replacement != null) {
- out.append(replacement)
- }
- location = matcher.end()
- }
- if (location < contents.length) {
- out.append(contents, location, contents.length)
- }
- targetFile.parentFile.mkdirs()
- targetFile.writeText(out.toString(), StandardCharsets.UTF_8)
- }
-}
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/InverseMethodTest.java b/compilationTests/src/test/java/androidx/databinding/compilationTest/InverseMethodTest.java
index 6e11c327..0d99c44c 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/InverseMethodTest.java
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/InverseMethodTest.java
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel;
+package androidx.databinding.compilationTest;
-import androidx.databinding.compilationTest.CompilationResult;
import com.google.common.collect.Lists;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/MultiLayoutVerificationTest.java b/compilationTests/src/test/java/androidx/databinding/compilationTest/MultiLayoutVerificationTest.java
index 53dd8f24..d07d366b 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/MultiLayoutVerificationTest.java
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/MultiLayoutVerificationTest.java
@@ -14,13 +14,12 @@
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel;
+package androidx.databinding.compilationTest;
import android.databinding.tool.processing.ErrorMessages;
import android.databinding.tool.processing.ScopedErrorReport;
import android.databinding.tool.processing.ScopedException;
import android.databinding.tool.store.Location;
-import androidx.databinding.compilationTest.CompilationResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -30,16 +29,18 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
-import static androidx.databinding.compilationTest.BaseCompilationTest.DEFAULT_APP_PACKAGE;
-import static androidx.databinding.compilationTest.BaseCompilationTest.KEY_CLASS_NAME;
-import static androidx.databinding.compilationTest.BaseCompilationTest.KEY_CLASS_TYPE;
-import static androidx.databinding.compilationTest.BaseCompilationTest.KEY_IMPORT_TYPE;
-import static androidx.databinding.compilationTest.BaseCompilationTest.KEY_INCLUDE_ID;
-import static androidx.databinding.compilationTest.BaseCompilationTest.KEY_VIEW_ID;
+import static androidx.databinding.compilationTest.DataBindingCompilationTestCaseKt.DEFAULT_APP_PACKAGE;
import static org.junit.Assert.assertNotEquals;
+
@RunWith(JUnit4.class)
public class MultiLayoutVerificationTest extends DataBindingCompilationTestCase {
+ private static final String KEY_CLASS_NAME = "CLASSNAME";
+ private static final String KEY_CLASS_TYPE = "CLASSTYPE";
+ private static final String KEY_IMPORT_TYPE = "IMPORTTYPE";
+ private static final String KEY_INCLUDE_ID = "INCLUDEID";
+ private static final String KEY_VIEW_ID = "VIEWID";
+
@Test
public void testMultipleLayoutFilesWithNameMismatch() throws IOException {
loadApp();
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/NonEnglishLocaleTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/NonEnglishLocaleTest.kt
index 3f05397f..8f8515eb 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/NonEnglishLocaleTest.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/NonEnglishLocaleTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.containsString
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/ObservableGetDetectionTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/ObservableGetDetectionTest.kt
index 60bcee27..160b84a0 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/ObservableGetDetectionTest.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/ObservableGetDetectionTest.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
import org.apache.commons.lang3.StringEscapeUtils
import org.hamcrest.CoreMatchers.`is`
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/RecursiveObservableTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/RecursiveObservableTest.kt
index e7d65823..862b8f89 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/RecursiveObservableTest.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/RecursiveObservableTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
import android.databinding.tool.processing.ErrorMessages
import org.hamcrest.CoreMatchers.containsString
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/SimpleCompilationTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt
index 0e8c369a..4ffb8d56 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/SimpleCompilationTest.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt
@@ -13,14 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
import android.databinding.tool.processing.ErrorMessages
import android.databinding.tool.processing.ScopedException
-import androidx.databinding.compilationTest.BaseCompilationTest
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_DEPENDENCIES
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_MANIFEST_PACKAGE
-import androidx.databinding.compilationTest.CompilationResult
import com.google.common.base.Joiner
import org.apache.commons.io.FileUtils
import org.apache.commons.io.filefilter.NameFileFilter
@@ -238,7 +234,7 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() {
loadApp(
mapOf(
KEY_DEPENDENCIES to "implementation project(':module1')",
- BaseCompilationTest.KEY_SETTINGS_INCLUDES to "include ':app'\ninclude ':module1'"
+ KEY_SETTINGS_INCLUDES to "include ':app'\ninclude ':module1'"
)
)
loadModule("module1", mapOf(KEY_MANIFEST_PACKAGE to "com.example.module1"))
@@ -317,7 +313,7 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() {
loadApp(
mapOf(
KEY_DEPENDENCIES to "implementation project(':module1')",
- BaseCompilationTest.KEY_SETTINGS_INCLUDES to "include ':app'\ninclude ':module1'"
+ KEY_SETTINGS_INCLUDES to "include ':app'\ninclude ':module1'"
)
)
loadModule(
@@ -340,7 +336,7 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() {
loadApp(
mapOf(
KEY_DEPENDENCIES to "implementation project(':module1')",
- BaseCompilationTest.KEY_SETTINGS_INCLUDES to
+ KEY_SETTINGS_INCLUDES to
"include ':app'\ninclude ':module1'\n"
+ "include ':module2'"
)
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/TemporaryBuildFolder.java b/compilationTests/src/test/java/androidx/databinding/compilationTest/TemporaryBuildFolder.java
deleted file mode 100644
index 363b3d48..00000000
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/TemporaryBuildFolder.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2016 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.compilationTest;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.UUID;
-
-/**
- * A rule that creates a temporary folder for each test.
- * It is similar to Junit4's TemporaryFile rule but does not delete the temporary file if the
- * test fails.
- */
-public class TemporaryBuildFolder extends TestWatcher {
- private File mFile;
- private File mParent;
- private boolean mKeepOnFailure;
-
- public TemporaryBuildFolder(File parent) {
- this(parent, false);
- }
-
- public TemporaryBuildFolder(File parent, boolean keepOnFailure) {
- mParent = parent;
- mKeepOnFailure = keepOnFailure;
- }
-
- public File getFolder() {
- return mFile;
- }
-
- @Override
- protected void starting(Description description) {
- String className = description.getClassName();
- String methodName = description.getMethodName();
- String fileName = methodName + "-" + className + "-" +
- UUID.randomUUID().toString().substring(0, 8);
- mFile = new File(mParent, fileName.replaceAll("\\W+", "-"));
- try {
- FileUtils.forceMkdir(mFile);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- super.starting(description);
- }
-
- @Override
- protected void succeeded(Description description) {
- super.succeeded(description);
- // clean the directory since it succeeded
- FileUtils.deleteQuietly(mFile);
- }
-
- @Override
- protected void failed(Throwable e, Description description) {
- if (mKeepOnFailure) {
- System.out.println("To re-run this, go to:" + mFile.getAbsolutePath());
- } else {
- FileUtils.deleteQuietly(mFile);
- }
-
- super.failed(e, description);
- }
-}
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/TooManyLayoutsTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt
index 4e2ffaa7..dc2837f4 100644
--- a/compilationTests/src/test/java/androidx/databinding/compilationTest/bazel/TooManyLayoutsTest.kt
+++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/TooManyLayoutsTest.kt
@@ -13,11 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package androidx.databinding.compilationTest.bazel
+package androidx.databinding.compilationTest
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_DEPENDENCIES
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_MANIFEST_PACKAGE
-import androidx.databinding.compilationTest.BaseCompilationTest.KEY_SETTINGS_INCLUDES
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
diff --git a/compilationTests/src/test/resources/AndroidManifest.xml b/compilationTests/src/test/resources/AndroidManifest.xml
deleted file mode 100644
index 4923dbcb..00000000
--- a/compilationTests/src/test/resources/AndroidManifest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<!--
- Copyright (C) 2015 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="!@{PACKAGE}">
-
-</manifest>
diff --git a/compilationTests/src/test/resources/app_build.gradle b/compilationTests/src/test/resources/app_build.gradle
deleted file mode 100644
index ec1f85df..00000000
--- a/compilationTests/src/test/resources/app_build.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-
-android {
- compileSdkVersion rootProject.latestCompileSdk
- buildToolsVersion rootProject.buildToolsVersion
- defaultConfig {
- applicationId "com.android.databinding.test.compilationTestApp"
- minSdkVersion 21 //multidex
- targetSdkVersion rootProject.latestCompileSdk
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildFeatures {
- dataBinding = true
- }
- dataBinding {
- enabledForTests = true
- }
- buildTypes {
- release {
- minifyEnabled false
- }
- }
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "androidx.fragment:fragment:1.2.0"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
- !@{DEPENDENCIES}
-}
diff --git a/compilationTests/src/test/resources/commonBuildScript.gradle b/compilationTests/src/test/resources/commonBuildScript.gradle
deleted file mode 100644
index cd94804a..00000000
--- a/compilationTests/src/test/resources/commonBuildScript.gradle
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-rootProject.buildscript {
- rootProject.ext.checkoutDir = "!@{CHECKOUT_ROOT}"
- apply from: "${rootProject.ext.checkoutDir}/tools/buildSrc/base/version.gradle"
- rootProject.ext.latestCompileSdk = 30
- rootProject.ext.buildToolsVersion = "30.0.2"
-
- repositories {
- maven { url "file://${rootProject.ext.checkoutDir}/out/repo/" }
- maven { url "file://${rootProject.ext.checkoutDir}/prebuilts/tools/common/m2/repository/" }
- }
-
- dependencies {
- classpath "com.android.tools.build:gradle:${buildVersion}"
- classpath libs.kotlin_gradle_plugin
- }
-}
-
-rootProject.subprojects {
- repositories {
- maven { url "file://${rootProject.ext.checkoutDir}/out/repo/" }
- maven { url "file://${rootProject.ext.checkoutDir}/prebuilts/tools/common/m2/repository/" }
- }
-}
diff --git a/compilationTests/src/test/resources/layout/basic_layout.xml b/compilationTests/src/test/resources/layout/basic_layout.xml
deleted file mode 100644
index f76e9e0d..00000000
--- a/compilationTests/src/test/resources/layout/basic_layout.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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.
- -->
-
-<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:bind="http://schemas.android.com/apk/res-auto">
- <data>
- <variable name="myVar" type="String"/>
- </data>
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <!-- undefined variable -->
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:text="@{myVar}"/>
- </LinearLayout>
-</layout> \ No newline at end of file
diff --git a/compilationTests/src/test/resources/layout/layout_with_include.xml b/compilationTests/src/test/resources/layout/layout_with_include.xml
deleted file mode 100644
index 2eaef571..00000000
--- a/compilationTests/src/test/resources/layout/layout_with_include.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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.
- -->
-
-<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:bind="http://schemas.android.com/apk/res-auto">
- <data>
- <variable name="myVariable" type="String"/>
- </data>
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <!-- undefined variable -->
- <include layout="@layout/basic_layout" android:id="@+id/!@{INCLUDEID}" bind:myVariable="@{myVariable}"/>
- </LinearLayout>
-</layout> \ No newline at end of file
diff --git a/compilationTests/src/test/resources/layout/layout_with_view_id.xml b/compilationTests/src/test/resources/layout/layout_with_view_id.xml
deleted file mode 100644
index 21dc4404..00000000
--- a/compilationTests/src/test/resources/layout/layout_with_view_id.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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.
- -->
-
-<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:bind="http://schemas.android.com/apk/res-auto">
- <data>
- <variable name="myVariable" type="String"/>
- </data>
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <!-- undefined variable -->
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/!@{VIEWID}" android:text="@{myVariable}"/>
- </LinearLayout>
-</layout> \ No newline at end of file
diff --git a/compilationTests/src/test/resources/layout/root_tag.xml b/compilationTests/src/test/resources/layout/root_tag.xml
deleted file mode 100644
index ed93ce0c..00000000
--- a/compilationTests/src/test/resources/layout/root_tag.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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.
- -->
-
-<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:bind="http://schemas.android.com/apk/res-auto">
- <data>
- <variable name="myVar" type="String"/>
- </data>
- <LinearLayout
- android:tag="hello"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <!-- undefined variable -->
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:text="@{myVar}"/>
- </LinearLayout>
-</layout> \ No newline at end of file
diff --git a/compilationTests/src/test/resources/layout/safe_unbox_layout.xml b/compilationTests/src/test/resources/layout/safe_unbox_layout.xml
deleted file mode 100644
index 2485acd3..00000000
--- a/compilationTests/src/test/resources/layout/safe_unbox_layout.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 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.
- -->
-
-<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:bind="http://schemas.android.com/apk/res-auto">
- <data>
- <variable name="myInt" type="Integer"/>
- </data>
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <!-- undefined variable -->
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:text="!@{EXPR}"/>
- </LinearLayout>
-</layout> \ No newline at end of file
diff --git a/compilationTests/src/test/resources/module_build.gradle b/compilationTests/src/test/resources/module_build.gradle
deleted file mode 100644
index 473243fa..00000000
--- a/compilationTests/src/test/resources/module_build.gradle
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2015 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'
-
-android {
- compileSdkVersion rootProject.latestCompileSdk
- buildToolsVersion rootProject.buildToolsVersion
- defaultConfig {
- minSdkVersion 21 // multidex
- targetSdkVersion rootProject.latestCompileSdk
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildFeatures {
- dataBinding = true
- }
- buildTypes {
- release {
- minifyEnabled false
- }
- }
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- !@{DEPENDENCIES}
-}
diff --git a/compilationTests/src/test/resources/project_build.gradle b/compilationTests/src/test/resources/project_build.gradle
deleted file mode 100644
index 807a7c0e..00000000
--- a/compilationTests/src/test/resources/project_build.gradle
+++ /dev/null
@@ -1,5 +0,0 @@
-buildscript {
- def runningInIde = project.hasProperty('android.injected.invoked.from.ide')
- rootProject.ext.runningInIde = runningInIde
- apply from: "../commonBuildScript.gradle"
-}
diff --git a/compilationTests/src/test/resources/settings.gradle b/compilationTests/src/test/resources/settings.gradle
deleted file mode 100644
index 441a7a5f..00000000
--- a/compilationTests/src/test/resources/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-!@{SETTINGS_INCLUDES} \ No newline at end of file