dlang / dub

Package and build management system for D
MIT License
673 stars 230 forks source link

dub fails to build docs if there are ddoc warnings in dependencies' source #2686

Open zorael opened 1 year ago

zorael commented 1 year ago

System information

Bug Description

When building a package with -b docs, all of its dependencies are also built this way, and any warnings in them (e.g. parameter mismatches) will halt the process if the failing dependency's dub.sdl doesn't have buildRequirements "allowWarnings". Even if you add it to your own dub.sdl, it will still exit if the dependency at fault doesn't have it too. There is no way for you to build your docs until the dependency fixes its source. Not even DFLAGS=-wi seems to work.

How to reproduce?

  1. Create a local targetType library dub package (e.g. a) and do --add-local to add it
  2. Intentionally document a function in it wrong, such as a parameter count mismatch
  3. Create a second targetType executable dub package (e.g. b)
  4. Add the library package a as a dependency to b
  5. Build b docs with dub build -b docs
  6. Get "Error: warnings are treated as errors" due to a bad ddoc

Expected Behavior

  1. One of...
    • Dependencies' docs aren't also built? I just want b docs
    • Dependencies' docs warnings are gagged unconditionally
    • A configuration "docs" with buildRequirements "allowWarnings" in the importing package (e.g. b) applies to dependencies' warnings too. Not ideal though.
    • ...

Logs

a/dub.sdl:

name "a"
description "A minimal D application."
authors "JR"
copyright "Copyright © 2023, JR"
license "proprietary"
targetType "library"

a/source/lib.d:

module a;

/++
    Blah

    Params:
        foo = foo
        bar = bar
 +/
void foo(int foo) {}

b/dub.sdl:

name "b"
description "A minimal D application."
authors "JR"
copyright "Copyright © 2023, JR"
license "proprietary"
dependency "a" version="*"
buildRequirements "allowWarnings"

b/source/app.d:

void main() {}

Building b docs:

~/src/tests/b $ dub build -b docs
Starting Performing "docs" build using /usr/bin/dmd for x86_64.
Building a ~master [library]
../a/source/lib.d(10,6): Warning: Ddoc: function declaration has no parameter 'bar'
../a/source/lib.d(10,6): Warning: Ddoc: parameter count mismatch, expected 1, got 2
Error: warnings are treated as errors
Use -wi if you wish to treat warnings only as informational.
Error /usr/bin/dmd failed with exit code 1.