Skip to content

Commit 00405ad

Browse files
Fix include.gradle file generation
When `include.gradle` file is generated, there's a check if the App_Resources directory has been already parsed. If there's AndroidManifest.xml in the app/App_Resources/Android the global variable appResExists is set to true. All subsequent plugins will not be added to pluginNames and so will not be added to include.gradle. For example in case you add AndroidManifest.xml in app/App_Resources and add nativescript-barcodescanner plugin, this is the generated include.gradle on Linux: ``` android { flavorDimensions "NativescriptAppResources", } ``` This way the build fails. The reason is that on Linux the file listing is different and App_Resources dir is processed before nativescript-barcodescanner. The same project will work on Windows, but it is not guarantee that other projects will not fail in the same case. In order to fix the issue, I've intorduced a new variable in the body of createDefaultIncludeFiles's iteration over files. It is set to false on each iterration, so if the current dir is not App_Resources, the plugin will be added to `pluginNames`. I've kept the code for setting `appResExists` as it is used on other places in the build.gradle.
1 parent edbddfa commit 00405ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

build/project-template-gradle/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ task createDefaultIncludeFiles {
222222
def dimensionName = sanatizeDimensionName(fileName)
223223
createPluginConfigFile = true
224224
def foundIncludeFile = false
225-
225+
def isAppResDir = false
226226
if(fileName == appResourcesName) {
227227
appResExists = true
228+
isAppResDir = true
228229
}
229230

230231
println "\t+found plugins: " + fileName
@@ -236,7 +237,7 @@ task createDefaultIncludeFiles {
236237
}
237238
}
238239

239-
if(!appResExists) {
240+
if(!isAppResDir) {
240241
pluginNames.add('"' + dimensionName + '"')
241242
}
242243

0 commit comments

Comments
 (0)