Skip to content

Commit 8c8a8b0

Browse files
Merge pull request #1507 from IETS3/bundled-deps-as-provided-in-pom
Bundled deps as provided in pom
2 parents ca50bfb + 42d584c commit 8c8a8b0

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ The project does _not_ follow Semantic Versioning and the changes are documented
77

88
## November 2025
99

10+
### Added
11+
- The Maven POM now contains all bundled JARs as dependencies with `provided` scope to help with automated license and
12+
vulnerability scanning.
13+
14+
1015
### Fixed
1116
- A bug was fixed that caused the editor of NumberLiteral to break if a property macro was used for its value.
1217

build.gradle

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,24 +134,19 @@ class BundledDep {
134134
String libSolutionName
135135
Closure configClosure = { transitive = false }
136136
// in case a legacy dependency has a broken artifact name, e.g. w/o extension
137-
String jarNameOverride
138137
String getConfigName() {
139138
name + '_bundled'
140139
}
141140
String getResolveTaskName() {
142141
'resolve_' + this.configName
143142
}
144-
BundledDep overrideArtifactName(String artifactName) {
145-
this.jarNameOverride = artifactName
146-
this
147-
}
148143
}
149144

150145
def bundledDeps = [
151146
new BundledDep('pcollections', ['org.pcollections:pcollections:4.0.2'], 'org.iets3.core.expr.base.collections.stubs'),
152147
new BundledDep('bigMath', ['ch.obermuhlner:big-math:2.3.2'], 'org.iets3.core.expr.math.interpreter'),
153148
new BundledDep('functionalJava', ['org.functionaljava:functionaljava:5.0'], 'org.iets3.core.expr.genjava.functionalJava'),
154-
new BundledDep('cpsSuite', ['io.takari.junit:takari-cpsuite:1.2.7'], 'org.iets3.opensource.build.gentests.rt').overrideArtifactName('takari-cpsuite.jar')
149+
new BundledDep('cpsSuite', ['io.takari.junit:takari-cpsuite:1.2.7@jar'], 'org.iets3.opensource.build.gentests.rt')
155150
]
156151

157152
bundledDeps.each { dep ->
@@ -171,9 +166,7 @@ bundledDeps.each { dep ->
171166
rename { filename ->
172167
def ra = configurations.getByName(dep.configName).resolvedConfiguration.resolvedArtifacts.find { ResolvedArtifact ra -> ra.file.name == filename }
173168
String finalName
174-
if (dep.jarNameOverride != null) {
175-
finalName = dep.jarNameOverride
176-
} else if (ra.classifier != null) {
169+
if (ra.classifier != null) {
177170
finalName = "${ra.name}-${ra.classifier}.${ra.extension}"
178171
} else {
179172
finalName = "${ra.name}.${ra.extension}"
@@ -383,7 +376,7 @@ task packageDistroWithDependencies(type: Zip, dependsOn: buildDistroWithDependen
383376

384377
assemble.dependsOn packageLanguages, packageTests
385378

386-
static def addDependency(Object pom, Object groupId, Object artifactId, Object version, Object type = null) {
379+
static def addDependency(Object pom, Object groupId, Object artifactId, Object version, Object type = null, String scope = null) {
387380
pom.withXml { XmlProvider prov ->
388381
Node root = prov.asNode()
389382
Node deps = root.dependencies[0] ?: root.appendNode("dependencies")
@@ -394,14 +387,16 @@ static def addDependency(Object pom, Object groupId, Object artifactId, Object v
394387
if (type != null) {
395388
dep.appendNode("type", type)
396389
}
390+
if (scope != null) {
391+
dep.appendNode("scope", scope)
392+
}
397393
}
398394
}
399395

400-
static def addDependency(Object pom, Configuration config) {
396+
static def addDependency(MavenPom pom, Configuration config, String scope = null) {
401397
config.resolvedConfiguration.firstLevelModuleDependencies.each {
402-
addDependency(pom, it.moduleGroup, it.moduleName, it.moduleVersion, it.moduleArtifacts[0].type)
398+
addDependency(pom, it.moduleGroup, it.moduleName, it.moduleVersion, it.moduleArtifacts[0].type, scope)
403399
}
404-
405400
}
406401

407402
ext.additionalPomInfo = {
@@ -425,6 +420,12 @@ ext.additionalPomInfo = {
425420
}
426421
}
427422

423+
ext.addBundledDependencies = { MavenPom pom ->
424+
bundledDeps.each {
425+
addDependency(pom, configurations[it.configName], 'provided')
426+
}
427+
}
428+
428429
publishing {
429430
repositories {
430431
maven {
@@ -458,6 +459,8 @@ publishing {
458459

459460
addDependency(pom, configurations.languageLibs)
460461

462+
pom addBundledDependencies
463+
461464
pom additionalPomInfo
462465
}
463466

0 commit comments

Comments
 (0)