Prepare extraction of the compilation of the (when) option#288
Prepare extraction of the compilation of the (when) option#288alexander-yevsyukov merged 46 commits intomasterfrom
(when) option#288Conversation
There was a problem hiding this comment.
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
OptionGeneratorinjection to includeTypeSystemand introduceOptionGeneratorWithConverterto centralizeJavaValueConvertercreation. - 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Also: * Move `WHEN` constant under `WhenOption`.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
💡 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".
| check(!::querying.isInitialized) { | ||
| "`inject()` must be called exactly once on `${this::class.simpleName}`." |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
| fun projectsToPublish(): Set<Project> { | ||
| if (project.subprojects.isEmpty()) { | ||
| return setOf(project) | ||
| } | ||
| return modules.union(modulesWithCustomPublishing) | ||
| .map { name -> project.project(name) } | ||
| .ifEmpty { setOf(project) } | ||
| .toSet() | ||
| } |
There was a problem hiding this comment.
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.
This PR prepares the Validation code tree for extraction of the code generation of the
(when)option into Spine Time library.Notable changes
(when)option was extracted into modules starting withtime-.WhenOptionwas introduced as a service loader gate for the code generation of the(when)option.OptionGenerator.inject()now acceptsTypeSystemas the second parameter.OptionGeneratorWithConverterwas introduced as an abstract base for generators that needJavaValueConverter.