File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
java-api/src/main/kotlin/io/spine/validation/api
java-ksp/src/main/kotlin/io/spine/validation/java/ksp
java/src/main/kotlin/io/spine/validation/java Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -29,16 +29,18 @@ package io.spine.validation.api
29
29
import io.spine.annotation.Internal
30
30
31
31
/* *
32
- * A container for the discovered message validators.
32
+ * Holds a path to a file with the discovered validators.
33
33
*
34
- * Holds the resource path for the message-validators configuration file
35
- * used by the `:model` to generate the corresponding constraints .
34
+ * KSP processor generates a resource file using the [RESOURCES_LOCATION].
35
+ * Then, the codegen plugin picks up the file using the same location .
36
36
*/
37
37
@Internal
38
- public object MessageValidatorsDescriptor {
38
+ public object DiscoveredValidators {
39
39
40
40
/* *
41
- * The path in resources to the file with the discovered message validators.
41
+ * The path to the file with the discovered message validators.
42
+ *
43
+ * The path is relative to the output directory of the KSP processor.
42
44
*/
43
- public const val RESOURCES_LOCATION : String = " spine/validation/message-validators.txt "
45
+ public const val RESOURCES_LOCATION : String = " spine/validation/message-validators"
44
46
}
Original file line number Diff line number Diff line change @@ -35,15 +35,15 @@ import com.google.devtools.ksp.symbol.KSAnnotation
35
35
import com.google.devtools.ksp.symbol.KSClassDeclaration
36
36
import com.google.devtools.ksp.symbol.KSType
37
37
import com.google.devtools.ksp.symbol.KSTypeReference
38
- import io.spine.validation.api.MessageValidatorsDescriptor
38
+ import io.spine.validation.api.DiscoveredValidators
39
39
import io.spine.validation.api.Validator
40
40
41
41
internal class ValidatorProcessor (codeGenerator : CodeGenerator ) : SymbolProcessor {
42
42
43
43
private val discoveredValidators = mutableSetOf<String >()
44
44
private val output = codeGenerator.createNewFileByPath(
45
45
dependencies = Dependencies (aggregating = true ),
46
- path = MessageValidatorsDescriptor .RESOURCES_LOCATION ,
46
+ path = DiscoveredValidators .RESOURCES_LOCATION ,
47
47
extensionName = " "
48
48
).writer()
49
49
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ package io.spine.validation.java
28
28
29
29
import io.spine.protodata.java.ClassName
30
30
import io.spine.validation.ValidationPlugin
31
- import io.spine.validation.api.MessageValidatorsDescriptor
31
+ import io.spine.validation.api.DiscoveredValidators
32
32
import io.spine.validation.api.ValidationOption
33
33
import io.spine.validation.java.setonce.SetOnceRenderer
34
34
import java.io.File
@@ -73,7 +73,7 @@ private val customOptions by lazy {
73
73
private val customValidators by lazy {
74
74
val protoDataWorkingDir = System .getProperty(" user.dir" )
75
75
val kspOutput = " $protoDataWorkingDir /$KSP_GENERATED_RESOURCES "
76
- val messageValidatorsPath = " $kspOutput /${MessageValidatorsDescriptor .RESOURCES_LOCATION } "
76
+ val messageValidatorsPath = " $kspOutput /${DiscoveredValidators .RESOURCES_LOCATION } "
77
77
val messageValidators = File (messageValidatorsPath)
78
78
if (! messageValidators.exists()) {
79
79
return @lazy emptyMap()
You can’t perform that action at this time.
0 commit comments