com.autonomousapps.tasks.MergeProjectGraphsTask.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dependency-analysis-gradle-plugin Show documentation
Show all versions of dependency-analysis-gradle-plugin Show documentation
Analyzes dependency usage in Android and JVM projects
package com.autonomousapps.tasks
import com.autonomousapps.internal.graph.plus
import com.autonomousapps.internal.utils.GraphAdapter.GraphContainer
import com.autonomousapps.internal.utils.bufferWriteJson
import com.autonomousapps.internal.utils.fromJson
import com.autonomousapps.internal.utils.getAndDelete
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFile
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.*
abstract class MergeProjectGraphsTask : DefaultTask() {
init {
description = "Merges the project graphs of all variants into a single graph"
}
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:InputFiles
abstract val projectGraphs: ListProperty
@get:OutputFile
abstract val output: RegularFileProperty
@TaskAction fun action() {
val output = output.getAndDelete()
val graph = projectGraphs.get()
.map { it.fromJson().graph }
.reduce { acc, graph -> acc + graph }
output.bufferWriteJson(GraphContainer(graph))
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy