Просмотр исходного кода

Merge pull request #5671 from ghalliday/issue9501

HPCC-9501 Allow ECLIDE to indicate a query is not assocated with a file

Reviewed-By: Gordon Smith <gordon.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 лет назад
Родитель
Сommit
3f7223e5c0
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      ecl/eclcc/eclcc.cpp

+ 10 - 4
ecl/eclcc/eclcc.cpp

@@ -256,6 +256,7 @@ public:
         optSaveQueryText = false;
         optGenerateHeader = false;
         optShowPaths = false;
+        optNoSourcePath = false;
         optTargetClusterType = HThorCluster;
         optTargetCompiler = DEFAULT_COMPILER;
         optThreads = 0;
@@ -372,6 +373,7 @@ protected:
     bool optLegacyWhen;
     bool optGenerateHeader;
     bool optShowPaths;
+    bool optNoSourcePath;
     int argc;
     const char **argv;
 };
@@ -1289,7 +1291,7 @@ void EclCC::processFile(EclCompileInstance & instance)
     const char * curFilename = instance.inputFile->queryFilename();
     assertex(curFilename);
 
-    Owned<ISourcePath> sourcePath = createSourcePath(curFilename);
+    Owned<ISourcePath> sourcePath = optNoSourcePath ? NULL : createSourcePath(curFilename);
     Owned<IFileContents> queryText = createFileContentsFromFile(curFilename, sourcePath);
     const char * queryTxt = queryText->getText();
     if (optArchive || optGenerateDepend)
@@ -1327,12 +1329,12 @@ void EclCC::processFile(EclCompileInstance & instance)
         }
         else
         {
-            withinRepository = !inputFromStdIn && checkWithinRepository(attributePath, curFilename);
+            withinRepository = !inputFromStdIn && !optNoSourcePath && checkWithinRepository(attributePath, curFilename);
         }
 
 
         StringBuffer expandedSourceName;
-        if (!inputFromStdIn)
+        if (!inputFromStdIn && !optNoSourcePath)
             makeAbsolutePath(curFilename, expandedSourceName);
         else
             expandedSourceName.append(curFilename);
@@ -1358,7 +1360,7 @@ void EclCC::processFile(EclCompileInstance & instance)
         {
             //Ensure that $ is valid for any file submitted - even if it isn't in the include direcotories
             //Disable this for the moment when running the regression suite.
-            if (!optBatchMode && !withinRepository && !inputFromStdIn && !optLegacyImport)
+            if (!optBatchMode && !withinRepository && !inputFromStdIn && !optNoSourcePath && !optLegacyImport)
             {
                 //Associate the contents of the directory with an internal module called _local_directory_
                 //(If it was root it might override existing root symbols).  $ is the only public way to get at the symbol
@@ -1854,6 +1856,9 @@ bool EclCC::parseCommandLineOptions(int argc, const char* argv[])
         else if (iter.matchFlag(optEvaluateResult, "-Me"))
         {
         }
+        else if (iter.matchFlag(optNoSourcePath, "--nosourcepath"))
+        {
+        }
         else if (iter.matchFlag(optOutputFilename, "-o"))
         {
         }
@@ -2054,6 +2059,7 @@ const char * const helpText[] = {
 #ifdef _WIN32
     "!   -m            Enable leak checking",
 #endif
+    "    --nosourcepath Compile as if the source came from stdin",
 #ifndef _WIN32
     "!   -pch          Generate precompiled header for eclinclude4.hpp",
 #endif