首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用compileDebugSources和compileDebugTestSources的Gradle dependsOn订单的Android Jacoco测试

问使用compileDebugSources和compileDebugTestSources的Gradle dependsOn订单的Android Jacoco测试
EN

Stack Overflow用户
提问于 2015-01-08 07:43:24
回答 1查看 1.3K关注 0票数 1

其他地方,如This Other Question,将有一个依赖于testDebug的jacocoTestReport任务。这是可行的。

代码语言:javascript
复制
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
    ...
}

然而,在我的例子中,除了testDebug之外,我还需要依赖android任务compileDebugSources和compileDebugTestSources。所以我希望下面的方法能行得通

代码语言:javascript
复制
task jacocoTestReport(type: JacocoReport, dependsOn: ["compileDebugSources", "compileDebugTestSources", "testDebug"]) {
    ...
}

但是,当我使用dependsOn属性或方法时,这些依赖项的顺序并不像Gradle所说的那样得到保证。因此,我想在任务之外做一些类似以下的事情

代码语言:javascript
复制
 testDebug.mustRunAfter compileDebugSources
 testDebug.mustRunAfter compileDebugTestSources

但我在上面的代码中遇到了一个编译问题,即testDebug、compileDebugSources或compileDebugTestSources被标记为“找不到项目上的属性app:

我想知道我需要做什么才能在gradle中为我现有的jacocoTestReport任务添加这些任务的顺序。

EN

回答 1

Stack Overflow用户

发布于 2015-02-16 21:05:30

试试这个:

代码语言:javascript
复制
task jacocoTestReport(type: JacocoReport, dependsOn: ["compileDebugSources", "compileDebugTestSources", "testDebug"]) { ... }
tasks.testDebug.dependsOn(compileDebugTestSources)
tasks.compileDebugTestSources.dependsOn(compileDebugSources)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27830696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档