Hi 👋 ,
I’m using the plugin with a setup roughly like this:
moduleGraphAssert {
allowed = arrayOf(
":lib:.* -> :libraries",
":lib:.* -> :libraries-testing",
":lib:.* -> :lib:.*",
":feature:.* -> :libraries",
":feature:.* -> :libraries-testing",
":feature:.* -> :lib:.*",
":libraries-testing -> :.*",
// Expected this to work for the root project:
": -> :.*",
)
restricted = arrayOf(
":lib:.* -X> :feature:.*",
":feature:.* -X> :feature:.*",
)
}
The root project has dependencies on feature/lib modules.
I expected the root project to be matched as :, but the assertion failed with entries like:
'root library' -> ':lib:authorization'
'root library' -> ':feature:onboarding'
(note the two empty spaces here between root and library.
So I had to use this instead:
The double space seems to come from moduleDisplayName():
fun Project.moduleDisplayName(): String {
return displayName.replace("project", "")
.replace("'", "")
.trim()
}
For a root project display name like root project '[name]' instead of project ':[name]'.
So the root results in root [name].
Questioning the displayName here at all, because basically you want to use Project.path, no? 🤔
Anyways, another solution would be to check if its the root project (this.name == project.rootProject.name or so 🤷 ) and then return maybe just root or even :...
Hi 👋 ,
I’m using the plugin with a setup roughly like this:
moduleGraphAssert { allowed = arrayOf( ":lib:.* -> :libraries", ":lib:.* -> :libraries-testing", ":lib:.* -> :lib:.*", ":feature:.* -> :libraries", ":feature:.* -> :libraries-testing", ":feature:.* -> :lib:.*", ":libraries-testing -> :.*", // Expected this to work for the root project: ": -> :.*", ) restricted = arrayOf( ":lib:.* -X> :feature:.*", ":feature:.* -X> :feature:.*", ) }The root project has dependencies on feature/lib modules.
I expected the root project to be matched as
:, but the assertion failed with entries like:(note the two empty spaces here between
rootandlibrary.So I had to use this instead:
"root library -> :.*"The double space seems to come from
moduleDisplayName():For a root project display name like
root project '[name]'instead ofproject ':[name]'.So the root results in
root [name].Questioning the
displayNamehere at all, because basically you want to useProject.path, no? 🤔Anyways, another solution would be to check if its the
rootproject (this.name == project.rootProject.name or so 🤷 ) and then return maybe justrootor even:...