jraska / jraska/modules-graph-assert

moduleNameAssertAlias vs module name

Open
#327 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v3.0+- Breaking change
Dominant language
Kotlin
Stars
640
Forks
35
Avg merge
2d 21h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the attached MyApplication.zip and the moduleGraphAssert configuration shown in the report. Trace how moduleNameAssertAlias and the module name are represented when allow patterns are matched. Done means a rule can compare both forms in one expression while existing alias-only and module-name-only patterns continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.