File tree Expand file tree Collapse file tree 2 files changed +34
-10
lines changed
json-schema-validator-bom Expand file tree Collapse file tree 2 files changed +34
-10
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,34 @@ val javadocJar by tasks.registering(Jar::class) {
99
1010fun getExtraString (name : String ) = ext[name]?.toString()
1111
12+ /* *
13+ * Create a service for collecting the coordinates of all artifacts that should be included in the bom.
14+ */
15+ abstract class BomService : BuildService <BuildServiceParameters .None > {
16+ /* * Coordinates that will be included in the BOM. */
17+ abstract val coordinates: SetProperty <String >
18+ }
19+
20+ val bomService: BomService =
21+ gradle.sharedServices.registerIfAbsent(" bomService" , BomService ::class ).get()
22+
23+ extensions.add(" bomService" , bomService)
24+
25+ /* * Controls whether the current subproject will be included in the kotest-bom. */
26+ val includeInBom: Property <Boolean > =
27+ objects.property<Boolean >().convention(project.name != " json-schema-validator-bom" )
28+
29+ extensions.add<Property <Boolean >>(" includeInBom" , includeInBom)
30+
31+ bomService.coordinates
32+ .addAll(
33+ provider {
34+ project.run { " $group :$name :$version " }
35+ }.zip(includeInBom) { coordinates, include ->
36+ if (include) listOf (coordinates) else emptyList()
37+ },
38+ )
39+
1240afterEvaluate {
1341 publishing {
1442
Original file line number Diff line number Diff line change @@ -3,18 +3,14 @@ plugins {
33 convention.publication
44}
55
6- private val bomProjectName = name
7-
86configurations.api.configure {
97 dependencyConstraints.addAllLater(
10- provider {
11- rootProject.allprojects.filter {
12- it.pluginManager.hasPlugin(" maven-publish" ) &&
13- it.name != bomProjectName
14- }.map {
15- project.dependencies.constraints.create(" ${it.group} :${it.name} :${it.version} " )
16- }
17- },
8+ bomService.coordinates
9+ .map { coordinates ->
10+ coordinates
11+ .distinct()
12+ .map(project.dependencies.constraints::create)
13+ },
1814 )
1915}
2016
You can’t perform that action at this time.
0 commit comments