add dependency projects to import paths when running DCD

This commit is contained in:
Vadim Lopatin 2015-02-26 17:52:41 +03:00
parent cadd2abf84
commit fc419405ea
3 changed files with 25 additions and 2 deletions

View File

@ -72,7 +72,7 @@
<debuglevel>0</debuglevel>
<debugids>DebugInfo DCD</debugids>
<versionlevel>0</versionlevel>
<versionids>Unicode USE_FREETYPE USE_LIBDPARSE USE_MAGO</versionids>
<versionids>Unicode USE_FREETYPE</versionids>
<dump_source>0</dump_source>
<mapverbosity>3</mapverbosity>
<createImplib>0</createImplib>

View File

@ -83,7 +83,7 @@ class DSourceEdit : SourceEdit {
/// returns project import paths - if file from project is opened in current editor
string[] importPaths() {
if (_projectSourceFile)
return _projectSourceFile.project.sourcePaths ~ _projectSourceFile.project.builderSourcePaths;
return _projectSourceFile.project.importPaths;
return null;
}

View File

@ -259,6 +259,29 @@ class Project : WorkspaceItem {
return _builderSourcePaths;
}
private static void addUnique(ref string[] dst, string[] items) {
foreach(item; items) {
bool found = false;
foreach(existing; dst) {
if (item.equal(existing)) {
found = true;
break;
}
}
if (!found)
dst ~= item;
}
}
@property string[] importPaths() {
string[] res;
addUnique(res, sourcePaths);
addUnique(res, builderSourcePaths);
foreach(dep; _dependencies) {
addUnique(res, dep.sourcePaths);
}
return res;
}
string relativeToAbsolutePath(string path) {
if (isAbsolute(path))
return path;