objectbox / objectbox/objectbox-java
Gradle option to use model file instead of creating/modifying one
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 4.6k
- Forks
- 311
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
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
Beginnen Sie mit der Handhabung der Annotation-Processor-Option objectbox.modelPath durch das Gradle-Plugin und der im Issue gezeigten build.gradle-Konfiguration. Verfolgen Sie, wo das Modell-JSON geprüft und neu geschrieben wird, und definieren Sie anschließend eine Option, die das vorhandene gemeinsame Modell liest, ohne es zu ändern; als abgeschlossen gilt die Aufgabe, wenn Kotlin gegen das Flutter-Modell bauen kann und dabei alle Flutter-Entitäten erhalten bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- flutter, java, kotlin
- Bereich
- build-system, databases, mobile-dev
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100