Skip to content

Commit 6268dce

Browse files
committed
restore project name handling
1 parent 77d1c57 commit 6268dce

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

grails-bom/build.gradle

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,20 @@ tasks.register('extractConstraints', ExtractDependenciesTask).configure { Extrac
101101
it.destination = project.layout.buildDirectory.file('grails-bom-constraints.adoc')
102102
it.platformDefinitions = combinedPlatforms
103103
it.definitions = combinedDependencies
104+
it.projectName = project.name
104105
it.versions = combinedVersions
105-
Map<String, String> artifactIdMappings = [:]
106106
rootProject.subprojects.each { p ->
107107
evaluationDependsOn(p.path)
108-
String artifactId = p.findProperty('pomArtifactId')
109-
if(artifactId) {
110-
artifactIdMappings[p.name] = artifactId
111-
}
112108
}
113-
it.projectArtifactIds.set(artifactIdMappings)
109+
it.projectArtifactIds.set(project.provider{
110+
Map<String, String> artifactIdMappings = [:]
111+
112+
rootProject.subprojects.each { p ->
113+
artifactIdMappings[p.name] = p.findProperty('pomArtifactId') ?: p.name
114+
}
115+
116+
artifactIdMappings
117+
})
114118

115119
it.dependsOn(project.tasks.named('generateMetadataFileForMavenPublication'), project.tasks.named('generatePomFileForMavenPublication'))
116120
}

grails-gradle/docs-core/src/main/groovy/org/apache/grails/gradle/tasks/bom/ExtractDependenciesTask.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ abstract class ExtractDependenciesTask extends DefaultTask {
6565
@Input
6666
abstract MapProperty<String, String> getDefinitions()
6767

68+
@Input
69+
abstract Property<String> getProjectName()
70+
6871
void setConfiguration(NamedDomainObjectProvider<Configuration> config) {
6972
dependencyArtifacts.from(config)
7073
configurationName.set(config.name)
@@ -130,15 +133,14 @@ abstract class ExtractDependenciesTask extends DefaultTask {
130133
String artifactId = constraint.module.name as String
131134
String artifactVersion = constraint.version as String
132135

133-
//TODO: need to look for project property ? or manually find the project?
134136
if (constraint instanceof DefaultProjectDependencyConstraint) {
135137
if(artifactIdMappings.containsKey(constraint.name)) {
136138
artifactId = artifactIdMappings.get(constraint.name)
137139
}
138140
}
139141

140142
ExtractedDependencyConstraint extractConstraint = propertyNameCalculator.calculate(groupId, artifactId, artifactVersion, false) ?: new ExtractedDependencyConstraint(groupId: groupId, artifactId: artifactId, version: artifactVersion)
141-
extractConstraint.source = constraint.name // this will be the project name
143+
extractConstraint.source = getProjectName().get()
142144
constraints.put(new CoordinateHolder(groupId: extractConstraint.groupId, artifactId: extractConstraint.artifactId), extractConstraint)
143145
}
144146
}

0 commit comments

Comments
 (0)