Plugin's include.gradle is not properly respected when building aar

Aperta
#3,563 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
android, groovy, javascript

Direzione di ricerca

Leggi lib/services/android-plugin-build-service.ts intorno alle righe 232-239, quindi riproduci il problema con l'esempio di nativescript-mapbox per include.gradle e tns build android. Traccia il modo in cui include.gradle viene incorporato nella build del plugin; il lavoro è completato quando l'intero file viene applicato durante la costruzione di .aar, invece di copiare solo sezioni selezionate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug os: android
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.
  1. tns create myApp
  2. cd myApp
  3. tns plugin add nativescript-mapbox
  4. edit node_modules/nativescript-mapbox/platforms/android/include.gradle so 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"
}
  1. 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.

Lingua principale
JavaScript
Stelle
1.1k
Fork
204
Merge medio
1g 9h
PR unite (30g)
8

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NativeScript/nativescript-cli

Tutte le issue di NativeScript/nativescript-cli

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.