All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.autonomousapps.tasks.AndroidClassesTask.kt Maven / Gradle / Ivy

There is a newer version: 2.6.1
Show newest version
// 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