hch
2024-12-19 cd44b34dc762e8b06269dc4cfaba2ae32aaf7fc7
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
//加载本集配置properties文件
def loadProperties(String name) {
    Properties properties = new Properties()
    InputStream inputStream = project.rootProject.file("${name}.properties").newDataInputStream()
    properties.load(inputStream)
    return properties
}
//递归读取该目录下的文件
def getAllFiles(ArrayList<File> list, String path) {
    list.clear()
    File file = file(path)
    if (file.isFile()) {
        list.add(file)
        return list
    }
    def files = file.listFiles()
    files.each {
        if (it.isDirectory())
            getAllFiles(list,it.getAbsolutePath())
        else
            list.add(it)
        print "\n"
    }
    return list
}
 
ext {
    getAllFiles = this.&getAllFiles
    loadProperties = this.&loadProperties
}