www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is it true that dub compiles everything in the source dir whether it's

reply "Gary Willoughby" <dev nomad.so> writes:
Is it true that dub compiles everything in the source dir whether 
it's imported or not?

Using it to compile a project that seems to be the case but i 
want to learn if that's true.

I draw this conclusion when investigating this problem: 
http://forum.dlang.org/thread/fvhdqcjfqfojzsyjpidl forum.dlang.org?page=2#post-qavrnsytpszqiofgavgi:40forum.dlang.org

If it is true then perhaps dub needs to be re-engineered to only 
compile imported source files.
Jan 11 2014
next sibling parent reply Mike Parker <aldacron gmail.com> writes:
On 1/11/2014 9:16 PM, Gary Willoughby wrote:
 Is it true that dub compiles everything in the source dir whether it's
 imported or not?

 Using it to compile a project that seems to be the case but i want to
 learn if that's true.

 I draw this conclusion when investigating this problem:
 http://forum.dlang.org/thread/fvhdqcjfqfojzsyjpidl forum.dlang.org?page=2#post-qavrnsytpszqiofgavgi:40forum.dlang.org


 If it is true then perhaps dub needs to be re-engineered to only compile
 imported source files.
I think adding an "excludedSourceFiles" entry to your package.json is is what you want. See [1]. [1] http://code.dlang.org/package-format
Jan 11 2014
parent reply "Gary Willoughby" <dev nomad.so> writes:
On Saturday, 11 January 2014 at 13:01:26 UTC, Mike Parker wrote:
 I think adding an "excludedSourceFiles" entry to your 
 package.json is is what you want. See [1].

 [1] http://code.dlang.org/package-format
I've seen this but the problem is not with my project but a dependency. I only include two files from the dependency but when my project is compiled the entire source of the dependency is compiled and produces the error.
Jan 11 2014
next sibling parent "Gary Willoughby" <dev nomad.so> writes:
On Saturday, 11 January 2014 at 13:46:51 UTC, Gary Willoughby 
wrote:
 On Saturday, 11 January 2014 at 13:01:26 UTC, Mike Parker wrote:
 I think adding an "excludedSourceFiles" entry to your 
 package.json is is what you want. See [1].

 [1] http://code.dlang.org/package-format
I've seen this but the problem is not with my project but a dependency. I only include two files from the dependency but when my project is compiled the entire source of the dependency is compiled and produces the error.
Actuall i may be able to handle this as a sub configuration: https://gist.github.com/s-ludwig/7916080
Jan 11 2014
prev sibling parent reply "Casper =?UTF-8?B?RsOmcmdlbWFuZCI=?= <shorttail hotmail.com> writes:
On Saturday, 11 January 2014 at 13:46:51 UTC, Gary Willoughby 
wrote:
 I've seen this but the problem is not with my project but a 
 dependency. I only include two files from the dependency but 
 when my project is compiled the entire source of the dependency 
 is compiled and produces the error.
Is that by any chance also why compiling with Dub is slower than just with Dmd? If so, it would be nice to not do for non-release builds.
Jan 11 2014
parent "Gary Willoughby" <dev nomad.so> writes:
On Saturday, 11 January 2014 at 14:10:20 UTC, Casper Færgemand 
wrote:
 On Saturday, 11 January 2014 at 13:46:51 UTC, Gary Willoughby 
 wrote:
 I've seen this but the problem is not with my project but a 
 dependency. I only include two files from the dependency but 
 when my project is compiled the entire source of the 
 dependency is compiled and produces the error.
Is that by any chance also why compiling with Dub is slower than just with Dmd? If so, it would be nice to not do for non-release builds.
Yes probably because with DMD you only specify what you need compiling and RDMD actually parses the imports so it only compiles what is needed. As evidence suggests Dub compiles everything, which is slower and results in larger executables.
Jan 11 2014
prev sibling parent reply "Rene Zwanenburg" <renezwanenburg gmail.com> writes:
On Saturday, 11 January 2014 at 12:16:36 UTC, Gary Willoughby 
wrote:
 Is it true that dub compiles everything in the source dir 
 whether it's imported or not?

 Using it to compile a project that seems to be the case but i 
 want to learn if that's true.

 I draw this conclusion when investigating this problem: 
 http://forum.dlang.org/thread/fvhdqcjfqfojzsyjpidl forum.dlang.org?page=2#post-qavrnsytpszqiofgavgi:40forum.dlang.org

 If it is true then perhaps dub needs to be re-engineered to 
 only compile imported source files.
There's the --rdmd switch to use rdmd for building, so it'll only compile imported files. I'm not sure what it uses as 'main' file though.
Jan 11 2014
parent "Gary Willoughby" <dev nomad.so> writes:
On Saturday, 11 January 2014 at 13:19:10 UTC, Rene Zwanenburg 
wrote:
 There's the --rdmd switch to use rdmd for building, so it'll 
 only compile imported files. I'm not sure what it uses as 
 'main' file though.
Yes, that's what i have to use to build correctly as dub creates errors.
Jan 11 2014