Browse Source

HPCC-16908 C++ compile failures prevent c++ files being added as helpers

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 years ago
parent
commit
bc5a4e0044
2 changed files with 13 additions and 0 deletions
  1. 4 0
      common/workunit/workunit.cpp
  2. 9 0
      ecl/eclccserver/eclccserver.cpp

+ 4 - 0
common/workunit/workunit.cpp

@@ -9597,6 +9597,10 @@ void CLocalWUQuery::addAssociatedFile(WUFileType type, const char * name, const
 {
     CriticalBlock block(crit);
     loadAssociated();
+    StringBuffer xpath;
+    xpath.append("Associated/File[@filename=\"").append(name).append("\"]");
+    if (p->hasProp(xpath))
+        return;
     if (!associated.length())
         p->addPropTree("Associated");
     IPropertyTree *pl = p->queryPropTree("Associated");

+ 9 - 0
ecl/eclccserver/eclccserver.cpp

@@ -177,6 +177,7 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter,
     StringAttr wuid;
     Owned<IWorkUnit> workunit;
     StringBuffer idxStr;
+    StringArray filesSeen;
 
     virtual void reportError(IException *e)
     {
@@ -188,6 +189,7 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter,
     {
         // A typical error looks like this: stdin:(385,29): warning C1041: Record doesn't have an explicit maximum record size
         // we will also see (and want to skip) nn error(s), nn warning(s)
+        // Errors reported in generated c++ files are a bit special - we want to add the generated c++ file (if it still exists) to the workunit
         RegExpr errCount, errParse, timings;
         timings.init("^<stat");
         errParse.init("^<exception");
@@ -214,6 +216,13 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter,
             {
                 Owned<IError> error = createError(exception);
                 addWorkunitException(workunit, error, false);
+                const char *filename = exception->queryProp("@filename");
+                StringArray filesSeen;
+                if (filename && filesSeen.appendUniq(filename) && endsWithIgnoreCase(filename, ".cpp") && checkFileExists(filename))
+                {
+                    Owned<IWUQuery> query = workunit->updateQuery();
+                    associateLocalFile(query, FileTypeCpp, filename, pathTail(filename), 0, 0, 0);
+                }
             }
             else
                 DBGLOG("Unrecognised error: %s", errStr);