public class Main
extends java.lang.Object
implements org.gradle.api.Plugin<org.gradle.api.Project>
| Constructor and Description |
|---|
Main() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(org.gradle.api.Project project)
Applies the plugin to the given Gradle project.
|
java.io.File |
downloadFile(Logger logger,
java.lang.String fileURL)
Downloads a file from the specified URL and saves it to a unique file location.
|
void |
downloadFile(Logger logger,
java.lang.String url,
java.io.File file)
Downloads a file from a specified URL and saves it to a local file.
|
java.io.File |
getUrlFile(java.lang.String url)
Generates a File object representing a unique file path for a given URL.
|
void |
processActions(Logger logger,
org.gradle.api.Project project,
UsesExtension extension)
Processes the URLs specified in the given extension and updates or downloads the corresponding files.
|
void |
processPreset(Logger logger,
org.gradle.api.Project project,
UsesExtension extension,
java.lang.String url)
Processes a preset file specified by the given URL.
|
void |
processPresets(Logger logger,
org.gradle.api.Project project,
UsesExtension extension)
Processes the presets specified in the given extension and updates or downloads the corresponding files.
|
boolean |
shouldDownloadFile(java.io.File file,
UsesExtension extension,
Logger logger)
Determines whether a file should be downloaded based on its existence, update delay, and auto-update settings.
|
public void apply(org.gradle.api.Project project)
apply in interface org.gradle.api.Plugin<org.gradle.api.Project>project - the Gradle project to which the plugin is applied. This project will be configured with
tasks to list and process online Gradle files.public void processActions(Logger logger, org.gradle.api.Project project, UsesExtension extension)
logger - the logger used to log messages during the processproject - the Gradle project to which the plugin is appliedextension - the extension containing the configuration, including the list of URLs to processpublic boolean shouldDownloadFile(java.io.File file,
UsesExtension extension,
Logger logger)
file - The file to be checked for download.extension - The extension containing the configuration, including auto-update settings and update delay.logger - The logger used to log messages during the process.true if the file should be downloaded, false otherwise.
If the file does not exist, it will be downloaded.
If auto-update is enabled and the update delay is greater than 0,
the file will be downloaded if the difference between its creation time and the current time is greater than or equal to the update delay.
If auto-update is enabled and the update delay is 0, the file will always be downloaded.
If auto-update is disabled, the file will always be downloaded.public void processPresets(Logger logger, org.gradle.api.Project project, UsesExtension extension)
logger - the logger used to log messages during the processproject - the Gradle project to which the plugin is appliedextension - the extension containing the configuration, including the list of presets to processpublic void processPreset(Logger logger, org.gradle.api.Project project, UsesExtension extension, java.lang.String url)
logger - The logger used to log messages during the process.project - The Gradle project to which the preset is applied.extension - The extension containing the configuration, including auto-update settings and update delay.url - The URL of the preset file to be processed.public java.io.File getUrlFile(java.lang.String url)
url - The URL string for which to generate a unique file path.java.lang.RuntimeException - If the Gradle home directory cannot be created.public java.io.File downloadFile(Logger logger, java.lang.String fileURL)
logger - The Logger object used for logging messages during the download process.fileURL - The URL of the file to be downloaded.java.lang.RuntimeException - If there's an error during the download process.public void downloadFile(Logger logger, java.lang.String url, java.io.File file)
logger - The Logger object used for logging the download status.url - The URL of the file to be downloaded as a String.file - The File object representing the local file where the downloaded content will be saved.java.lang.RuntimeException - If the existing file cannot be deleted, if there's an IO error during download,
or if the file cannot be downloaded and doesn't exist locally.