-
Notifications
You must be signed in to change notification settings - Fork 433
/
debug.gradle
46 lines (41 loc) · 1.03 KB
/
debug.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
41
42
43
44
45
46
/**
* This code is only meant for debugging and exploring what is happening when the build runs.
* You should not use it unless you want to understand the internals of anroid build system.
*/
afterEvaluate {
tasks.each {
task ->
task << {
checkNewFiles()
}
println task
}
}
ext.oldlist = new ArrayList<String>()
void checkNewFiles() {
checkNewFiles(true)
}
void checkNewFiles(boolean print) {
List<String> newlist = new ArrayList<>();
readFileTree(file("build"), newlist)
for (String path : newlist) {
if (print && !oldlist.contains(path)) {
println "=== ADD: " + path
}
}
for (String path : oldlist) {
if (!newlist.contains(path)) {
println "=== SUB: " + path
}
}
oldlist.clear();
oldlist.addAll(newlist)
}
void readFileTree(File d, List l) {
for (File f : d.listFiles()) {
l.add(f.absolutePath)
if (f.isDirectory()) {
readFileTree(f, l)
}
}
}