forked from liferay/liferay-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.gradle
40 lines (26 loc) · 745 Bytes
/
util.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
apply plugin: UtilPlugin
class UtilPlugin implements Plugin<Project> {
void apply(Project project) {
project.convention.plugins.util = new UtilPluginConvention(project)
}
}
class UtilPluginConvention {
UtilPluginConvention(Project project) {
_project = project
}
boolean exists(String fileName) {
File file = _project.file(fileName)
file.exists()
}
void mkdirs(String dirName) {
File file = _project.file(dirName)
file.mkdirs()
}
void move(String sourceFileName, String destinationFileName) {
File sourceFile = _project.file(sourceFileName)
File destinationFile = _project.file(destinationFileName)
mkdirs(destinationFile.parent)
sourceFile.renameTo(destinationFileName)
}
private Project _project
}