Skip to content

moduleNameAssertAlias vs module name #327

@krystek-dev

Description

@krystek-dev

When ext.moduleNameAssertAlias is set, there is no available to allow dependency by its name. There is available to use moduleNameAssertAlias value ONLY.

I would like to use moduleNameAssertAlias AND module name in regex at the same time.

For example modules:

  • composeApp
  • libUi
  • libImpl
  • testUi
  • testImpl

When add val moduleNameAssertAlias: String by extra("Ui") in shared:libUi gradle module i am not able to use it in allow regex like:

moduleGraphAssert {
    configurations += setOf("commonMainImplementation", "commonMainApi")
    maxHeight = 3
    allowed = arrayOf(
//        ":composeApp -> Ui",
        ":composeApp -> :shared:libUi",
        ".*Ui -> ^(?!.*Ui$).*",
        "^(?!.*Ui).*  -> .*",
    )
    restricted = arrayOf(
    )
    assertOnAnyBuild = true
}

if comment moduleNameAssertAlias in gradle file, the allow array accepts condition: ":composeApp -> :shared:libUi",

But i would like to use in condition moduleNameAssertAlias and module name at the same time to compare them.

The compare string could be Ui"(':shared:libUi') like you write in exception:
[':composeApp' -> ':shared', ':composeApp' -> "Ui"(':shared:libUi')] not allowed by any of [':composeApp -> :shared:libUi', '.*Ui -> ^(?!.*Ui$).*', '^(?!.*Ui).* -> .*']

Example project
MyApplication.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions