Gradle - Make existing android project a child of other project and run "gradlew tasks" -


part 1.

i have existing android project built gradle.

settings.gradle looks this:

include ':android', ':androidtest', ':androidtestapp' 

build.gradle looks this:

buildscript {     repositories {         mavencentral()     }      dependencies {         classpath 'com.android.tools.build:gradle:1.2.3'     } }  task wrapper(type: wrapper) {     gradleversion = '2.4' }  task customclean(dependson: [':android:clean', ':androidtest:clean', ':androidtestapp:clean']) {  }  allprojects {     repositories {         mavencentral()         mavenlocal()     } } 

what need create project parent of android project , runs android project tasks. add settings.gradle of new root project include 'android-sdk:android'which need now. , works fine, can run tasks of android project gradlew androidbuild:

task androidbuild(dependson: 'android-sdk:android:assemble') << {     group unitysdkgroupname } 

problems arise when run gradlew tasks on new root projects.

caused by: org.gradle.api.unknowntaskexception: task path ':android:clean' not found in project ':android-sdk'. 

i know can fix removing colons this, want somehow make tasks command work without changing android project if possible.

    task customclean(dependson: ['android:clean', 'androidtest:clean', 'androidtestapp:clean']) {  } 

part 2.

when add settings.gradle of root project other nested projects

include 'android-sdk:androidtest' include 'android-sdk:androidtestapp' 

i errors here in dependencies sections of child projects dependent on android module (this androidtest module):

dependencies {     compile project(path: ":android")     compile 'com.google.android.gms:play-services:7.3.0' } 

and getting when refresh projects (again seems relative paths issue):

error:(30, 0) project path ':android' not found in project ':android-sdk:androidtest'. 

so question is - can make gradlew tasks command work without modifying underlying android project , how can done elegant way?

unfortunately: no. nested multiproject builds not possible. should add yet, although intention support them has been shown, there absolutely no indication of when feature can expected.

see https://discuss.gradle.org/t/nested-multimodule-builds-with-a-flat-directory-layout/7509/13

i not find feature request @ https://discuss.gradle.org/c/bugs


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -