Skip to content

Support Gradle plugins block#8

Open
greenrobot wants to merge 17 commits intodevfrom
166-drop-apply-last-requirement
Open

Support Gradle plugins block#8
greenrobot wants to merge 17 commits intodevfrom
166-drop-apply-last-requirement

Conversation

@greenrobot
Copy link
Member

Currently it's required to add manual configuration to help resolve the Gradle plugin. A marker artifact is required to avoid this. It might be easiest and future proof to use Gradle's plugin development plugin (example config of Android plugin) and publish to the Gradle plugin portal (or maybe not, the Android plugin appears not to and still doesn't require a workaround).

This requires publishing a Plugin Marker artifact like plugin.id:plugin.id.gradle.plugin:plugin.version, so currently io.objectbox:io.objectbox.gradle.plugin:5.2.1 and io.objectbox.sync:io.objectbox.sync.gradle.plugin:5.2.1.

The Android plugin publishes this on Google's Maven repo (example). So using the Gradle plugin portal seems not required.

Fortunately, our namespace on Maven Central is already io.objectbox. It should therefore be possible to publish with the group ID io.objectbox.sync as well.

Drop apply last requirement

Currently it is necessary to apply the ObjectBox plugin after the dependencies block in a Gradle script so it can detect already added dependencies. This approach is not compatible with applying the plugin by using the recommended plugins block. It's also hard to discover this is required when manually adding dependencies (only mentioned in our Advanced docs).

The Kotlin Gradle plugin solves this using configuration.withDependencies { } to check for existing dependencies and add ones as needed. (Maybe also find out how the Android plugin does it.)

This might require finding a different way than ProjectBuilder in PluginApplyTests to test if dependencies are added. The Kotlin Gradle plugin tests add a custom task that prints added libraries and asserts log output.

@greenrobot
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greenrobot
Copy link
Member Author

@claude review

@greenrobot-team
Copy link
Member

@codex what about minor issues?

@chatgpt-codex-connector
Copy link

To use Codex here, create a Codex account and connect to github.

@greenrobot
Copy link
Member Author

@codex what about minor issues?

@chatgpt-codex-connector
Copy link

To use Codex here, create an environment for this repo.

@greenrobot
Copy link
Member Author

@codex review and also point out minor issues

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9e7e55594

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 177 to +181
else -> {
project.logger.warn(
"ObjectBox: Could not add dependency on objectbox-processor, " +
"no supported configuration (kapt, annotationProcessor, apt) found."
"ObjectBox: Could not add dependency on ${Const.OBX_PROCESSOR}, " +
"no supported configuration (${Const.KAPT_CONFIGURATION_NAME}, " +
"${JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME}) found."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Restore apt fallback for processor dependency

This refactor dropped the apt configuration branch, so projects that still wire annotation processors through an apt configuration (instead of kapt/annotationProcessor) will now skip adding objectbox-processor and fail to generate ObjectBox sources. This is a behavioral regression from the previous implementation and should either keep the apt fallback or explicitly migrate/guard those builds before removing support.

Useful? React with 👍 / 👎.

@greenrobot-team greenrobot-team force-pushed the 166-drop-apply-last-requirement branch from f9e7e55 to 229c482 Compare March 10, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants