Remove old buildSrc folder
This got somehow loaded by intellij and broke due to the asm update we
did a few months ago (where we did not update the version in this
folder)
Change-Id: I3e77f3c526e14ad31c906552098f8603f557a0d8
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
deleted file mode 100644
index dc6f3be..0000000
--- a/buildSrc/build.gradle
+++ /dev/null
@@ -1,30 +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.
-apply plugin: 'java'
-apply plugin: 'idea'
-
-repositories {
- maven {
- url uri('file:../third_party/dependencies')
- }
-}
-
-ext {
- guavaVersion = '31.1-jre'
- asmVersion = '9.5'
- smaliVersion = '3.0.3'
-}
-
-dependencies {
- implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
- implementation group: 'com.android.tools.smali', name: 'smali', version: smaliVersion
- implementation group: 'org.ow2.asm', name: 'asm', version: asmVersion
- implementation group: 'org.ow2.asm', name: 'asm-commons', version: asmVersion
- implementation group: 'org.ow2.asm', name: 'asm-tree', version: asmVersion
- implementation group: 'org.ow2.asm', name: 'asm-analysis', version: asmVersion
- implementation group: 'org.ow2.asm', name: 'asm-util', version: asmVersion
-}
-
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
diff --git a/buildSrc/src/main/java/kotlin/Kotlinc.java b/buildSrc/src/main/java/kotlin/Kotlinc.java
deleted file mode 100644
index efb39aa..0000000
--- a/buildSrc/src/main/java/kotlin/Kotlinc.java
+++ /dev/null
@@ -1,102 +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 kotlin;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import org.gradle.api.Action;
-import org.gradle.api.DefaultTask;
-import org.gradle.api.UncheckedIOException;
-import org.gradle.api.file.FileCollection;
-import org.gradle.api.file.FileTree;
-import org.gradle.api.tasks.InputFiles;
-import org.gradle.api.tasks.OutputFile;
-import org.gradle.api.tasks.TaskAction;
-import org.gradle.process.ExecSpec;
-import utils.Utils;
-
-/**
- * Gradle task to compile Kotlin source files. By default the generated classes target Java 1.6.
- */
-public class Kotlinc extends DefaultTask {
-
- private static final String kotlincExecName = Utils.toolsDir().equals("windows")
- ? "kotlinc.bat"
- : "kotlinc";
-
- private static final Path kotlincExecPath =
- Paths.get(
- "third_party", "kotlin", "kotlin-compiler-1.3.72", "kotlinc", "bin", kotlincExecName);
-
- enum KotlinTargetVersion {
- JAVA_6("1.6"),
- JAVA_8("1.8");
-
- private final String optionName;
-
- KotlinTargetVersion(String optionName) {
- this.optionName = optionName;
- }
- }
-
- private FileTree source;
-
- @OutputFile
- private File destination;
-
- private KotlinTargetVersion targetVersion = KotlinTargetVersion.JAVA_6;
-
- @InputFiles
- public FileCollection getInputFiles() {
- // Note: Using Path object directly causes stack overflow.
- // See: https://github.com/gradle/gradle/issues/1973
- return source.plus(getProject().files(kotlincExecPath.toFile()));
- }
-
- public FileTree getSource() {
- return source;
- }
-
- public void setSource(FileTree source) {
- this.source = source;
- }
-
- public File getDestination() {
- return destination;
- }
-
- public void setDestination(File destination) {
- this.destination = destination;
- }
-
- public KotlinTargetVersion getTargetVersion() {
- return targetVersion;
- }
-
- public void setTargetVersion(KotlinTargetVersion targetVersion) {
- this.targetVersion = targetVersion;
- }
-
- @TaskAction
- public void compile() {
- getProject().exec(new Action<ExecSpec>() {
- @Override
- public void execute(ExecSpec execSpec) {
- try {
- execSpec.setExecutable(kotlincExecPath.toFile());
- execSpec.args("-include-runtime");
- execSpec.args("-nowarn");
- execSpec.args("-jvm-target", targetVersion.optionName);
- execSpec.args("-d", destination.getCanonicalPath());
- execSpec.args(source.getFiles());
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
- }
- });
- }
-}
diff --git a/buildSrc/src/main/java/tasks/DownloadDependency.java b/buildSrc/src/main/java/tasks/DownloadDependency.java
deleted file mode 100644
index 6d7a75c..0000000
--- a/buildSrc/src/main/java/tasks/DownloadDependency.java
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (c) 2019, 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.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.inject.Inject;
-import org.gradle.api.DefaultTask;
-import org.gradle.api.file.RegularFileProperty;
-import org.gradle.api.provider.Property;
-import org.gradle.api.tasks.InputFiles;
-import org.gradle.api.tasks.OutputDirectory;
-import org.gradle.api.tasks.TaskAction;
-import org.gradle.internal.os.OperatingSystem;
-import org.gradle.workers.WorkAction;
-import org.gradle.workers.WorkParameters;
-import org.gradle.workers.WorkerExecutor;
-
-public class DownloadDependency extends DefaultTask {
-
- public enum Type {
- GOOGLE_STORAGE,
- X20
- }
-
- private final WorkerExecutor workerExecutor;
-
- private Type type;
- private File outputDir;
- private File tarGzFile;
- private File sha1File;
-
- @Inject
- public DownloadDependency(WorkerExecutor workerExecutor) {
- this.workerExecutor = workerExecutor;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-
- public void setDependency(String dependency) {
- outputDir = new File(dependency);
- tarGzFile = new File(dependency + ".tar.gz");
- sha1File = new File(dependency + ".tar.gz.sha1");
- }
-
- @InputFiles
- public Collection<File> getInputFiles() {
- return Arrays.asList(sha1File, tarGzFile);
- }
-
- @OutputDirectory
- public File getOutputDir() {
- return outputDir;
- }
-
- public File getSha1File() {
- return sha1File;
- }
-
- public File getTarGzFile() {
- return tarGzFile;
- }
-
- @TaskAction
- public void execute() throws IOException, InterruptedException {
- if (!sha1File.exists()) {
- throw new RuntimeException("Missing sha1 file: " + sha1File);
- }
-
- // First run will write the tar.gz file, causing the second run to still be out-of-date.
- // Check if the modification time of the tar is newer than the sha in which case we are done.
- // Also, check the contents of the out directory because gradle appears to create it for us...
- if (outputDir.exists()
- && outputDir.isDirectory()
- && outputDir.list().length > 0
- && tarGzFile.exists()
- && sha1File.lastModified() <= tarGzFile.lastModified()) {
- return;
- }
- if (outputDir.exists() && outputDir.isDirectory()) {
- outputDir.delete();
- }
- workerExecutor
- .noIsolation()
- .submit(
- RunDownload.class,
- parameters -> {
- parameters.getType().set(type);
- parameters.getSha1File().set(sha1File);
- });
- }
-
- public interface RunDownloadParameters extends WorkParameters {
- Property<Type> getType();
-
- RegularFileProperty getSha1File();
- }
-
- public abstract static class RunDownload implements WorkAction<RunDownloadParameters> {
-
- @Override
- public void execute() {
- try {
- RunDownloadParameters parameters = getParameters();
- Type type = parameters.getType().get();
- File sha1File = parameters.getSha1File().getAsFile().get();
- if (type == Type.GOOGLE_STORAGE) {
- downloadFromGoogleStorage(sha1File);
- } else if (type == Type.X20) {
- downloadFromX20(sha1File);
- } else {
- throw new RuntimeException("Unexpected or missing dependency type: " + type);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private void downloadFromGoogleStorage(File sha1File) throws IOException, InterruptedException {
- List<String> args = Arrays.asList("-n", "-b", "r8-deps", "-s", "-u", sha1File.toString());
- if (OperatingSystem.current().isWindows()) {
- List<String> command = new ArrayList<>();
- command.add("download_from_google_storage.bat");
- command.addAll(args);
- runProcess(new ProcessBuilder().command(command));
- } else {
- runProcess(
- new ProcessBuilder()
- .command("bash", "-c", "download_from_google_storage " + String.join(" ", args)));
- }
- }
-
- private void downloadFromX20(File sha1File) throws IOException, InterruptedException {
- if (OperatingSystem.current().isWindows()) {
- throw new RuntimeException("Downloading from x20 unsupported on windows");
- }
- runProcess(
- new ProcessBuilder()
- .command("bash", "-c", "tools/download_from_x20.py " + sha1File.toString()));
- }
-
- private static void runProcess(ProcessBuilder builder)
- throws IOException, InterruptedException {
- String command = String.join(" ", builder.command());
- Process p = builder.start();
- int exit = p.waitFor();
- if (exit != 0) {
- throw new IOException(
- "Process failed for "
- + command
- + "\n"
- + new BufferedReader(
- new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8))
- .lines()
- .collect(Collectors.joining("\n")));
- }
- }
- }
-}
diff --git a/buildSrc/src/main/java/utils/Utils.java b/buildSrc/src/main/java/utils/Utils.java
deleted file mode 100644
index 7f09b81..0000000
--- a/buildSrc/src/main/java/utils/Utils.java
+++ /dev/null
@@ -1,34 +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 utils;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-public class Utils {
- public static String toolsDir() {
- String osName = System.getProperty("os.name");
- if (osName.equals("Mac OS X")) {
- return "mac";
- } else if (osName.contains("Windows")) {
- return "windows";
- } else {
- return "linux";
- }
- }
-
- public static boolean isWindows() {
- return toolsDir().equals("windows");
- }
-
- public static Path dxExecutable() {
- String dxExecutableName = isWindows() ? "dx.bat" : "dx";
- return Paths.get("tools", toolsDir(), "dx", "bin", dxExecutableName);
- }
-
- public static Path dexMergerExecutable() {
- String executableName = isWindows() ? "dexmerger.bat" : "dexmerger";
- return Paths.get("tools", toolsDir(), "dx", "bin", executableName);
- }
-}