java - How to access collection of source directories of all included build in composite build of Gradle?
问题描述
I have a gradle project with composite build. I have to get the source files collection to use in jacoco instrumentation. Is there any to get the source directories of all included builds.
settings.gradle
rootProject.name = 'my-composite'
includeBuild 'my-app'
includeBuild 'my-utils'
I am currently using files method to get the collection in build.gradle
project.ext.files1 =
fileTree("C:/my-composite/my-app/src").matching {
include '*.java'
}
project.ext.files2 =
fileTree("C:/my-composite/my-utils/src").matching {
include '*.java'
}
project.ext.allFiles = project.ext.files1.plus(project.ext.files2)
can we generate the source list dynamically using gradle.includedBuild('my-app')? (or) Is there any way to use a task to return source directory of each inculdede build? or is there any other way to do it?
解决方案
应该能够做到:
fileTree(gradle.includedBuild("my-app").projectDir.resolve("src")).matching {
include("*.java")
}
推荐阅读
- amazon-web-services - AWS S3 存储桶 - 子页面上的访问被拒绝
- graph-theory - 您可以按权重对加权有向图进行拓扑排序吗?
- architecture - 视频流媒体平台设计草图
- svg - Visio 导入 SVG 自定义形状数据
- c# - 错误 RSA 在 C# 中加密和在 Go 中解密
- acumatica - 销售价格维护...如何应用网格级别用户定义的过滤器进行选择
- java - Oracle 表或视图不存在
- python - 在序列化程序中创建和返回令牌
- ssis - 如何使用 SSIS 从 2 个数据库中获取数据并将其移动到数据仓库?
- c++ - 使用选择排序按最小数字排序