NativeScript / NativeScript/nativescript-cli
Plugin's include.gradle is not properly respected when building aar
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.1k
- Forks
- 204
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 8
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Lies lib/services/android-plugin-build-service.ts im Bereich der Zeilen 232–239 und reproduziere anschließend das Problem mit dem nativescript-mapbox-Beispiel für include.gradle und tns build android. Verfolge, wie include.gradle in den Plugin-Build einbezogen wird; erledigt ist die Aufgabe, wenn die vollständige Datei während der Erstellung von .aar angewendet wird, anstatt dass nur ausgewählte Abschnitte kopiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, groovy, javascript
- Bereich
- build-system, cli, mobile-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100