I met this construction apply from: - to: in one Gradle build and I do not understand what it does
task ("someName", type: someType) { task ->
def path = "src/main/tran/${transformType}.groovy"
def global = "$rootDir/$path"
apply from: global, to: task
}
If this something Groovysh or it is entirely Gradle concept?
apply(from = "other.gradle.kts") Script plugins are automatically resolved and can be applied from a script on the local filesystem or at a remote location. Filesystem locations are relative to the project directory, while remote script locations are specified with an HTTP URL.
The buildscript is for the build.gradle file itself. So, this would contain dependencies for say creating RPMs, Dockerfile , and any other dependencies for running the tasks in all the dependent build.gradle.
To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … e.g. gradlew clean allTests.
apply
is a Gradle concept. apply from:
applies the given script to the current project. In other words, simple names occurring in the script (e.g. path
) will be resolved using the project
object. To give an example, applying a script containing println path
will print project.path
.
apply from:, to:
applies the given script to the object specified by to:
. To give an example, applying a script containing println path
to task
will print task.path
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With