Fail Gradle Copy task if source directory not exist

I'm using Gradle to create a build script. I want to protect the script from wrong properties, one of the tasks in the script is simple Copy task and I notice that when I put non-exist directory as from parameter the task continue with Skipping task ':copySpecificPlatform' as it has no source files.

Is there a way to cause the copy task to fail in this case?

Answers


You can try:

task cp(type: Copy) {
    from 'empty'
    into 'target'
    inputs.sourceFiles.stopExecutionIfEmpty()
}

Every Task has its TaskInputs which source files are a FileCollection that has special method which configures the desired behavior.


Need Your Help

How does a XAML attribute bind to a INotifyPropertyChanged object

c# silverlight xaml

have a class that implements the INotifyPropertyChanged interface like this:

How to properly save images on device; just for displaying them inside my App later

ios objective-c uiimage storage

the user of my App is taking about 8 pictures a day. These pictures get saved on the device and should only be viewed inside my app i. e. not in "Photos". The photos should be viewed in something l...