Added handy spec
I will need this soon.
@@ -3,6 +3,8 @@ package org.mockito.release.internal.gradle.util;
import org.gradle.api.Task;
import org.gradle.api.specs.Spec;
+import java.io.File;
+
/**
* Helper methods for Gradle Spec objects
*/
@@ -19,4 +21,16 @@ public class Specs {
}
};
}
+
+ /**
+ * Spec that checks if file exists using {@link File#isFile()} method.
+ */
+ public static Spec<Task> fileExists(final File file) {
+ return new Spec<Task>() {
+ @Override
+ public boolean isSatisfiedBy(Task task) {
+ return file.isFile();
+ }
+ };
+ }
}
