简体   繁体   中英

Task in a Multiproject Gradle Project that Depends on Multiple Subproject Gradle Plugin Tasks

I am working on a large build system where I have the following tasks:

:runTests

:moduleA:installDebug
:moduleA:installTest

:moduleB:installDebug
:moduleB:installTest

:moduleA:uninstallAll

:moduleB:uninstallAll

With the project / build structure:

build.gradle
settings.gradle
   |
   - moduleA
        |
        - build.gradle
   |
   - moduleB
        - build.gradle

The uninstallAll and install tasks are created by the Gradle android plugin.

I want :runTests to be an Exec type Gradle task that depends on :moduleA:uninstallAll , :moduleB:uninstallAll , moduleA:installDebug , and moduleA:installTest executed in that order.

I am attempting to configure this by using a subproject closure in the top level build.gradle file to create a single runTests Exec command that then uses dependsOn to specify that the uninstall and install tasks should be completed first.

However, this approach does not seem to work. Either the tasks created by the plugin are not found (even if they are listed with gradlew tasks --all ) or the buildscript runs by the tasks are completely ignored.

What would be the best practice for creating this chain of dependencies?

据我所知,Android插件在游戏后期就创建了任务,因此您可能必须将逻辑包装在gradle.projectsEvaluated { ... }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM