LinuxCommandLibrary

dub

D language package manager and build tool

TLDR

Build project

$ dub build
copy
Run project
$ dub run
copy
Initialize new project
$ dub init [name]
copy
Add dependency
$ dub add [package]
copy
Update dependencies
$ dub upgrade
copy
Run tests
$ dub test
copy
Build documentation
$ dub build --build=docs
copy
Fetch dependencies only
$ dub fetch [package]
copy

SYNOPSIS

dub command [options]

DESCRIPTION

dub is the official package manager and build tool for the D programming language. It handles dependency management, project compilation, testing, and distribution, providing a complete project lifecycle management solution for D developers.
The tool uses a JSON or SDL (Simple Declarative Language) configuration file (dub.json or dub.sdl) to describe project structure, dependencies, build configurations, and metadata. Dependencies are automatically fetched from the DUB registry (code.dlang.org) and cached locally.
dub supports multiple build configurations (debug, release, unittest), allowing developers to define different compiler flags and dependencies for various scenarios. It can generate project files for IDEs and integrates with D compilers (dmd, ldc, gdc) automatically.
The package ecosystem revolves around semantic versioning, with dub resolving dependency trees and selecting compatible versions. Projects can specify exact versions, version ranges, or branch references for dependencies. The upgrade command updates dependencies while respecting version constraints.

CONFIGURATION

dub.json or dub.sdl

Project configuration file defining dependencies, build settings, and metadata.
~/.dub/settings.json
User-level DUB settings including custom registry URLs and default paths.

SUBCOMMANDS

build

Build project.
run
Build and run.
test
Run unit tests.
init
Initialize new project.
add
Add dependency.
remove
Remove dependency.
upgrade
Upgrade dependencies.
fetch
Fetch package.
clean
Clean build artifacts.
describe
Show project description.

SEE ALSO

dmd(1), ldc(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community