NativeScript / NativeScript/nativescript-cli
Plugin's include.gradle is not properly respected when building aar
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.1k
- Forks
- 204
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 8
Descripción
Tell us about the problem
Currently {N} CLI detects if a plugin has any Android resources/java files/etc. and tries to build an android archive (.aar) for said plugin. During building of this .aar file CLI takes into account the plugin's include.gradle file, if it exists, however the logic for this is incomplete. Instead of only taking into account certain tags (like dependencies or repositories), it seems more appropriate that the whole include.gradle be included in the process of building the plugin's .aar file.
In other words instead of any additional parsing CLI should only include a
apply from: <path-to-plugin-include.gradle-file>
section in the plugin's build.gradle.
Which platform(s) does your issue occur on?
Android
Please tell us how to recreate the issue in as much detail as possible.
- tns create myApp
- cd myApp
- tns plugin add nativescript-mapbox
- edit
node_modules/nativescript-mapbox/platforms/android/include.gradleso that the contents become:
android {
productFlavors {
"mapbox" {
dimension "mapbox"
}
}
}
repositories {
mavenCentral()
}
def coreLibrary = 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.3.1@aar'
def serviceLibrary = 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.9@aar'
def pluginsString = 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.3.0'
// see https://www.mapbox.com/android-sdk/
dependencies {
// core library
compile ("$coreLibrary"){
transitive=true
}
// service library
compile ("$serviceLibrary"){
transitive=true
}
// plugins
compile "$pluginsString"
}
- Try to execute
tns build android
CLI fails to build the .aar file in this case, because the dependencies section is copied, however it is in its essence incomplete.
This is only a dummy example to illustrate the flaw in the CLI logic. The content of the include.gradle may contain more complex logic, which needs to be taken into account.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Lee lib/services/android-plugin-build-service.ts alrededor de las líneas 232-239 y, después, reproduce el problema con el ejemplo de nativescript-mapbox para include.gradle y tns build android. Rastrea cómo se incorpora include.gradle en la compilación del plugin; se considera completado cuando se aplica el archivo completo durante la construcción de .aar, en lugar de copiarse solo secciones seleccionadas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- android, groovy, javascript
- Área
- build-system, cli, mobile-dev
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 48/100