common-plugin / com.cognifide.gradle.common.file.resolver / Resolver

Resolver

abstract class Resolver<G : FileGroup>

File downloader with groups supporting files from multiple sources: local and remote (SFTP, SMB, HTTP).

Constructors

<init>

File downloader with groups supporting files from multiple sources: local and remote (SFTP, SMB, HTTP).

Resolver(common: CommonExtension)

Properties

common

val common: CommonExtension

downloadDir

val downloadDir: DirectoryProperty!

files

val files: List<File>

groups

val groups: List<G>

localFilePatterns

Files respected when searching for recent local files.

val localFilePatterns: ListProperty<String!>!

parallelLevel

Controls count of groups resolved in parallel.

val parallelLevel: Property<Int!>!

Functions

config

Customize configuration for particular file group.

fun config(configurer: G.() -> Unit): Unit

createGroup

abstract fun createGroup(name: String): G

download

Download files from same URL using automatically determined file transfer (HTTP, SFTP, SMB, URL, local file system).

fun download(urlDir: String, vararg fileNames: String): List<FileResolution>
fun download(urlDir: String, fileNames: Iterable<String>): List<FileResolution>

Download file using automatically determined file transfer (HTTP, SFTP, SMB, URL, local file system).

fun download(url: String): FileResolution

downloadHttp

Download file using HTTP file transfer with custom settings (like basic auth credentials).

fun downloadHttp(url: String, options: HttpFileTransfer.() -> Unit): FileResolution

downloadSftp

Download file using SFTP file transfer with custom settings (different credentials).

fun downloadSftp(url: String, options: SftpFileTransfer.() -> Unit): FileResolution

downloadSmb

Download file using SMB file transfer with custom settings (different credentials, domain).

fun downloadSmb(url: String, options: SmbFileTransfer.() -> Unit): FileResolution

get

Resolve file in case of various type of specified value: file, url to file, dependency notation, project dependency.

fun get(value: Any): FileResolution

getAll

Resolve files in case of various type of specified value: file, url to file, dependency notation, project dependency.

fun getAll(vararg values: Any): Unit
fun getAll(values: Iterable<Any>): Unit

group

fun group(name: String): G
fun group(name: String, configurer: Resolver<G>.() -> Unit): Unit

Shorthand for creating named group with single file only to be downloaded.

fun group(name: String, downloadUrl: String): Unit

groupFiles

fun groupFiles(name: String): List<File>

invoke

operator fun String.invoke(groupDefiner: Resolver<G>.() -> Unit): Unit
operator fun String.invoke(vararg values: Any, groupOptions: G.() -> Unit = {}): Unit
operator fun String.invoke(values: Iterable<Any>, groupOptions: G.() -> Unit = {}): Unit

resolve

Resolve file by dependency notation using defined Gradle repositories (Maven, Ivy etc).

fun resolve(dependencyNotation: Any): FileResolution

resolveGroups

fun resolveGroups(groupName: String): List<G>

useLocal

Use local file directly (without copying).

fun useLocal(path: String): FileResolution
fun useLocal(sourceFile: File): FileResolution

useLocalBy

Use local file from directory or file when not found any.

fun useLocalBy(dir: Any, filePatterns: Iterable<String>, selector: Iterable<File>.() -> File?): FileResolution?
fun useLocalBy(dir: Any, selector: Iterable<File>.() -> File?): FileResolution?

useLocalLastModified

Use last modified local file located in directory or fail when not found any.

fun useLocalLastModified(dir: Any): FileResolution?

useLocalLastNamed

Use local file with name being highest version located in directory or fail when not found any. Highest version is determined by descending alphanumeric sorting.

fun useLocalLastNamed(dir: Any): FileResolution?

useLocalRecent

Use last modified local file located in directory or fail when not found any.

fun useLocalRecent(dir: Any): FileResolution?

Companion Object Properties

DOWNLOAD_DIR_DEFAULT

const val DOWNLOAD_DIR_DEFAULT: String

GROUP_DEFAULT

const val GROUP_DEFAULT: String

Inheritors

FileResolver

open class FileResolver : Resolver<FileGroup>