Fix include.gradle file generation #294
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.