gradle - Why does Android Studio not run my generateConfig but command line does -
i'm trying generate identical assets each of subprojects in project. since same thing has happen each subproject, i'm trying avoid having add generation code each subproject.
what i've got far is:
// in outer build.gradle allprojects { proj -> gradle.projectsevaluated { def configtemplate = project.file('src/main/templates/configuration.json') def android = proj.getproperties()['android'] if (configtemplate.exists() && android != null) { task generateconfigfiles(type: configuretask) { template configtemplate environments proj.rootproject.file('scripts/environments.json') environmentname host destination new file(project.builddir, 'templates/configuration.json') } android.applicationvariants.all { variant -> variant.mergeassets.dependson generateconfigfiles } } } } // each application build.gradle android { sourcesets { main { assets.srcdir 'build/templates' } } }
this seems work expected when run gradle command line ./gradlew mergeqadebugassets
runs generateconfigfiles
task before running mergeqadebugassets
if attempt run android studio using gradle window, never runs generateconfigfiles
i've gotten work including projectsevaluated
step in each of project build.gradle
files, but, noted, i'm trying avoid code duplication , maintenance headaches brings.
Comments
Post a Comment