-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexport-deps.gradle
More file actions
37 lines (33 loc) · 1.07 KB
/
export-deps.gradle
File metadata and controls
37 lines (33 loc) · 1.07 KB
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
// export-deps.gradle
task exportAllLibs {
doLast {
def exportDir = file("${buildDir}/exported-libs")
exportDir.mkdirs()
// 收集所有可解析配置的依赖
def allFiles = []
configurations.each { config ->
if (config.canBeResolved) {
allFiles.addAll(config.files)
}
}
// 去重并复制
allFiles.unique().each { libFile ->
copy {
from libFile
into exportDir
}
println "已导出: ${libFile.name}"
}
println "\n======================================"
println "共导出 ${allFiles.unique().size()} 个依赖库"
println "导出目录: ${exportDir.absolutePath}"
println "======================================"
// 生成列表文件
def listFile = new File(exportDir, "libraries-list.txt")
listFile.withWriter { writer ->
allFiles.unique().sort().each { file ->
writer.println("${file.name}")
}
}
}
}