Skip to content

Prepare extraction of the compilation of the (when) option#288

Merged
alexander-yevsyukov merged 46 commits intomasterfrom
prepare-when-option-extraction
Apr 24, 2026
Merged

Prepare extraction of the compilation of the (when) option#288
alexander-yevsyukov merged 46 commits intomasterfrom
prepare-when-option-extraction

Conversation

@alexander-yevsyukov
Copy link
Copy Markdown
Collaborator

@alexander-yevsyukov alexander-yevsyukov commented Apr 22, 2026

This PR prepares the Validation code tree for extraction of the code generation of the (when) option into Spine Time library.

Notable changes

  • The code related to the (when) option was extracted into modules starting with time-.
  • The class WhenOption was introduced as a service loader gate for the code generation of the (when) option.
  • OptionGenerator.inject() now accepts TypeSystem as the second parameter.
  • OptionGeneratorWithConverter was introduced as an abstract base for generators that need JavaValueConverter.

Copilot AI review requested due to automatic review settings April 22, 2026 19:41
@alexander-yevsyukov alexander-yevsyukov self-assigned this Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Prepares the Java validation code generation pipeline for extracting compilation of the (when) option by refactoring option generator infrastructure (notably value conversion and injection), and aligns build/publishing tooling & dependency versions accordingly.

Changes:

  • Refactor Java OptionGenerator injection to include TypeSystem and introduce OptionGeneratorWithConverter to centralize JavaValueConverter creation.
  • Update built-in option generators to use the new converter base class and adjust renderer wiring.
  • Bump/align multiple dependency and plugin versions and tweak Gradle publishing/license-report infrastructure.

Reviewed changes

Copilot reviewed 38 out of 39 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
version.gradle.kts Bumps published Validation SDK version.
tests/validating/src/test/kotlin/io/spine/test/options/ChoiceITest.kt Minor test assertion simplification.
tests/extensions/build.gradle.kts Updates forced Core JVM Compiler plugin notation helper usage.
pom.xml Updates Maven coordinates and dependency versions/artifact IDs.
jvm-runtime/build.gradle.kts Forces JetBrains annotations in buildscript resolution strategy.
java/src/main/kotlin/io/spine/tools/validation/java/generate/option/WhenGenerator.kt Switches (when) generator to converter-providing base class.
java/src/main/kotlin/io/spine/tools/validation/java/generate/option/ValidateGenerator.kt Switches (validate) generator to converter-providing base class.
java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequiredGenerator.kt Switches (required) generator to converter-providing base class.
java/src/main/kotlin/io/spine/tools/validation/java/generate/option/RequireOptionGenerator.kt Switches (require) generator to converter base + simplifies codeFor.
java/src/main/kotlin/io/spine/tools/validation/java/generate/option/GoesGenerator.kt Switches (goes) generator to converter-providing base class.
java/src/main/kotlin/io/spine/tools/validation/java/generate/OptionGeneratorWithConverter.kt Adds new base class providing lazily created JavaValueConverter.
java/src/main/kotlin/io/spine/tools/validation/java/generate/OptionGenerator.kt Adds TypeSystem injection and updates injection contract.
java/src/main/kotlin/io/spine/tools/validation/java/expression/EmptyFieldCheck.kt Reflows KDoc formatting.
java/src/main/kotlin/io/spine/tools/validation/java/JavaValidationRenderer.kt Injects TypeSystem into generators; instantiates generators without converter ctor arg.
dependencies.md Regenerates dependency/license report snapshot (version/date updates).
context/build.gradle.kts Forces JetBrains annotations in buildscript resolution strategy.
buildSrc/src/test/kotlin/io/spine/gradle/publish/SpinePublishingTest.kt Updates test to use SpinePublishing.extensionName.
buildSrc/src/main/kotlin/kmp-module.gradle.kts Forces Jackson/Kotlin BOM artifacts; removes Kotest datatest dependency.
buildSrc/src/main/kotlin/jvm-module.gradle.kts Forces Jackson/Kotlin artifacts in resolution strategy.
buildSrc/src/main/kotlin/io/spine/gradle/report/license/LicenseReporter.kt Uses central Spine group constants for excluded groups.
buildSrc/src/main/kotlin/io/spine/gradle/publish/SpinePublishing.kt Centralizes extension name; adjusts published project selection and group checks.
buildSrc/src/main/kotlin/io/spine/gradle/publish/ShadowJarExts.kt Reworks ShadowJar configuration helpers and adds deduplication logic.
buildSrc/src/main/kotlin/io/spine/gradle/publish/PublicationHandler.kt Adjusts artifactId derivation to preserve KMP suffixes.
buildSrc/src/main/kotlin/io/spine/gradle/github/pages/UpdateGitHubPages.kt Removes commented-out conditional publishing logic.
buildSrc/src/main/kotlin/io/spine/dependency/test/Kotest.kt Bumps Kotest version and adjusts exposed constants/deprecations.
buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt Updates Validation dependency version constant.
buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt Updates ToolBase versions.
buildSrc/src/main/kotlin/io/spine/dependency/local/TestLib.kt Renames TestLib artifact ID and bumps version.
buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoTap.kt Uses Spine tools group constant for groupId.
buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt Bumps logging version and updates logging testlib artifactId.
buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt Simplifies plugin lib notation; updates Core JVM Compiler versions/constants.
buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvm.kt Bumps Core JVM version and updates testlib artifact IDs.
buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt Updates compiler group constant usage and fallback versions.
buildSrc/src/main/kotlin/io/spine/dependency/lib/JetBrainsAnnotations.kt Defines JetBrains annotations dependency under the correct package/name.
buildSrc/src/main/kotlin/io/spine/dependency/build/Dokka.kt Uses Spine tools group constant for Spine Dokka extension artifact.
buildSrc/src/main/kotlin/ForcePlugins.kt Updates Core JVM Compiler classpath helper usage.
buildSrc/build.gradle.kts Updates plugin/library versions (license report, Dokka, Shadow) and removes plugin DSL application for license report.
.idea/inspectionProfiles/Project_Default.xml Formatting-only IDE config adjustment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread buildSrc/src/main/kotlin/io/spine/gradle/publish/PublicationHandler.kt Outdated
Comment thread java/src/main/kotlin/io/spine/tools/validation/java/generate/OptionGenerator.kt Outdated
Copilot AI review requested due to automatic review settings April 23, 2026 20:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 51 out of 52 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread buildSrc/src/main/kotlin/io/spine/gradle/publish/SpinePublishing.kt
Comment thread .agents/tasks/when-option-migration.md Outdated
Comment thread .agents/tasks/when-option-migration.md Outdated
Comment thread .agents/tasks/when-option-migration.md Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 16:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 67 out of 74 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/time-validating/build.gradle.kts
Copilot AI review requested due to automatic review settings April 24, 2026 17:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 70 out of 77 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review April 24, 2026 17:39
Copy link
Copy Markdown

@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: 5cd9c287da

ℹ️ 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 +70 to +71
check(!::querying.isInitialized) {
"`inject()` must be called exactly once on `${this::class.simpleName}`."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Permit reinjection of reused custom generators

The new single-call guard in inject() breaks custom option generators that are reused across plugin instances in the same JVM. JavaValidationPlugin caches customOptions via a top-level lazy ServiceLoader, and implementations (including the new WhenOption) expose generator as a single object, so the same generator is injected again on the next compilation/plugin instantiation and now throws IllegalStateException before rendering starts. This can fail repeated compilations/tests in one process; either make generator provisioning per-plugin-instance or remove this hard one-time check.

Useful? React with 👍 / 👎.

Copilot AI review requested due to automatic review settings April 24, 2026 17:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 71 out of 77 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

java/src/main/kotlin/io/spine/tools/time/validation/java/WhenOption.kt:103

  • KDoc grammar: "marked with the (when) options" should be singular ("option"). This reads like a typo and is easy to fix while extracting the (when) code into a separate module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +353 to 361
fun projectsToPublish(): Set<Project> {
if (project.subprojects.isEmpty()) {
return setOf(project)
}
return modules.union(modulesWithCustomPublishing)
.map { name -> project.project(name) }
.ifEmpty { setOf(project) }
.toSet()
}
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

projectsToPublish() is only used inside SpinePublishing (called from configured()), but it is now public. If it’s not meant to be part of the extension’s external API, consider making it private (or at least internal) to avoid exposing additional surface area and keep future refactors easier.

Copilot uses AI. Check for mistakes.
@alexander-yevsyukov alexander-yevsyukov merged commit 83cd3b1 into master Apr 24, 2026
11 of 12 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the prepare-when-option-extraction branch April 24, 2026 18:08
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.

3 participants