objectbox / objectbox/objectbox-java

Gradle option to use model file instead of creating/modifying one

Aperta
#1,050 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Java
Stelle
4.6k
Fork
311
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Currently, every time someone builds a Gradle project, the plugin will look for the entities and recreate the model JSON file if needed.

My suggestion is to add an option to only read the model file without checking and changing it.

The reason for such an option is to allow sharing the same model file and database in multiple languages.

To be more specific, I have a Flutter app that uses objectbox-dart, that app also has Android widgets written in Kotlin, so the idea is that I want to load an objectbox database in read-only mode inside my widget to get information previously added using objectbox-dart in Flutter.

I'm able to do that if I add this to my build.gradle file:

        javaCompileOptions {
            annotationProcessorOptions {
                arguments.put("objectbox.modelPath", "$rootDir/../lib/objectbox-model.json".toString())
            }
        }

And that works, the issue is that from the Flutter side, I have multiple entities, but from the Kotlin side, I'm only interested in one, so if I build my grade project, my JSON model will be replaced with only the entity shared between both languages, to make the Flutter app work again, I need to always forcefully regenerate the model so it overrides what the gradle plugin changed. Hence why I want to prevent gradle build from changing that file.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Direzione di ricerca

Inizia esaminando la gestione da parte del plugin Gradle dell'opzione del processore di annotazioni objectbox.modelPath e della configurazione build.gradle mostrata nell'issue. Traccia dove il JSON del modello viene controllato e riscritto, quindi definisci un'opzione che legga il modello condiviso esistente senza modificarlo; il lavoro è completato quando Kotlin può compilare usando il modello Flutter, preservando tutte le entità Flutter.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.