Skip to content

build.mcpp: two build-dependencies with the same tail (openmui.rules, gongfu.rules) warn on every build though their qualified names differ #852

Open

Description

@Sunrisepeak

What happens

A package has two host-module build-dependencies whose package names share a last segment:

[build-dependencies]
openmui.rules = { path = "../../mcpp/rules", host-module = true }
gongfu.rules  = { path = "../../mgame/gongfu/rules", host-module = true }

Every build of it prints:

warning: build.mcpp: dependency name collides on MCPP_DEP_RULES_DIR (kept '.../mgame/gongfu/rules', ignored '.../mcpp/rules') — rename one dependency to disambiguate

Both rules still work, because each one can ask for itself by its qualified name: mcpp::dep_dir("openmui.rules") gives MCPP_DEP_OPENMUI_RULES_DIR, and the published names include the qualified spelling (#642). But:

  • The warning stays on every build, and the fix it suggests (renaming a package) isn't the fix the user needs.
  • A rule that asks for its bare name, dep_dir("rules"), silently gets the other package's directory. openmui.rules did this until we changed it to look itself up by its qualified name.

Expected

When two visible dependencies share a bare tail but their qualified names differ, the ambiguous bare name could be left unbound, with no warning: neither package can be the bare name. The qualified names stay unique.

A bare dep_dir("rules") would then answer empty, so a rule that asks for its bare name fails visibly instead of reading the other package's directory. The current warning could become a note that says to ask by the qualified name.

Where

src/build/prepare/graph.cpp fillDepDirs (the published names, including the bound tail) and src/build/build_program.cppm (the collision warning on the MCPP_DEP_<NAME>_DIR and _LINKAGE variables).

Seen in

Sunrisepeak/mui (showcase/fighting's build.mcpp, which uses both openmui.rules and gongfu.rules).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions