Skip to content

Plugin include.gradle loses flavor properties #480

@ddfreiling

Description

@ddfreiling

Overview of the issue:
When a nativescript plugin has an include.gradle file for Android, it seems to lose all the properties set within the android {} tags. Only the dependencies {} seems to be kept. Previously before version 2.0.0 this did not occur, and I used it to build my app for a specific android architecture. Primarily to speed up my development process when using libVLC for android through a plugin.

Motivation for or use case:
I want to specify the android architecture to build using ndk { abiFilters } from my plugin, since this is not currently possible through the CLI. See NativeScript/nativescript-cli#1392.

Telerik NativeScript version(s): CLI 2.0.1, android-runtime 2.0.0

Steps to reproduce:
Make a plugin with the following platforms/android/include.gradle file:

android {
    productFlavors {
        "nativescript-plugin-name" {
            dimension "nativescript-plugin-name"

            // Setting below requires 'android.useDeprecatedNdk=true' in gradle.properties
            ndk {
                abiFilters 'armeabi-v7a'
            }
        }
    }
}
dependencies {
    compile 'de.mrmaffen:vlc-android-sdk:1.9.8'
}

Now add it to an app and build it. In the platforms/android/configurations folder will now be the processed version of the above include.gradle file, which looks like this:

android {
    productFlavors {
              "F0" {
                dimension "nativescriptpluginname"
              }
            }
}
dependencies {
    compile 'de.mrmaffen:vlc-android-sdk:1.9.8'
}

Properties lost and it will no longer build to a specific architecture.

Suggest a fix:
In the generated build.gradle file for the android platform it seems that the function replaceProductFlavorInContent is reponsible for stripping out any properties within the android {} tags. Is it meant to be like this or is it a bug? I don't know what the intent of this is.

Preferrably I'd like to be able to set the build architecture through the CLI, but for now setting it through an include.gradle file would be nice.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions