Skip to content

Dub warning: sub-package refs should use path to dependency dir, not packagename:subpackage #329

@AMDphreak

Description

@AMDphreak

Summary

When projects depend on unit-threaded (e.g. transitively via dlangui), dub upgrade and dub build emit warnings:

Warning Sub package unit-threaded:exception, referenced by unit-threaded:assertions dub.package_.Package must be referenced using the path to its base package
Warning Sub package unit-threaded:from, referenced by unit-threaded:exception dub.package_.Package must be referenced using the path to its base package
...

DUB expects sub-package references to use the path to the dependency's directory rather than the packagename:subpackage form with a path to the root.

Minimal reproduction

  1. Create a project that depends on a package pulling in unit-threaded (e.g. dlangui).
  2. Run dub upgrade or dub build.

Expected

No DUB sub-package warnings.

Actual

Multiple warnings like:

Warning Sub package unit-threaded:exception, referenced by unit-threaded:assertions dub.package_.Package must be referenced using the path to its base package

Proposed fix

Change each sub-package's dub.sdl to use direct path references to sibling sub-packages:

From To
dependency "unit-threaded:from" path="../.." dependency "from" path="../from"
dependency "unit-threaded:exception" path="../.." dependency "exception" path="../exception"
dependency "unit-threaded:assertions" path="../.." dependency "assertions" path="../assertions"
dependency "unit-threaded:runner" path="../.." dependency "runner" path="../runner"

(And similarly for mocks, property, integration, autorunner, behave.)

This eliminates all warnings. dub build and dub test continue to work as before.

Environment

  • DUB 1.41.0 (and likely earlier)
  • Windows 11 / PowerShell 7
  • unit-threaded 0.7.55 (transitive dependency)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions