RejectedSoftware Forums

Sign up

Include files only from specific directory

Currently I have the following directory structure:

src
-folder1
-folder2
-folder3
dub.sdl

How do I convince dub to compile files only from specific directory. I tried this, but it doesn't work, dub compiles everything in "src" folder.

configuration "library" {
    targetType "library"
    targetPath "lib"    
    sourceFiles "src/folder1"
}

configuration "benchmark" {
    targetType "executable"
    targetPath "bin"    
    sourceFiles "src/folder2"    
}

configuration "demo" {
    targetType "executable"
    targetPath "bin"    
    sourceFiles "src/folder3"    
}

I tried also excludeSourceFiles but this is not productive, I have a lot of folders and source files.

Re: Include files only from specific directory

On Sun, 01 Apr 2018 15:45:12 GMT, rumbu wrote:

Currently I have the following directory structure:

src
-folder1
-folder2
-folder3
dub.sdl

How do I convince dub to compile files only from specific directory. I tried this, but it doesn't work, dub compiles everything in "src" folder.

configuration "library" {
    targetType "library"
    targetPath "lib"    
    sourceFiles "src/folder1"
}

configuration "benchmark" {
    targetType "executable"
    targetPath "bin"    
    sourceFiles "src/folder2"    
}

configuration "demo" {
    targetType "executable"
    targetPath "bin"    
    sourceFiles "src/folder3"    
}

I tried also excludeSourceFiles but this is not productive, I have a lot of folders and source files.

I believe the src folder is automatically included if sourcePaths is not specified:

From http://code.dlang.org/package-format?lang=json :

sourcePaths string[] Allows to customize the path where to look for source files (any folder "source" or "src" is automatically used as a source path if no sourcePaths setting is specified) - note that you usually also need to define "importPaths" as "sourcePaths" don't influence those

Instead of sourceFiles perhaps try sourcePaths ?