From aa95efcd4498e9f66983393243d2d871244780e9 Mon Sep 17 00:00:00 2001 From: alwx Date: Tue, 4 Apr 2023 15:27:26 +0200 Subject: [PATCH] Updates --- android/build.gradle | 3 +- .../src/main/java/im/status/DepReport.groovy | 44 ------------------- .../java/im/status/DependencyListTask.java | 28 ++++++++++++ 3 files changed, 30 insertions(+), 45 deletions(-) delete mode 100644 android/buildSrc/src/main/java/im/status/DepReport.groovy create mode 100644 android/buildSrc/src/main/java/im/status/DependencyListTask.java diff --git a/android/build.gradle b/android/build.gradle index 8e8398416ce..c133a8e0a2d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,4 +1,5 @@ import java.util.stream.Collectors +import im.status.DependencyListTask // Top-level build file where you can add configuration options common to all sub-projects/modules. @@ -38,7 +39,7 @@ buildscript { } subprojects { - task allDeps(type: DependencyReportTask) {} + task allDeps(type: DependencyListTask) { } afterEvaluate { if (project.hasProperty("android")) { diff --git a/android/buildSrc/src/main/java/im/status/DepReport.groovy b/android/buildSrc/src/main/java/im/status/DepReport.groovy deleted file mode 100644 index 3f9e5f9aa32..00000000000 --- a/android/buildSrc/src/main/java/im/status/DepReport.groovy +++ /dev/null @@ -1,44 +0,0 @@ -package im.status - -import com.android.build.gradle.internal.AndroidAsciiReportRenderer; -import com.android.build.gradle.internal.variant.BaseVariantData; -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; -import org.gradle.logging.StyledTextOutputFactory; - -public class DepReport extends DefaultTask { - private AndroidAsciiReportRenderer renderer = new AndroidAsciiReportRenderer(); - private Set variants = []; - @TaskAction - public void generate() throws IOException { - renderer.setOutput(getServices().get(StyledTextOutputFactory.class).create(getClass())); - SortedSet sortedConfigurations = new TreeSet( - new Comparator() { - public int compare(BaseVariantData conf1, BaseVariantData conf2) { - return conf1.getName().compareTo(conf2.getName()); - } - }); - sortedConfigurations.addAll(getVariants()); - for (BaseVariantData variant : sortedConfigurations) { - renderer.startVariant(variant); - renderer.render(variant); - } - } - /** - * Returns the configurations to generate the report for. Default to all configurations of - * this task's containing project. - * - * @return the configurations. - */ - public Set getVariants() { - return variants; - } - /** - * Sets the configurations to generate the report for. - * - * @param configurations The configuration. Must not be null. - */ - public void setVariants(Collection variants) { - this.variants.addAll(variants); - } -} \ No newline at end of file diff --git a/android/buildSrc/src/main/java/im/status/DependencyListTask.java b/android/buildSrc/src/main/java/im/status/DependencyListTask.java new file mode 100644 index 00000000000..01f6028e2cd --- /dev/null +++ b/android/buildSrc/src/main/java/im/status/DependencyListTask.java @@ -0,0 +1,28 @@ +package im.status; + +import org.gradle.api.artifacts.ConfigurationContainer; +import org.gradle.api.tasks.diagnostics.AbstractDependencyReportTask; + +import org.gradle.api.tasks.TaskAction; +import org.gradle.api.tasks.diagnostics.internal.DependencyReportRenderer; +import org.gradle.api.tasks.diagnostics.internal.ReportRenderer; +import org.gradle.api.tasks.diagnostics.internal.dependencies.AsciiDependencyReportRenderer; + +//https://github.com/gradle/gradle/tree/master/subprojects/diagnostics/src/main/java/org/gradle/api/tasks/diagnostics/internal + +/** + * Displays the dependency tree for a project. An instance of this type is used when you + * execute the {@code dependencies} task from the command-line. + */ +public abstract class DependencyListTask extends AbstractDependencyReportTask { + + @Override + public ConfigurationContainer getTaskConfigurations() { + return getProject().getConfigurations(); + } + + @TaskAction + void action() { + + } +} \ No newline at end of file