Skip to content

Commit 3005c2d

Browse files
Merge pull request #51 from SpineEventEngine/add-user-classpath-ext
Add `Project.addUserClasspathDependency()` extension
2 parents 6ae19d1 + 187a3c9 commit 3005c2d

File tree

4 files changed

+49
-24
lines changed

4 files changed

+49
-24
lines changed

dependencies.md

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

22

3-
# Dependencies of `io.spine.tools:compiler-api:2.0.0-SNAPSHOT.034`
3+
# Dependencies of `io.spine.tools:compiler-api:2.0.0-SNAPSHOT.035`
44

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

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

1134-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
1134+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
11351135
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
11361136
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
11371137

11381138

11391139

11401140

1141-
# Dependencies of `io.spine.tools:compiler-api-tests:2.0.0-SNAPSHOT.034`
1141+
# Dependencies of `io.spine.tools:compiler-api-tests:2.0.0-SNAPSHOT.035`
11421142

11431143
## Runtime
11441144
## Compile, tests, and tooling
@@ -1504,14 +1504,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
15041504

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

1507-
This report was generated on **Thu Dec 04 18:50:05 WET 2025** using
1507+
This report was generated on **Mon Dec 08 20:54:59 WET 2025** using
15081508
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
15091509
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
15101510

15111511

15121512

15131513

1514-
# Dependencies of `io.spine.tools:compiler-backend:2.0.0-SNAPSHOT.034`
1514+
# Dependencies of `io.spine.tools:compiler-backend:2.0.0-SNAPSHOT.035`
15151515

15161516
## Runtime
15171517
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -2646,14 +2646,14 @@ This report was generated on **Thu Dec 04 18:50:05 WET 2025** using
26462646

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

2649-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
2649+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
26502650
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
26512651
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
26522652

26532653

26542654

26552655

2656-
# Dependencies of `io.spine.tools:compiler-cli:2.0.0-SNAPSHOT.034`
2656+
# Dependencies of `io.spine.tools:compiler-cli:2.0.0-SNAPSHOT.035`
26572657

26582658
## Runtime
26592659
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -3837,14 +3837,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
38373837

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

3840-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
3840+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
38413841
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
38423842
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
38433843

38443844

38453845

38463846

3847-
# Dependencies of `io.spine.tools:compiler-gradle-api:2.0.0-SNAPSHOT.034`
3847+
# Dependencies of `io.spine.tools:compiler-gradle-api:2.0.0-SNAPSHOT.035`
38483848

38493849
## Runtime
38503850
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -4909,14 +4909,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
49094909

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

4912-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
4912+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
49134913
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
49144914
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
49154915

49164916

49174917

49184918

4919-
# Dependencies of `io.spine.tools:compiler-gradle-plugin:2.0.0-SNAPSHOT.034`
4919+
# Dependencies of `io.spine.tools:compiler-gradle-plugin:2.0.0-SNAPSHOT.035`
49204920

49214921
## Runtime
49224922
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -6029,14 +6029,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
60296029

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

6032-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
6032+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
60336033
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
60346034
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
60356035

60366036

60376037

60386038

6039-
# Dependencies of `io.spine.tools:compiler-jvm:2.0.0-SNAPSHOT.034`
6039+
# Dependencies of `io.spine.tools:compiler-jvm:2.0.0-SNAPSHOT.035`
60406040

60416041
## Runtime
60426042
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -7188,14 +7188,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
71887188

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

7191-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
7191+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
71927192
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
71937193
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
71947194

71957195

71967196

71977197

7198-
# Dependencies of `io.spine.tools:compiler-params:2.0.0-SNAPSHOT.034`
7198+
# Dependencies of `io.spine.tools:compiler-params:2.0.0-SNAPSHOT.035`
71997199

72007200
## Runtime
72017201
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -8318,14 +8318,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
83188318

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

8321-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
8321+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
83228322
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
83238323
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
83248324

83258325

83268326

83278327

