Настроить строгий порядок выполнения задачи Gradle с помощью проектов / модулей - PullRequest
0 голосов
/ 09 января 2019

У меня есть следующая структура dir

myproj/
   - build.gradle
   - settings.gradle
subproj1/
   - build.gradle
subproj2/
   - build.gradle

Когда я выполню

gradle customTask

Я хочу, чтобы моя customTask выполнялась полностью внутри subproj2, а затем синхронно после завершалась в subproj2 , чтобы двигаться дальше и выполнять пользовательскую задачу внутри subproj1

Моя текущая конфигурация (я пытался определить subproj2 как зависимость от subproj1):

myproj - settings.gradle

rootProject.name = 'wowsuchwowproject'    
include ':subproj1', ':subproj2'

myproj - build.gradle

project(":subproj1") {

}

project(":subproj2") {

}

subproj1 - build.gradle

dependencies {
    api project(":subproj2")
}

task("customTask") {
    ...
}

subproj2 - build.gradle

task("customTask") {
    ...
}

Но я получаю эту ошибку; что мне не хватает?

* What went wrong:
Could not determine the dependencies of task ':subproj1:mergeReleaseResources'.
> Could not resolve all task dependencies for configuration ':subproj1:releaseRuntimeClasspath'.
   > Could not resolve project :subproj2.
     Required by:
         project :subproj1
      > Unable to find a matching configuration of project :subproj2: None of the consumable configurations have attributes.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

ОБНОВЛЕНИЕ 10/01/2019: добавлена ​​информация о плагине

Это другие вещи, которые у меня есть в корне build.gradle

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

Во всех остальных у меня есть

apply plugin: com.myown.plugin.AwesomePlugin
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...