Skip to content

Commit

Permalink
Do not fail for duplicated project names (#113)
Browse files Browse the repository at this point in the history
See #108
  • Loading branch information
jjohannes authored Jun 4, 2024
1 parent c3c8b51 commit ab781a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private String toProjectName(String moduleNameSuffix) {
public Provider<Dependency> create(String moduleName, SourceSet sourceSetWithModuleInfo) {
return getProviders().provider(() -> {
Map<String, String> allProjectNamesAndGroups = getProject().getRootProject().getSubprojects().stream().collect(
Collectors.toMap(Project::getName, p -> (String) p.getGroup()));
Collectors.toMap(Project::getName, p -> (String) p.getGroup(), (a, b) -> a));

Provider<String> coordinates = getModuleNameToGA().getting(moduleName).orElse(mapByPrefix(getProviders().provider(() -> moduleName)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,31 @@ class LocalModuleMappingsTest extends Specification {
then:
runner(false, 'build').build()
}

def "does not fail if there are two project with same name (but different path)"() {
when:
libModuleInfoFile << '''
module org.gradlex.test.lib {
requires org.gradlex.test.anotherlib;
}
'''
settingsFile << 'include("another:lib")'
file("another/lib/build.gradle.kts") << '''
plugins {
id("org.gradlex.java-module-dependencies")
id("java-library")
}
group = "another"
'''
file("another/lib/src/main/java/module-info.java") << '''
module org.gradlex.test.anotherlib { }
'''
file("gradle/modules.properties") << '''
org.gradlex.test.anotherlib=another:lib
'''
then:
build()
}
}

0 comments on commit ab781a9

Please sign in to comment.