Remove test compilation of support libraries
Bug: b/270105162
Change-Id: Ia35b59f4fa1aed5eff287f7b5dfaaba6ec8b09c7
diff --git a/build.gradle b/build.gradle
index 6be1adc..ba8df69 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,7 +8,6 @@
import net.ltgt.gradle.errorprone.CheckSeverity
import org.gradle.internal.os.OperatingSystem
import tasks.DownloadDependency
-import tasks.GetJarsFromConfiguration
plugins {
id "net.ltgt.errorprone" version "2.0.2"
@@ -194,10 +193,6 @@
}
}
-configurations {
- supportLibs
-}
-
dependencies {
implementation "com.google.code.gson:gson:$gsonVersion"
// Include all of guava when compiling the code, but exclude annotations that we don't
@@ -262,9 +257,6 @@
examplesCompile "com.google.guava:guava:$guavaVersion"
examplesCompile "junit:junit:$junitVersion"
examplesCompile "org.mockito:mockito-core:$mockitoVersion"
- supportLibs "com.android.support:support-v4:$androidSupportVersion"
- supportLibs "junit:junit:$junitVersion"
- supportLibs "com.android.support.test.espresso:espresso-core:$espressoVersion"
apiUsageSampleCompile sourceSets.main.output
apiUsageSampleCompile "com.google.guava:guava:$guavaVersion"
kotlinR8TestResourcesCompileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
@@ -1547,10 +1539,6 @@
includeEmptyDirs = false
}
-task getJarsFromSupportLibs(type: GetJarsFromConfiguration) {
- setConfiguration(configurations.supportLibs)
-}
-
task generateR8TestKeepRules {
def path = "build/generated/r8tests-keep.txt"
outputs.file path
@@ -1940,7 +1928,6 @@
dependsOn sourceSets.keepanno.output
dependsOn buildLibraryDesugarConversions
- dependsOn getJarsFromSupportLibs
// R8.jar is required for running bootstrap tests.
dependsOn r8
diff --git a/buildSrc/src/main/java/tasks/GetJarsFromConfiguration.java b/buildSrc/src/main/java/tasks/GetJarsFromConfiguration.java
deleted file mode 100644
index d638e0d..0000000
--- a/buildSrc/src/main/java/tasks/GetJarsFromConfiguration.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-package tasks;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import org.gradle.api.DefaultTask;
-import org.gradle.api.artifacts.Configuration;
-import org.gradle.api.file.FileTree;
-import org.gradle.api.tasks.InputFiles;
-import org.gradle.api.tasks.OutputDirectory;
-import org.gradle.api.tasks.OutputFile;
-import org.gradle.api.tasks.TaskAction;
-
-/**
- * Extract all jars from the configuration. If an aar is in the configuration, classes.jar is
- * extracted. Locations of the jars are written to a generated file.
- */
-public class GetJarsFromConfiguration extends DefaultTask {
-
- private Configuration configuration;
-
- @InputFiles
- public Configuration getInputFiles() {
- return configuration;
- }
-
- public void setConfiguration(Configuration configuration) {
- this.configuration = configuration;
- }
-
- @OutputDirectory
- public File getOutputDir() {
- return new File(getProject().getBuildDir(), "supportlibraries");
- }
-
- @OutputFile
- public File getGeneratedFile() {
- return new File(getProject().getBuildDir(), "generated/supportlibraries.txt");
- }
-
- @TaskAction
- public void extract() throws IOException {
- Files.createDirectories(getOutputDir().toPath());
-
- Set<File> configurationFiles = configuration.getFiles();
- List<String> jarPaths = new ArrayList<>(configurationFiles.size());
- for (File file : configurationFiles) {
- jarPaths.add(getSingleJar(file));
- }
-
- Path generatedPath = getGeneratedFile().toPath();
- Files.deleteIfExists(generatedPath);
- Files.createDirectories(generatedPath.getParent());
- Files.write(generatedPath, jarPaths);
- }
-
- private String getSingleJar(File jarOrAar) throws IOException {
- if (jarOrAar.getName().endsWith(".aar")) {
- FileTree aarEntries = getProject().zipTree(jarOrAar);
-
- for (File aarEntry : aarEntries) {
- if (aarEntry.getName().equals("classes.jar")) {
- try (InputStream is = new FileInputStream(aarEntry)) {
- String jarName = jarOrAar.getName().replaceAll("\\.aar$", ".jar");
- Path extractedPath = getOutputDir().toPath().resolve(jarName);
- Files.deleteIfExists(extractedPath);
- Files.copy(is, extractedPath);
-
- return extractedPath.toString();
- }
- }
- }
- throw new RuntimeException("Aar does not contain classes.jar: " + jarOrAar.toString());
- } else {
- return jarOrAar.toString();
- }
- }
-}
diff --git a/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java b/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java
deleted file mode 100644
index 6a6e8d7..0000000
--- a/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.desugar;
-
-import static com.android.tools.r8.ToolHelper.CLASSPATH_SEPARATOR;
-
-import com.android.tools.r8.D8Command;
-import com.android.tools.r8.ToolHelper;
-import com.android.tools.r8.errors.CompilationError;
-import com.android.tools.r8.utils.AndroidApiLevel;
-import com.android.tools.r8.utils.OffOrAuto;
-import com.android.tools.r8.utils.StringUtils;
-import com.google.common.collect.Sets;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class BasicTestDependenciesDesugaringTest {
-
- private static final String[] allLibs;
- static {
- try {
- allLibs =
- Files.readAllLines(Paths.get(ToolHelper.BUILD_DIR, "generated", "supportlibraries.txt"))
- .toArray(StringUtils.EMPTY_ARRAY);
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- }
-
- private static Set<String> knownIssues = Sets.newHashSet(StringUtils.EMPTY_ARRAY);
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Parameters(name = "{0}")
- public static Collection<String[]> data() {
- int libCount = allLibs.length;
- Collection<String[]> datas = new ArrayList<String[]>(libCount);
- for (int i = 0; i < libCount; i++) {
- StringBuilder classpath = new StringBuilder();
- for (int j = 0; j < libCount; j++) {
- if (j != i) {
- classpath.append(allLibs[j]).append(CLASSPATH_SEPARATOR);
- }
- }
- datas.add(new String[] {new File(allLibs[i]).getName(), allLibs[i], classpath.toString()});
- }
- return datas;
- }
-
- private String name;
- private Path toCompile;
- private List<Path> classpath;
-
- public BasicTestDependenciesDesugaringTest(String name, String toCompile, String classpath) {
- this.name = name;
- this.toCompile = Paths.get(toCompile);
- this.classpath = Arrays.asList(classpath.split(CLASSPATH_SEPARATOR)).stream()
- .map(string -> Paths.get(string)).collect(Collectors.toList());
- }
-
- @Test
- public void testCompile() throws Exception {
- if (knownIssues.contains(name)) {
- thrown.expect(CompilationError.class);
- }
- ToolHelper.runD8(
- D8Command.builder()
- .addClasspathFiles(classpath)
- .addProgramFiles(toCompile)
- .addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.K))
- .setMinApiLevel(AndroidApiLevel.K.getLevel()),
- options -> {
- options.interfaceMethodDesugaring = OffOrAuto.Auto;
- options.testing.disableStackMapVerification = name.equals("espresso-core-3.0.0.jar");
- });
- }
-
- @Test
- public void testCompileDontDesugarDefault() throws Exception {
- if (knownIssues.contains(name)) {
- thrown.expect(CompilationError.class);
- }
- ToolHelper.runD8(
- D8Command.builder()
- .addClasspathFiles(classpath)
- .addProgramFiles(toCompile)
- .addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.K))
- .setMinApiLevel(AndroidApiLevel.K.getLevel()),
- options -> {
- options.interfaceMethodDesugaring = OffOrAuto.Off;
- options.testing.disableStackMapVerification = name.equals("espresso-core-3.0.0.jar");
- });
- }
-}
diff --git a/third_party/dependencies.tar.gz.sha1 b/third_party/dependencies.tar.gz.sha1
index 714ebaa..fc52c9a 100644
--- a/third_party/dependencies.tar.gz.sha1
+++ b/third_party/dependencies.tar.gz.sha1
@@ -1 +1 @@
-6a61ba19b7b9d0b776839b5f6d2efee7732db399
\ No newline at end of file
+0ed74e4bea29a056eb1870c244e6b0cf46aaac70
\ No newline at end of file
diff --git a/third_party/dependencies_new.tar.gz.sha1 b/third_party/dependencies_new.tar.gz.sha1
index 06a0844..a678343 100644
--- a/third_party/dependencies_new.tar.gz.sha1
+++ b/third_party/dependencies_new.tar.gz.sha1
@@ -1 +1 @@
-6b9cdd6a300430a714493fc4a7673db43cea5faa
\ No newline at end of file
+ce954d74e0bb5c3b2f116c327558e71819e38a48
\ No newline at end of file
diff --git a/tools/create_local_maven_with_dependencies.py b/tools/create_local_maven_with_dependencies.py
index 3afa029..138af36 100755
--- a/tools/create_local_maven_with_dependencies.py
+++ b/tools/create_local_maven_with_dependencies.py
@@ -50,8 +50,6 @@
TEST_DEPENDENCIES = [
'junit:junit:{version}'.format(version = JUNIT_VERSION),
- 'com.android.support:support-v4:{version}'.format(version = ANDRDID_SUPPORT_VERSION),
- 'com.android.support.test.espresso:espresso-core:{version}'.format(version = ESPRESSO_VERSION),
'com.android.tools.smali:smali:{version}'.format(version = SMALI_VERSION),
'com.google.errorprone:error_prone_core:{version}'.format(version = ERROR_PRONE_VERSION),
'org.javassist:javassist:{version}'.format(version = JAVASSIST_VERSION),