Configure default build options for DUB without affecting other build types

289 views Asked by At

If I define "buildOptions": ["unittests"] in the root of dub.json, I get unittests enabled for all builds, e.g. also for release builds. How can enable unittests only for the default build? I.e the build that is triggered by the command dub?

1

There are 1 answers

3
Colonel Thirty Two On

Try adding this to dub.json:

"buildTypes": {
    "plain": {
        "buildOptions": ["unittests", "debugMode", "debugInfo"]
    },
}

Note that if this is a library and you release it, then unit tests will be enabled for your library if the library user builds their project with the plain configuration, which is probably not what you want.