-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Gradle build cache #1114
Comments
Thanks for reporting! I guess the culprit is that the model file is only touched by the annotation processor. We need to check if it can somehow be indicated to Gradle that the processor has the model file as an input and output. A workaround could be to add the model file as an input to e.g. an assemble task (or whichever necessary):
Maybe we can also do this automatically with the Gradle plugin. (Somewhat related, though configuration cache other than build cache is still experimental: #948) |
I think it's a good idea! |
@rAseri Thanks for testing this! Looks like adding an input to the kapt (or Java equivalent annotation processor) task is what we will let the Gradle plugin do then. (Added an internal issue for this.) |
The bug is occurred in an Android Project.
Description of the bug
During a manual conflict resolution, the
objectbox-models/default.json
file may accidentally contain duplicatedindexId
entries. During the build time, we don't have any errors. The project builds successfully, and the build output is cached to the Gradle Build Cache. Only at runtime, when we buildBoxStore
instance, an error occurred:io.objectbox.exception.DbSchemaException: Duplicate index ID 2 found for property ...
. Moreover, when a developer fixes duplicatedindexId
entries in theobjectbox-models/default.json
file and rebuilds the project, the error is still in place due to the result of the previous build is used from the Gradle Build Cache. It incurs hard-to-debug problems for our dev team.Basic info:
Steps to reproduce the behavior:
org.gradle.caching=true
in thegradle.properties
file.User
andCompany
) with the uniquename
property.objectbox-models/default.json
file.objectbox-models/default.json
file: set the same value to bothindexId
entries (Company.name
andUser.name
).io.objectbox.exception.DbSchemaException: Duplicate index ID 2 found for property ...
indexId
in theobjectbox-models/default.json
file.Expected behavior
Duplicate index ID
error should occur during the build time, not at runtime.objectbox-models/default.json
file should lead to the invalidation of the Gradle Build Cache to prevent the usage of stale data from the previous build.Code
I've prepared the demo project to reproduce the problem with the described above steps:
https://github.com/rAseri/ObjectBoxDemo
Logs, stack traces
The text was updated successfully, but these errors were encountered: