@@ -38,6 +38,7 @@ def createPluginConfigFile = false
3838def configStage = " \n :config phase: "
3939def nodeModulesDir = " ../../node_modules/"
4040def pluginNames = new ArrayList<String > ()
41+ def configDir = file(configurationsDir)
4142
4243def compiteCompileSdkVersion () {
4344 if (project. hasProperty(" compileSdk" )) {
@@ -211,36 +212,36 @@ task createDefaultIncludeFiles {
211212
212213task createPluginsConfigFile {
213214 description " creates product flavor config file based on what plugins are added"
214- println " $configStage createPluginsConfigFile"
215215
216- def flavorsFile = new File (" $configurationsDir /include.gradle" )
217- flavorsFile. write " " // clear config file
218-
219- if (createPluginConfigFile) {
220- println " \t +creating product flavors include.gradle file in $configurationsDir folder..."
221- def flavors = pluginNames. join(" ," )
222- println " \t +found plugins: " + flavors
223- flavorsFile << " android { \n "
224- flavorsFile << " \t flavorDimensions " + flavors + " \n "
225- flavorsFile << " }\n "
216+ if (configDir. exists()) {
217+ println " $configStage createPluginsConfigFile"
218+
219+ def flavorsFile = new File (" $configurationsDir /include.gradle" )
220+ flavorsFile. write " " // clear config file
221+
222+ if (createPluginConfigFile) {
223+ println " \t +creating product flavors include.gradle file in $configurationsDir folder..."
224+ def flavors = pluginNames. join(" ," )
225+ println " \t +found plugins: " + flavors
226+ flavorsFile << " android { \n "
227+ flavorsFile << " \t flavorDimensions " + flavors + " \n "
228+ flavorsFile << " }\n "
229+ }
226230 }
227231}
228232
229233task pluginExtend {
230234 description " applies additional configuration"
231- println " $configStage pluginExtend"
232- def configDir = file(configurationsDir)
235+
233236 if (configDir. exists()) {
237+ println " $configStage pluginExtend"
234238 configDir. eachFileRecurse(groovy.io.FileType . FILES ) {
235239 if (it. name. equals(' include.gradle' )) {
236240 println " \t +applying configuration from: " + it
237241 apply from : it
238242 }
239243 }
240244 }
241- else {
242- println " \t +ERROR: there is no configurations dir"
243- }
244245}
245246
246247// // doesn't work unless task is explicitly called (TODO: research configurations hook)
0 commit comments