@@ -146,31 +146,36 @@ task deletePrevConfig (type: Delete) {
146146
147147// creates product flavor config file
148148task setFlavorsBeforePluginExtend {
149- def dirTree = file(configurationsDir). listFiles()
150-
151- List<String > pluginNames = new ArrayList<String > ()
152- dirTree. each { f ->
153- if (f. isDirectory()) {
154- println " adding plugin: " + f. getName()
155- pluginNames. add(' "' + f. getName() + ' "' )
149+ def configDir = file(configurationsDir)
150+ if (configDir. exists()) {
151+ def dirTree = configDir. listFiles()
152+ List<String > pluginNames = new ArrayList<String > ()
153+ dirTree. each { f ->
154+ if (f. isDirectory()) {
155+ println " adding plugin: " + f. getName()
156+ pluginNames. add(' "' + f. getName() + ' "' )
157+ }
156158 }
159+ def flavors = pluginNames. join(" ," )
160+
161+ println " creating product flavors include.gradle file in $configurationsDir folder..."
162+ def flavorsFile = new File (" $configurationsDir /include.gradle" )
163+ flavorsFile. write " "
164+ flavorsFile << " android { \n "
165+ flavorsFile << " \t flavorDimensions " + flavors + " \n "
166+ flavorsFile << " }\n "
157167 }
158- def flavors = pluginNames. join(" ," )
159-
160- println " creating product flavors include.gradle file in $configurationsDir folder..."
161- def flavorsFile = new File (" $configurationsDir /include.gradle" )
162- flavorsFile. write " "
163- flavorsFile << " android { \n "
164- flavorsFile << " \t flavorDimensions " + flavors + " \n "
165- flavorsFile << " }\n "
166168}
167169
168170// applies additional configuration
169171task pluginExtend {
170- new File (" configurations" ). eachFileRecurse(groovy.io.FileType . FILES ) {
171- if (it. name. equals(' include.gradle' )) {
172- println " including plugin name: " + it
173- apply from : it
172+ def configDir = file(configurationsDir)
173+ if (configDir. exists()) {
174+ configDir. eachFileRecurse(groovy.io.FileType . FILES ) {
175+ if (it. name. equals(' include.gradle' )) {
176+ println " including plugin name: " + it
177+ apply from : it
178+ }
174179 }
175180 }
176181}
0 commit comments