Skip to content

Commit

Permalink
ide/ProjectView: Fixed handling of exclusions when files is in multip…
Browse files Browse the repository at this point in the history
…le projects and excluded only in some configs (#746)
  • Loading branch information
jerstlouis committed Apr 16, 2012
1 parent 3858395 commit 36e91de
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 40 deletions.
16 changes: 13 additions & 3 deletions ide/src/ide.ec
Original file line number Diff line number Diff line change
Expand Up @@ -2381,9 +2381,19 @@ class IDEWorkSpace : Window
{
if(projectView)
{
ProjectNode node = projectView.GetNodeFromWindow(activeClient, null);
if(node)
projectView.Compile(node);
bool result = false;
ProjectNode node = null;
for(p : ide.workspace.projects)
{
node = projectView.GetNodeFromWindow(activeClient, p);
if(node && projectView.Compile(node))
{
result = true;
break;
}
}
if(!result && node)
ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
}
return true;
}
Expand Down
81 changes: 44 additions & 37 deletions ide/src/project/ProjectView.ec
Original file line number Diff line number Diff line change
Expand Up @@ -920,45 +920,14 @@ class ProjectView : Window
return true;
}

void Compile(ProjectNode node)
bool Compile(ProjectNode node)
{
bool result = false;
char fileName[MAX_LOCATION];
char extension[MAX_EXTENSION];
Window document;
Project prj = node.project;
ProjectConfig config = prj.config;
CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
DirExpression objDir = prj.GetObjDir(compiler, config);

strcpy(fileName, prj.topNode.path);
PathCatSlash(fileName, objDir.dir);
PathCatSlash(fileName, node.name);
StripExtension(fileName);
strcat(fileName, ".o");
if(FileExists(fileName))
DeleteFile(fileName);

GetExtension(node.name, extension);
if(!strcmp(extension, "ec"))
{
// Delete generated C file
strcpy(fileName, prj.topNode.path);
PathCat(fileName, objDir.dir);
PathCat(fileName, node.name);
StripExtension(fileName);
strcat(fileName, ".c");
if(FileExists(fileName))
DeleteFile(fileName);

// Delete symbol file
strcpy(fileName, prj.topNode.path);
PathCat(fileName, node.path);
PathCat(fileName, node.name);
StripExtension(fileName);
strcat(fileName, ".sym");
if(FileExists(fileName))
DeleteFile(fileName);
}

stopBuild = false;

Expand All @@ -981,6 +950,43 @@ class ProjectView : Window
{
if(!node.GetIsExcluded(config))
{
// Delete intermedaite files
{
char extension[MAX_EXTENSION];
DirExpression objDir = prj.GetObjDir(compiler, config);

strcpy(fileName, prj.topNode.path);
PathCatSlash(fileName, objDir.dir);
PathCatSlash(fileName, node.name);
StripExtension(fileName);
strcat(fileName, ".o");
if(FileExists(fileName))
DeleteFile(fileName);

GetExtension(node.name, extension);
if(!strcmp(extension, "ec"))
{
// Delete generated C file
strcpy(fileName, prj.topNode.path);
PathCat(fileName, objDir.dir);
PathCat(fileName, node.name);
StripExtension(fileName);
strcat(fileName, ".c");
if(FileExists(fileName))
DeleteFile(fileName);

// Delete symbol file
strcpy(fileName, prj.topNode.path);
PathCat(fileName, node.path);
PathCat(fileName, node.name);
StripExtension(fileName);
strcat(fileName, ".sym");
if(FileExists(fileName))
DeleteFile(fileName);
}

delete objDir;
}
buildInProgress = compilingFile;
ide.AdjustBuildMenus();

Expand All @@ -995,12 +1001,12 @@ class ProjectView : Window
prj.Compile(node, compiler, config);
buildInProgress = none;
ide.AdjustBuildMenus();

result = true;
}
else
ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
}
delete objDir;
delete compiler;
return result;
}

bool ProjectNewFile(MenuItem selection, Modifiers mods)
Expand Down Expand Up @@ -1179,7 +1185,8 @@ class ProjectView : Window
if(row)
{
ProjectNode node = (ProjectNode)row.tag;
Compile(node);
if(!Compile(node))
ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
}
return true;
}
Expand Down

0 comments on commit 36e91de

Please sign in to comment.