This is a dump of my dub-like build tool written in 2019 for my game engine project I was writing in D back then. The codebase has not been cleaned so there might be a lot of uncommented old code and comments everywhere. The main focus of this project was to provide quick compilation times while iterating the project. At the time, building the project with dub used to take up to 10 seconds every time I made a small change to the project. With this tool, if my memory serves me right, it only took 1-2 seconds to build the project (in --buildMode=package
) and start debugging it right away, which was a huge improvement.
Notable differences compared to Dub:
- All packages gets compiled under one shared build directory, nothing is stored elsewhere.
- Compiling and linking are done separately.
- Default build mode splits the compilation in per package basis for better parallelization and faster incremental builds, avoiding the rebuild of whole package in most scenarios.
Compatibility Notes:
- "dflags" do not get translated to other options like in dub, please make sure to use the documented dub options over switches like "-debug", "-version", "-I", "-J", "-unittest", "-betterC" or "-w".
- Separate linking is more strict regards to duplicate object files, which may cause linking issues in some cases.
New features:
--jobs
for more finetuned control over parallelization (uses all cores by default).- Support building executable dependencies.
--buildMode
(--buildModeDeps
for dependencies):=package
: builds each module package in project (default)=project
: builds the whole project (matches dub'sseparate
)=module
: builds each module in project
Implemented Dub features:
- parse dub.json
- parse dub.sdl
- dub.selections.json
- CLI:
- build
- local package
- local subPackage
- dependencies from dub package cache
- cached package
-
--build
-
--force
(also--rebuild
) -
--config
-
--override-config
for dependency -
--compiler
-
--arch
-
--debug
-
--nodeps
? -
--build-mode
(translated to--buildMode
) -
--single
-
--filter-versions
? -
--combined
? -
--parallel
(not needed, replaced by--jobs
)
- run (--run)
-
--temp-build
? -
--rdmd
?
-
- test
-
--main-file
-
--coverage
-
- clean (--clean)
- lint?
- describe
- dustmite?
- dub passthrough for other commands (fetch, add, upgrade, all package management related commands)
- registry related options (used with dub passthrough)
-
--root
-
--annotate
-
--bare
-
--cache
(override dub package cache location)
- build
- Dub package configuration:
- environment variables (
$PACKAGE_DIR
,$ARCH
,$DFLAGS
etc.) - toolchainRequirements
- subPackages
- "path" variant (external recipe)
- in root package
- configurations
- platform-specific options
- buildTypes
- ddoxFilterArgs?
- buildSettings:
- dependencies
- version* (with very basic dependency resolver)
- path
- optional
- default
- systemDependencies?
- targetType
- none
- executable
- staticLibrary
- sourceLibrary
- dynamicLibrary
- targetPath
- workingDirectory
- subConfigurations
- buildRequirements
- buildOptions
- dmd compiler support
- ldc2 compiler support
- gdc compiler support
- libs
- sourceFiles
- sourcePaths
- excludedSourceFiles
- mainSourceFile
- copyFiles
- versions
- debugVersions
- importPaths
- stringImportPaths
- preGenerateCommands
- postGenerateCommands
- preBuildCommands
- postBuildCommands
- preRunCommands
- postRunCommands
- dflags
- lflags
- extraDependencyFiles?
- -versionFilters?
- -debugVersionFilters?
- dependencies
- environment variables (