Skip to content

The ObjectBox Gradle Plugin makes using ObjectBox easy in a JVM or Android project written in Java or Kotlin

License

Notifications You must be signed in to change notification settings

objectbox/objectbox-java-generator

Repository files navigation

ObjectBox

ObjectBox Gradle Plugin

The ObjectBox Gradle Plugin makes using ObjectBox easy in a JVM or Android project written in Java or Kotlin, and is free and open source. See the documentation on how to get started.

Minimum requirements to apply the plugin

Development

This project is known to build with JDK 17.

This repository contains a collection of Gradle subprojects:

  • objectbox-gradle-plugin provides the actual Gradle plugins (io.objectbox and io.objectbox.sync),
  • objectbox-processor provides an annotation processor,
  • objectbox-generator provides a source code generator used by the annotation processor,
  • objectbox-code-modifier provides model file ("IdSync") generation used by the annotation processor, and byte-code transformers for Android and Java projects.
    • Multiple agp-wrapper-x-y projects provide a compatibility layer for specific versions of the Android Plugin API, currently for byte-code transforms only.

All are published as Maven artifacts (see gradle folder).

Adding a new property type

This is a checklist on how to add support for a new property type:

  • (Optional) Java: update generated Flatbuffers Java classes to add new PropertyType.
  • Generator: add new generator PropertyType and map it to the Java API PropertyType.
  • Processor: add a field with each new supported type to SimpleEntity.java (SimpleEntityTest).
  • Processor: update to detect the new property types (also check if indexes should be prevented).
  • Update the model expected by the test.
  • Java API: add new collect methods to Cursor.java.
  • Generator: update PropertyCollector to generate code using the new collect methods.
  • Update the generated files expected by the test.
  • Java integration tests: add a field with the new type to TestEntity.java, update BoxTest.java.
    • Java: update TestEntity and tests with code (incl. generated by the plugin) of integration tests.
  • Java: add additional tests as needed, e.g. query the new property.

License

ObjectBox Build Tools
Copyright (C) 2017-2024 ObjectBox Ltd.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Note that this license applies to the code in this repository only. The build tools in this repository are not distributed with your application. So their copyleft license has no impact on how you distribute your application. See our website on details about all licenses for ObjectBox components.

About

The ObjectBox Gradle Plugin makes using ObjectBox easy in a JVM or Android project written in Java or Kotlin

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published