Skip to content

Commit 6bca167

Browse files
Merge pull request #247 from SpineEventEngine/fix-gradle-plugin-artifact-name
Fix Gradle plugin artifact name
2 parents aed6386 + f17c3b4 commit 6bca167

File tree

8 files changed

+84
-40
lines changed

8 files changed

+84
-40
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ spinePublishing {
8888
)
8989
modulesWithCustomPublishing = setOf(
9090
"java-bundle",
91+
"gradle-plugin",
9192
)
9293
destinations = with(PublishingRepos) {
9394
setOf(

buildSrc/src/main/kotlin/io/spine/gradle/publish/ProtoExts.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ import org.gradle.api.file.SourceDirectorySet
3535
import org.gradle.api.tasks.bundling.Jar
3636

3737
/**
38-
* Tells whether there are any Proto sources in "main" source set.
38+
* Tells whether there are any Proto sources in the "main" source set.
3939
*/
40-
internal fun Project.hasProto(): Boolean {
40+
fun Project.hasProto(): Boolean {
4141
val protoSources = protoSources()
42-
val result = protoSources.any { it.exists() }
42+
val result = protoSources.any {
43+
it.exists()
44+
&& it.isDirectory
45+
&& it.listFiles()?.isNotEmpty() ?: false
46+
}
4347
return result
4448
}
4549

buildSrc/src/main/kotlin/io/spine/gradle/publish/PublishingExts.kt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import org.gradle.api.Project
3636
import org.gradle.api.Task
3737
import org.gradle.api.publish.PublicationContainer
3838
import org.gradle.api.publish.PublishingExtension
39+
import org.gradle.api.publish.maven.MavenPublication
3940
import org.gradle.api.tasks.TaskContainer
4041
import org.gradle.api.tasks.TaskProvider
4142
import org.gradle.api.tasks.bundling.Jar
@@ -231,7 +232,7 @@ fun TaskContainer.excludeGoogleProtoFromArtifacts() {
231232
* Java and Kotlin sources are default to `main` source set since it is created by `java` plugin.
232233
* For Proto sources to be included – [special treatment][protoSources] is needed.
233234
*/
234-
internal fun Project.sourcesJar(): TaskProvider<Jar> = tasks.getOrCreate("sourcesJar") {
235+
fun Project.sourcesJar(): TaskProvider<Jar> = tasks.getOrCreate("sourcesJar") {
235236
dependOnGenerateProto()
236237
archiveClassifier.set("sources")
237238
from(sourceSets["main"].allSource) // Puts Java and Kotlin sources.
@@ -245,7 +246,7 @@ internal fun Project.sourcesJar(): TaskProvider<Jar> = tasks.getOrCreate("source
245246
* The output of this task is a `jar` archive. The archive contains only
246247
* [Proto sources][protoSources] from `main` source set.
247248
*/
248-
internal fun Project.protoJar(): TaskProvider<Jar> = tasks.getOrCreate("protoJar") {
249+
fun Project.protoJar(): TaskProvider<Jar> = tasks.getOrCreate("protoJar") {
249250
dependOnGenerateProto()
250251
archiveClassifier.set("proto")
251252
from(protoSources())
@@ -317,3 +318,19 @@ internal fun Project.artifacts(jarFlags: JarFlags): Set<TaskProvider<Jar>> {
317318

318319
return tasks
319320
}
321+
322+
/**
323+
* Adds the source code and documentation JARs to the publication.
324+
*/
325+
fun MavenPublication.addSourceAndDocJars(project: Project) {
326+
val tasks = mutableSetOf<TaskProvider<Jar>>()
327+
tasks.add(project.sourcesJar())
328+
tasks.add(project.javadocJar())
329+
tasks.add(project.htmlDocsJar())
330+
if (project.hasProto()) {
331+
tasks.add(project.protoJar())
332+
}
333+
tasks.forEach {
334+
artifact(it)
335+
}
336+
}

dependencies.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
# Dependencies of `io.spine.tools:validation-gradle-plugin:2.0.0-SNAPSHOT.373`
3+
# Dependencies of `io.spine.tools:validation-gradle-plugin:2.0.0-SNAPSHOT.374`
44

55
## Runtime
66
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -1069,14 +1069,14 @@
10691069

10701070
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
10711071

1072-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1072+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
10731073
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
10741074
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
10751075

10761076

10771077

10781078

1079-
# Dependencies of `io.spine.tools:validation-java:2.0.0-SNAPSHOT.373`
1079+
# Dependencies of `io.spine.tools:validation-java:2.0.0-SNAPSHOT.374`
10801080

10811081
## Runtime
10821082
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -2163,14 +2163,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
21632163

21642164
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
21652165

2166-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
2166+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
21672167
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
21682168
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
21692169

21702170

21712171

21722172

2173-
# Dependencies of `io.spine.tools:validation-java-bundle:2.0.0-SNAPSHOT.373`
2173+
# Dependencies of `io.spine.tools:validation-java-bundle:2.0.0-SNAPSHOT.374`
21742174

21752175
## Runtime
21762176
1. **Group** : org.jetbrains. **Name** : annotations. **Version** : 26.0.2.
@@ -2936,14 +2936,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
29362936

29372937
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
29382938

2939-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
2939+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
29402940
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
29412941
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
29422942

29432943

29442944

29452945

2946-
# Dependencies of `io.spine:validation-jvm-runtime:2.0.0-SNAPSHOT.373`
2946+
# Dependencies of `io.spine:validation-jvm-runtime:2.0.0-SNAPSHOT.374`
29472947

29482948
## Runtime
29492949
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -3792,14 +3792,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
37923792

37933793
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
37943794

3795-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
3795+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
37963796
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
37973797
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
37983798

37993799

38003800

38013801

3802-
# Dependencies of `io.spine.tools:validation-ksp:2.0.0-SNAPSHOT.373`
3802+
# Dependencies of `io.spine.tools:validation-ksp:2.0.0-SNAPSHOT.374`
38033803

38043804
## Runtime
38053805
1. **Group** : com.google.auto.service. **Name** : auto-service-annotations. **Version** : 1.1.1.
@@ -4744,14 +4744,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
47444744

47454745
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
47464746

4747-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
4747+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
47484748
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
47494749
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
47504750

47514751

47524752

47534753

4754-
# Dependencies of `io.spine.tools:validation-model:2.0.0-SNAPSHOT.373`
4754+
# Dependencies of `io.spine.tools:validation-model:2.0.0-SNAPSHOT.374`
47554755

47564756
## Runtime
47574757
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -5838,14 +5838,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
58385838

58395839
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
58405840

5841-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
5841+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
58425842
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
58435843
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
58445844

58455845

58465846

58475847

5848-
# Dependencies of `io.spine.tools:validation-configuration:2.0.0-SNAPSHOT.373`
5848+
# Dependencies of `io.spine.tools:validation-configuration:2.0.0-SNAPSHOT.374`
58495849

58505850
## Runtime
58515851
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -6963,14 +6963,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
69636963

69646964
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
69656965

6966-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
6966+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
69676967
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
69686968
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
69696969

69706970

69716971

69726972

6973-
# Dependencies of `io.spine.tools:validation-context:2.0.0-SNAPSHOT.373`
6973+
# Dependencies of `io.spine.tools:validation-context:2.0.0-SNAPSHOT.374`
69746974

69756975
## Runtime
69766976
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -8092,14 +8092,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
80928092

80938093
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
80948094

8095-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
8095+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
80968096
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
80978097
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
80988098

80998099

81008100

81018101

8102-
# Dependencies of `io.spine.tools:validation-consumer:2.0.0-SNAPSHOT.373`
8102+
# Dependencies of `io.spine.tools:validation-consumer:2.0.0-SNAPSHOT.374`
81038103

81048104
## Runtime
81058105
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -9186,14 +9186,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
91869186

91879187
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
91889188

9189-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
9189+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
91909190
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
91919191
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
91929192

91939193

91949194

91959195

9196-
# Dependencies of `io.spine.tools:validation-consumer-dependency:2.0.0-SNAPSHOT.373`
9196+
# Dependencies of `io.spine.tools:validation-consumer-dependency:2.0.0-SNAPSHOT.374`
91979197

91989198
## Runtime
91999199
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -10183,14 +10183,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1018310183

1018410184
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1018510185

10186-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
10186+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1018710187
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1018810188
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1018910189

1019010190

1019110191

1019210192

10193-
# Dependencies of `io.spine.tools:validation-extensions:2.0.0-SNAPSHOT.373`
10193+
# Dependencies of `io.spine.tools:validation-extensions:2.0.0-SNAPSHOT.374`
1019410194

1019510195
## Runtime
1019610196
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -11333,14 +11333,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1133311333

1133411334
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1133511335

11336-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
11336+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1133711337
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1133811338
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1133911339

1134011340

1134111341

1134211342

11343-
# Dependencies of `io.spine.tools:validation-runtime:2.0.0-SNAPSHOT.373`
11343+
# Dependencies of `io.spine.tools:validation-runtime:2.0.0-SNAPSHOT.374`
1134411344

1134511345
## Runtime
1134611346
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -12330,14 +12330,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1233012330

1233112331
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1233212332

12333-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
12333+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1233412334
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1233512335
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1233612336

1233712337

1233812338

1233912339

12340-
# Dependencies of `io.spine.tools:validation-validating:2.0.0-SNAPSHOT.373`
12340+
# Dependencies of `io.spine.tools:validation-validating:2.0.0-SNAPSHOT.374`
1234112341

1234212342
## Runtime
1234312343
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -13331,14 +13331,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1333113331

1333213332
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1333313333

13334-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
13334+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1333513335
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1333613336
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1333713337

1333813338

1333913339

1334013340

13341-
# Dependencies of `io.spine.tools:validation-validator:2.0.0-SNAPSHOT.373`
13341+
# Dependencies of `io.spine.tools:validation-validator:2.0.0-SNAPSHOT.374`
1334213342

1334313343
## Runtime
1334413344
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -14429,14 +14429,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1442914429

1443014430
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1443114431

14432-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
14432+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1443314433
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1443414434
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1443514435

1443614436

1443714437

1443814438

14439-
# Dependencies of `io.spine.tools:validation-validator-dependency:2.0.0-SNAPSHOT.373`
14439+
# Dependencies of `io.spine.tools:validation-validator-dependency:2.0.0-SNAPSHOT.374`
1444014440

1444114441
## Runtime
1444214442
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -15261,14 +15261,14 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1526115261

1526215262
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1526315263

15264-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
15264+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1526515265
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1526615266
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1526715267

1526815268

1526915269

1527015270

15271-
# Dependencies of `io.spine.tools:validation-vanilla:2.0.0-SNAPSHOT.373`
15271+
# Dependencies of `io.spine.tools:validation-vanilla:2.0.0-SNAPSHOT.374`
1527215272

1527315273
## Runtime
1527415274
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -16202,6 +16202,6 @@ This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
1620216202

1620316203
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1620416204

16205-
This report was generated on **Wed Dec 10 18:51:38 WET 2025** using
16205+
This report was generated on **Thu Dec 11 20:30:15 WET 2025** using
1620616206
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1620716207
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).

gradle-plugin/build.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import io.spine.dependency.local.Compiler
2828
import io.spine.dependency.local.ToolBase
2929
import io.spine.dependency.local.Validation
30+
import io.spine.gradle.publish.SpinePublishing
31+
import io.spine.gradle.publish.addSourceAndDocJars
3032

3133
plugins {
3234
module
@@ -78,3 +80,23 @@ dependencies {
7880
implementation(Compiler.gradleApi)
7981
implementation(ToolBase.jvmTools)
8082
}
83+
84+
// Change the `artifactId` to have the `validation-` prefix.
85+
// This is needed because this module has custom publication.
86+
afterEvaluate {
87+
publishing {
88+
publications {
89+
named<MavenPublication>("pluginMaven") {
90+
val rootExtension = rootProject.the<SpinePublishing>()
91+
val projectPrefix = rootExtension.artifactPrefix
92+
artifactId = "$projectPrefix${project.name}"
93+
94+
addSourceAndDocJars(project)
95+
}
96+
}
97+
}
98+
99+
val sourcesJar by tasks.getting(Jar::class)
100+
val writeArtifactMeta by tasks.getting
101+
sourcesJar.dependsOn(writeArtifactMeta)
102+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject.
1010
-->
1111
<groupId>io.spine.tools</groupId>
1212
<artifactId>validation</artifactId>
13-
<version>2.0.0-SNAPSHOT.373</version>
13+
<version>2.0.0-SNAPSHOT.374</version>
1414

1515
<inceptionYear>2015</inceptionYear>
1616

version.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
*
3030
* For Spine-based dependencies please see [io.spine.dependency.local.Spine].
3131
*/
32-
val validationVersion by extra("2.0.0-SNAPSHOT.373")
32+
val validationVersion by extra("2.0.0-SNAPSHOT.374")

0 commit comments

Comments
 (0)