-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
30 lines (28 loc) · 1.03 KB
/
build.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
task indexResources {
ext.index = { dir ->
File[] fileList = dir.listFiles()
ArrayList<String> files = new ArrayList<>()
for (int i = 0; i < fileList.length; i++) {
if (fileList[i].isDirectory()) {
ext.index(fileList[i])
} else if (fileList[i].getName() == "files.txt") {
fileList[i].delete()
} else if (fileList[i].getName().substring(fileList[i].getName().lastIndexOf(".") +
1) != "lsd") {
files.add(fileList[i].getName())
}
}
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(dir.toString()
+ "/files.lsd")))
for (int i = 0; i < files.size(); i++) {
writer.write(files.get(i))
if (i < files.size() - 1) {
writer.newLine()
}
}
writer.close()
}
File root = new File(projectDir.toString() + "/src/main/resources/")
ext.index(root)
}
compileJava.dependsOn indexResources