Skip to content

Commit 3274e73

Browse files
author
plamen5kov
committed
fixed small bug when there are no plugins
1 parent cee8cac commit 3274e73

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

build/project-template-gradle/build.gradle

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def createPluginConfigFile = false
3838
def configStage = "\n:config phase: "
3939
def nodeModulesDir = "../../node_modules/"
4040
def pluginNames = new ArrayList<String>()
41+
def configDir = file(configurationsDir)
4142

4243
def compiteCompileSdkVersion () {
4344
if(project.hasProperty("compileSdk")) {
@@ -211,36 +212,36 @@ task createDefaultIncludeFiles {
211212

212213
task 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 << "\tflavorDimensions " + 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 << "\tflavorDimensions " + flavors + "\n"
228+
flavorsFile << "}\n"
229+
}
226230
}
227231
}
228232

229233
task 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

Comments
 (0)