objectbox / objectbox/objectbox-java

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

Abierto
#1,050 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

enhancement
Lenguaje dominante
Java
Estrellas
4.6k
Forks
311
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el manejo que hace el plugin de Gradle de la opción del procesador de anotaciones objectbox.modelPath y de la configuración de build.gradle mostrada en el issue. Traza dónde se comprueba y se reescribe el JSON del modelo y, a continuación, define una opción que lea el modelo compartido existente sin modificarlo; se considera terminado cuando Kotlin pueda compilar contra el modelo de Flutter conservando todas las entidades de Flutter.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
flutter, java, kotlin
Área
build-system, databases, mobile-dev
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.