com.autonomousapps.tasks.AndroidClassesTask.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
// Copyright (c) 2024. Tony Robalik.
// SPDX-License-Identifier: Apache-2.0
package com.autonomousapps.tasks
import com.autonomousapps.internal.utils.filterToClassFiles
import org.gradle.api.DefaultTask
import org.gradle.api.file.Directory
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import java.io.File
/**
* Encodes the AGP contract for accessing artifacts from the current project, in this case class files.
*
* @see Scoped Artifacts
* @see [com.autonomousapps.internal.analyzer.AndroidSources]
*/
abstract class AndroidClassesTask : DefaultTask() {
/** Will be empty for this task. */
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:InputFiles
abstract val jars: ListProperty
/** May be empty. */
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:InputFiles
abstract val dirs: ListProperty
/** Must be called during the execution phase. */
protected fun androidClassFiles(): List {
return dirs.getOrElse(emptyList()).flatMap { it.asFileTree.files }.filterToClassFiles()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy