objectbox / objectbox/objectbox-java
Gradle option to use model file instead of creating/modifying one
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 4.6k
- Fork
- 311
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với cách plugin Gradle xử lý tùy chọn của annotation processor objectbox.modelPath và cấu hình build.gradle được nêu trong issue. Theo dõi nơi model JSON được kiểm tra và ghi lại, sau đó định nghĩa một tùy chọn đọc model dùng chung hiện có mà không sửa đổi nó; hoàn thành khi Kotlin có thể build dựa trên model Flutter mà vẫn giữ lại tất cả các entity Flutter.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- flutter, java, kotlin
- Lĩnh vực
- build-system, databases, mobile-dev
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100