-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to TemplateString from Spine Base
#303
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
Merged
alexander-yevsyukov
merged 37 commits into
master
from
migrate-to-template-string-from-base
May 16, 2026
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
b982021
Bump CoreJvm Compiler -> `2.0.0-SNAPSHOT.064`
alexander-yevsyukov 605670b
Update dependency reports
alexander-yevsyukov 6091ed8
Suppress false duplicate depenencies warning
alexander-yevsyukov 2df5d38
Bump Time -> `2.0.0-SNAPSHOT.240`
alexander-yevsyukov af4d057
Update dependency reports
alexander-yevsyukov 9b43f9a
Rename `error_message.proto` to `template_string.proto`
alexander-yevsyukov f255455
Remove deprecated `ErrorPlaceholder`
alexander-yevsyukov 70d0811
Add integration tests for the `(when)` constraint compilation
alexander-yevsyukov 384a042
Introduce `Placeholder`, rename `ErrorPlaceholder` to `StandardPlaceh…
alexander-yevsyukov e83dd68
Bump base version -> `2.0.0-SNAPSHOT.388`
alexander-yevsyukov 51ffaaf
Move `TemplateString` and `Placeholder` to `base`
alexander-yevsyukov ba82d54
Update dependency reports
alexander-yevsyukov 87e403e
Bump version -> `2.0.0-SNAPSHOT.430`
alexander-yevsyukov b7e1044
Update dependency reports
alexander-yevsyukov 6607211
Adopt new `Placeholder` API
alexander-yevsyukov 0853ce6
Bump Validation -> `2.0.0-SNAPSHOT.419`
alexander-yevsyukov ab3a9de
Update dependency reports
alexander-yevsyukov 0253ce8
Add the `StandardPlaceholder.placed` property
alexander-yevsyukov 1f3ff27
Improve file name
alexander-yevsyukov 84d4927
Replace class names in the generated code
alexander-yevsyukov 5f7a20b
Migrate to new `TemplateString`
alexander-yevsyukov 40f03c8
Use older placeholders code, for now
alexander-yevsyukov 6554acb
Remove redundant `@JvmName`
alexander-yevsyukov f356b62
Bump Base -> `2.0.0-SNAPSHOT.389`
alexander-yevsyukov 95fa800
Update dependency reports
alexander-yevsyukov 3a08b4d
Migrate to `Placeholder` API
alexander-yevsyukov 483781e
Update dependency reports
alexander-yevsyukov 5780fa5
Force Time runtime libraries
alexander-yevsyukov 5191bb1
Update build time
alexander-yevsyukov e4e9b0b
Merge branch 'master' into migrate-to-template-string-from-base
alexander-yevsyukov b84be35
Update embedded code
alexander-yevsyukov c7c17ef
Bump Validation
alexander-yevsyukov 6f6da7c
Update build time
alexander-yevsyukov d438c4b
Update docs/_examples submodule reference
alexander-yevsyukov 5abad2e
Update `_example` ref.
alexander-yevsyukov 1e7e1ff
Update examples ref.
alexander-yevsyukov 44f3657
Update build time
alexander-yevsyukov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /* | ||
| * Copyright 2026, TeamDev. All rights reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Redistribution and use in source and/or binary forms, with or without | ||
| * modification, must retain the above copyright notice and the following | ||
| * disclaimer. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
|
|
||
| import org.gradle.api.Project | ||
| import org.gradle.api.Task | ||
| import org.gradle.api.tasks.TaskProvider | ||
| import org.gradle.kotlin.dsl.named | ||
| import org.gradle.kotlin.dsl.register | ||
|
|
||
| /** | ||
| * Registers a `patchGeneratedTemplateString` task in the project, which replaces | ||
| * references to the legacy `io.spine.validation.TemplateString` class (and its | ||
| * proto FQN `.spine.validation.TemplateString`) with `io.spine.string.TemplateString` | ||
| * in the `generated/` sources. | ||
| * | ||
| * The task is wired to run after [upstreamTask] (the task that produces the sources | ||
| * to be patched) and before `compileJava` and `kspKotlin`. | ||
| * | ||
| * @param upstreamTask the name of the task whose output should be patched | ||
| * (e.g., `generateProto` or `launchSpineCompiler`). | ||
| */ | ||
| fun Project.patchGeneratedTemplateString(upstreamTask: String): TaskProvider<Task> { | ||
| val patchTask = tasks.register("patchGeneratedTemplateString") { | ||
| dependsOn(upstreamTask) | ||
|
|
||
| val generatedDir = layout.projectDirectory.dir("generated") | ||
| inputs.dir(generatedDir).withPropertyName("generatedSources") | ||
| outputs.dir(generatedDir).withPropertyName("patchedSources") | ||
|
|
||
| doLast { | ||
| val oldClassRef = "io.spine.validation.TemplateString" | ||
| val newClassRef = "io.spine.string.TemplateString" | ||
| val oldProtoRef = ".spine.validation.TemplateString" | ||
| val newProtoRef = ".spine.string.TemplateString" | ||
| generatedDir.asFile.walkTopDown() | ||
| .filter { it.isFile && (it.extension == "java" || it.extension == "kt") } | ||
| .forEach { file -> | ||
| val original = file.readText() | ||
| if (original.contains(oldClassRef) || original.contains(oldProtoRef)) { | ||
| val patched = original | ||
| .replace(oldClassRef, newClassRef) | ||
| .replace(oldProtoRef, newProtoRef) | ||
| file.writeText(patched) | ||
|
alexander-yevsyukov marked this conversation as resolved.
|
||
| } | ||
| } | ||
| } | ||
|
alexander-yevsyukov marked this conversation as resolved.
|
||
| } | ||
|
|
||
| tasks.named("compileJava") { | ||
| dependsOn(patchTask) | ||
| } | ||
|
|
||
| afterEvaluate { | ||
| tasks.named("kspKotlin") { | ||
| dependsOn(patchTask) | ||
| } | ||
| } | ||
|
|
||
| return patchTask | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 0 additions & 78 deletions
78
context/src/main/kotlin/io/spine/tools/validation/ErrorPlaceholder.kt
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.