feature request: Enhance Search Locations for GoogleServicesPluginConfig

Aperta
#303 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
android, kotlin
Ambito
build-system

Direzione di ricerca

Inizia dalla configurazione del flavor in app/build.gradle.kts e dall’entry point GoogleServicesPluginConfig. Traccia il modo in cui il plugin cerca google-services.json per la variante :app:processAmazonNpdDebugGoogleServices, quindi definisci se le posizioni di ricerca predefinite o un servicesJsonFile esplicito dovrebbero supportare src/npd/google-services.json. Il lavoro è completo quando il JSON NPD viene trovato senza creare directory non standard.

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

Descrizione

When using multiple layers of product flavors, the default search locations for the JSONs are unable to find the service JSON; even if AGP recognizes these directories and automatically adds them to the sources. This disconnect between behaviors forces engineers to go against project resource conventions and create directories to satisfy this plugins expectations.

Here's a minimal example:

// app/build.gradle.kts
flavorDimensions += listOf(
  "market",
  "environment"
)

productFlavors {
  create("amazon") {
      dimension = "market"
  }
  create("google") {
      dimension = "market"
  }
  create("npd") {
      dimension = "environment"
  }
  create("prod") {
      dimension = "environment"
  }
}

We want to store the NPD json in project/app/src/npd (this is a recognized source location for the variant in Android Studio, and probably should be in the default search locations).

Unfortunately, this results in an error:

* What went wrong:
Execution failed for task ':app:processAmazonNpdDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it. 
   Searched Location: 
   
project/app/src/amazon/npd/debug/google-services.json
project/app/src/amazonNpd/debug/google-services.json
project/app/src/debug/amazonNpd/google-services.json
project/app/src/amazon/debug/google-services.json
project/app/src/amazon/npd/google-services.json
project/app/src/amazon/npdDebug/google-services.json
project/app/src/amazonNpd/google-services.json
project/app/src/debug/google-services.json
project/app/src/amazonNpdDebug/google-services.json
project/app/src/amazon/google-services.json
project/app/src/amazonDebug/google-services.json
project/app/google-services.json

Suggested Solutions

  1. Modify the default search locations to include a root directory for all flavors, regardless of priority.
  2. Allow clients using the plugin to specify the location of the services JSON in the plugin's GoogleServicesPluginConfig. e.g.
    create("npd") {
        dimension = "environment"
        googleServices {
           servicesJsonFile = File("src/npd/google-services.json")
        }
    }
    
Lingua principale
Kotlin
Stelle
526
Fork
173
Merge medio
1g 5h
PR unite (30g)
3

Preparare l'ambiente

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 google/play-services-plugins

Tutte le issue di google/play-services-plugins

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.