Dub importPath and sourcePath variables

Max v.bone at uq.edu.au
Wed Aug 28 00:26:24 UTC 2019


Hello,

I am having a problem working with custom build types in Dub.

For my project, when I perform a regular build, all of my source 
code is contained in ./source or ~/.dub/packages/<package-name>.
However, I want to specify a custom build type (called 'tests') 
that imports modules from the additional directory ./tests.
Accordingly, my dub.json file is structured as follows:

{
	"name": "q1dcfd",
	"authors": [
		"Tom Reddell", "Viv Bone"
	],
	"description" : "Quasi One Dimensional Compressible Flow 
Dynamics",
	"copyright"   : "Copyright © 2018, Tom Reddell",
	"license"     : "MIT",
	"targetType"  : "executable",
	"sourceFiles"         : ["$CPD/source/cpp_layer.o", 
"$CPD/source/libCoolProp.a"],
     "excludedSourceFiles" : ["source/experimental/*"],
	"dependencies": {
         "mir"           : "~>3.2.0",
         "mir-algorithm" : "~>3.4.14",
         "lubeck"        : "~>1.1.2",
		"coolprop"      : "*"
	},
     "buildTypes" : {
         "tests" : {
             "buildOptions"        : ["unittests", "debugMode"],
             "importPaths"         : ["tests/", "source/"],
             "sourcePaths"         : ["tests/", "source/"],
             "excludedSourceFiles" : ["source/experimental/*"]
         }
     }
}

When I manually assign my "importPaths" and "sourcePaths" 
variables during a "tests" build, I overwrite the values in these 
variables that have been automatically added due to my 
dependencies, causing the build to fail.
Is there a way that I can append "tests" to importPaths and 
sourcePaths, rather than overwriting them completely?

Regards,

Viv



More information about the Digitalmars-d-learn mailing list