8328-
# Dependencies of `io.spine.tools:compiler-protoc-plugin:2.0.0-SNAPSHOT.034`
8328+
# Dependencies of `io.spine.tools:compiler-protoc-plugin:2.0.0-SNAPSHOT.035`
83298329

83308330
## Runtime
83318331
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -9202,14 +9202,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
92029202

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

9205-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
9205+
This report was generated on **Mon Dec 08 20:55:01 WET 2025** using
92069206
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
92079207
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
92089208

92099209

92109210

92119211

9212-
# Dependencies of `io.spine.tools:compiler-test-env:2.0.0-SNAPSHOT.034`
9212+
# Dependencies of `io.spine.tools:compiler-test-env:2.0.0-SNAPSHOT.035`
92139213

92149214
## Runtime
92159215
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -10340,14 +10340,14 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
1034010340

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

10343-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
10343+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
1034410344
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1034510345
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
1034610346

1034710347

1034810348

1034910349

10350-
# Dependencies of `io.spine.tools:compiler-testlib:2.0.0-SNAPSHOT.034`
10350+
# Dependencies of `io.spine.tools:compiler-testlib:2.0.0-SNAPSHOT.035`
1035110351

1035210352
## Runtime
1035310353
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.20.0.
@@ -11585,6 +11585,6 @@ This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
1158511585

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

11588-
This report was generated on **Thu Dec 04 18:50:06 WET 2025** using
11588+
This report was generated on **Mon Dec 08 20:55:02 WET 2025** using
1158911589
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
1159011590
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).

gradle-api/src/main/kotlin/io/spine/tools/compiler/gradle/api/ProjectExts.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ package io.spine.tools.compiler.gradle.api
2929
import io.spine.tools.compiler.params.Directories.COMPILER_WORKING_DIR
3030
import io.spine.tools.gradle.lib.spineExtension
3131
import io.spine.tools.gradle.root.rootWorkingDir
32+
import io.spine.tools.meta.MavenArtifact
3233
import java.io.File
3334
import java.nio.file.Path
3435
import org.gradle.api.Project
36+
import org.gradle.api.artifacts.Dependency
3537
import org.gradle.api.file.Directory
3638
import org.gradle.api.tasks.SourceSet
3739

@@ -64,3 +66,26 @@ public fun Project.generatedDir(sourceSet: SourceSet, language: String = ""): Fi
6466
val path = generatedDir.resolve("${sourceSet.name}/$language")
6567
return path.toFile()
6668
}
69+
70+
/**
71+
* Adds the given artifacts to the [spineCompiler][Names.USER_CLASSPATH_CONFIGURATION]
72+
* configuration of this project.
73+
*/
74+
public fun Project.addUserClasspathDependency(vararg artifacts: MavenArtifact): Unit =
75+
artifacts.forEach {
76+
addDependency(Names.USER_CLASSPATH_CONFIGURATION, it)
77+
}
78+
79+
private fun Project.addDependency(configuration: String, artifact: MavenArtifact) {
80+
val dependency = findDependency(artifact) ?: artifact.coordinates
81+
dependencies.add(configuration, dependency)
82+
}
83+
84+
private fun Project.findDependency(artifact: MavenArtifact): Dependency? {
85+
val dependencies = configurations.flatMap { c -> c.dependencies }
86+
val found = dependencies.firstOrNull { d ->
87+
artifact.group == d.group // `d.group` could be `null`.
88+
&& artifact.name == d.name
89+
}
90+
return found
91+
}

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>spine-compiler</artifactId>
13-
<version>2.0.0-SNAPSHOT.034</version>
13+
<version>2.0.0-SNAPSHOT.035</version>
1414

1515
<inceptionYear>2015</inceptionYear>
1616

version.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* This version is also used by integration test projects.
3131
* E.g. see `tests/consumer/build.gradle.kts`.
3232
*/
33-
val compilerVersion: String by extra("2.0.0-SNAPSHOT.034")
33+
val compilerVersion: String by extra("2.0.0-SNAPSHOT.035")
3434

3535
/**
3636
* The version, same as [compilerVersion], which is used for publishing

0 commit comments

Comments
 (0)