瀏覽代碼

Merge pull request #4189 from richardkchapman/plugin-sidecars

HPCC-9068 Embedded scripting plugins need to syntax check without dll

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 12 年之前
父節點
當前提交
00d0a17254

+ 4 - 12
plugins/CMakeLists.txt

@@ -25,15 +25,7 @@ if ("${BUILD_LEVEL}" STREQUAL "COMMUNITY")
   add_subdirectory (proxies)
 endif ()
 
-if (USE_V8)
-  add_subdirectory (v8embed)
-endif ()
-if (USE_PYTHON)
-  add_subdirectory (pyembed)
-endif ()
-if (USE_JNI)
-  add_subdirectory (javaembed)
-endif()
-if (USE_RINSIDE)
-  add_subdirectory (Rembed)
-endif()
+add_subdirectory (v8embed)
+add_subdirectory (pyembed)
+add_subdirectory (javaembed)
+add_subdirectory (Rembed)

+ 7 - 3
plugins/Rembed/CMakeLists.txt

@@ -25,9 +25,9 @@
 
 project( Rembed )
 
-ADD_PLUGIN(Rembed PACKAGES R OPTION MAKE_REMBED)
-
-if ( MAKE_REMBED )
+if (USE_RINSIDE)
+  ADD_PLUGIN(Rembed PACKAGES R OPTION MAKE_REMBED)
+  if ( MAKE_REMBED )
     set (    SRCS
              Rembed.cpp
         )
@@ -57,4 +57,8 @@ if ( MAKE_REMBED )
         eclrtl
         jlib
         )
+  endif()
 endif()
+
+# Even if not making the R plugin, we want to install the header
+install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/R.ecllib DESTINATION plugins COMPONENT Runtime)

+ 27 - 0
plugins/Rembed/R.ecllib

@@ -0,0 +1,27 @@
+/*##############################################################################
+
+ HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ############################################################################## */
+
+EXPORT Language := SERVICE : plugin('Rembed')
+  boolean getEmbedContext():cpp,pure,namespace='Rembed',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';
+  boolean syntaxCheck(const varstring src):cpp,pure,namespace='Rembed',entrypoint='syntaxCheck';
+  unload():cpp,pure,namespace='Rembed',entrypoint='unload';
+END;
+
+EXPORT getEmbedContext := Language.getEmbedContext;
+EXPORT syntaxCheck := Language.syntaxCheck;
+EXPORT boolean supportsImport := false;
+EXPORT boolean supportsScript := true;

+ 0 - 35
plugins/Rembed/Rembed.cpp

@@ -19,7 +19,6 @@
 #include "RInside.h"
 #include "jexcept.hpp"
 #include "jthread.hpp"
-#include "hqlplugins.hpp"
 #include "deftype.hpp"
 #include "eclrtl.hpp"
 #include "eclrtl_imp.hpp"
@@ -30,40 +29,6 @@
 #define EXPORT
 #endif
 
-static const char * compatibleVersions[] =
-{ "R Embed Helper 1.0.0", NULL };
-
-static const char *version = "R Embed Helper 1.0.0";
-
-static const char * EclDefinition =
-    "EXPORT Language := SERVICE\n"
-    "  boolean getEmbedContext():cpp,pure,namespace='Rembed',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';\n"
-    "  boolean syntaxCheck(const varstring src):cpp,pure,namespace='Rembed',entrypoint='syntaxCheck';\n"
-    "  unload():cpp,pure,namespace='Rembed',entrypoint='unload';\n"
-    "END;"
-    "EXPORT getEmbedContext := Language.getEmbedContext;"
-    "EXPORT syntaxCheck := Language.syntaxCheck;"
-    "EXPORT boolean supportsImport := false;"
-    "EXPORT boolean supportsScript := true;";
-
-extern "C" EXPORT bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb)
-{
-    if (pb->size == sizeof(ECLPluginDefinitionBlockEx))
-    {
-        ECLPluginDefinitionBlockEx * pbx = (ECLPluginDefinitionBlockEx *) pb;
-        pbx->compatibleVersions = compatibleVersions;
-    }
-    else if (pb->size != sizeof(ECLPluginDefinitionBlock))
-        return false;
-    pb->magicVersion = PLUGIN_VERSION;
-    pb->version = version;
-    pb->moduleName = "R";
-    pb->ECL = EclDefinition;
-    pb->flags = PLUGIN_DLL_MODULE | PLUGIN_MULTIPLE_VERSIONS;
-    pb->description = "R Embed Helper";
-    return true;
-}
-
 namespace Rembed
 {
 

+ 7 - 4
plugins/javaembed/CMakeLists.txt

@@ -25,9 +25,9 @@
 
 project( javaembed )
 
-ADD_PLUGIN(javaembed PACKAGES JNI OPTION MAKE_JAVAEMBED)
-
-if ( MAKE_JAVAEMBED )
+if (USE_JNI)
+  ADD_PLUGIN(javaembed PACKAGES JNI OPTION MAKE_JAVAEMBED)
+  if ( MAKE_JAVAEMBED )
     set (    SRCS
              javaembed.cpp
         )
@@ -71,4 +71,7 @@ if ( MAKE_JAVAEMBED )
         eclrtl
         jlib
         )
-endif()
+  endif()
+endif()
+# Even if not making the Java plugin, we want to install the header
+install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/java.ecllib DESTINATION plugins COMPONENT Runtime)

+ 23 - 0
plugins/javaembed/java.ecllib

@@ -0,0 +1,23 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+EXPORT Language := SERVICE : plugin('javaembed')
+  boolean getEmbedContext():cpp,pure,namespace='javaembed',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';
+END;
+EXPORT getEmbedContext := Language.getEmbedContext;
+EXPORT boolean supportsImport := true;
+EXPORT boolean supportsScript := false;

+ 0 - 33
plugins/javaembed/javaembed.cpp

@@ -19,7 +19,6 @@
 #include <jni.h>
 #include "jexcept.hpp"
 #include "jthread.hpp"
-#include "hqlplugins.hpp"
 #include "deftype.hpp"
 #include "eclrtl.hpp"
 #include "eclrtl_imp.hpp"
@@ -32,38 +31,6 @@
 #define EXPORT
 #endif
 
-static const char * compatibleVersions[] = {
-    "Java Embed Helper 1.0.0",
-    NULL };
-
-static const char *version = "Java Embed Helper 1.0.0";
-
-static const char * EclDefinition =
-    "EXPORT Language := SERVICE\n"
-    "  boolean getEmbedContext():cpp,pure,namespace='javaembed',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';\n"
-    "END;"
-    "EXPORT getEmbedContext := Language.getEmbedContext;"
-    "EXPORT boolean supportsImport := true;"
-    "EXPORT boolean supportsScript := false;";
-
-extern "C" EXPORT bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb)
-{
-    if (pb->size == sizeof(ECLPluginDefinitionBlockEx))
-    {
-        ECLPluginDefinitionBlockEx * pbx = (ECLPluginDefinitionBlockEx *) pb;
-        pbx->compatibleVersions = compatibleVersions;
-    }
-    else if (pb->size != sizeof(ECLPluginDefinitionBlock))
-        return false;
-    pb->magicVersion = PLUGIN_VERSION;
-    pb->version = version;
-    pb->moduleName = "java";
-    pb->ECL = EclDefinition;
-    pb->flags = PLUGIN_DLL_MODULE | PLUGIN_MULTIPLE_VERSIONS;
-    pb->description = "Java Embed Helper";
-    return true;
-}
-
 namespace javaembed {
 
 // Use a global object to ensure that the Java VM  is initialized once only.

+ 36 - 34
plugins/pyembed/CMakeLists.txt

@@ -27,44 +27,46 @@ set ( debug_python Off )   # A lot slower but can assist in debugging...
 
 project( pyembed )
 
-ADD_PLUGIN(pyembed PACKAGES PythonLibs OPTION MAKE_PYEMBED MINVERSION 2.6 MAXVERSION 2.7)
+if (USE_PYTHON)
+  ADD_PLUGIN(pyembed PACKAGES PythonLibs OPTION MAKE_PYEMBED MINVERSION 2.6 MAXVERSION 2.7)
+  if ( MAKE_PYEMBED )
+    set ( SRCS
+          pyembed.cpp
+        )
 
-if ( MAKE_PYEMBED )
+    include_directories (
+         "${PYTHON_INCLUDE_DIR}"
+         ./../../system/include
+         ./../../rtl/eclrtl
+         ./../../rtl/include
+         ./../../common/deftype
+         ./../../system/jlib
+       )
 
-  set (    SRCS
-           pyembed.cpp
-      )
+    ADD_DEFINITIONS( -D_USRDLL -DPYEMBED_EXPORTS )
+    if (debug_python)
+      ADD_DEFINITIONS(-DPy_DEBUG)
+    endif()
 
-  include_directories (
-           "${PYTHON_INCLUDE_DIR}"
-           ./../../system/include
-           ./../../rtl/eclrtl
-           ./../../rtl/include
-           ./../../common/deftype
-           ./../../system/jlib
-      )
+    HPCC_ADD_LIBRARY( pyembed SHARED ${SRCS} )
+    if (${CMAKE_VERSION} VERSION_LESS "2.8.9")
+      message("WARNING: Cannot set NO_SONAME. shlibdeps will give warnings when package is installed")
+    else()
+      set_target_properties( pyembed PROPERTIES NO_SONAME 1 )
+    endif()
 
-  ADD_DEFINITIONS( -D_USRDLL -DPYEMBED_EXPORTS )
-  if (debug_python)
-    ADD_DEFINITIONS(-DPy_DEBUG)
-  endif()
-
-  HPCC_ADD_LIBRARY( pyembed SHARED ${SRCS} )
-  if (${CMAKE_VERSION} VERSION_LESS "2.8.9")
-    message("WARNING: Cannot set NO_SONAME. shlibdeps will give warnings when package is installed")
-  else()
-    set_target_properties( pyembed PROPERTIES NO_SONAME 1 )
-  endif()
+    install ( TARGETS pyembed DESTINATION plugins )
+    if (debug_python)
+      target_link_libraries ( pyembed ${PYTHON_DEBUG_LIBRARY} )
+    else()
+      target_link_libraries ( pyembed ${PYTHON_LIBRARY} )
+    endif()
 
-  install ( TARGETS pyembed DESTINATION plugins )
-  if (debug_python)
-    target_link_libraries ( pyembed ${PYTHON_DEBUG_LIBRARY} )
-  else()
-    target_link_libraries ( pyembed ${PYTHON_LIBRARY} )
+    target_link_libraries ( pyembed
+        eclrtl
+        jlib
+        )
   endif()
-
-  target_link_libraries ( pyembed
-      eclrtl
-      jlib
-      )
 endif()
+# Even if not making the Python plugin, we want to install the header
+install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/python.ecllib DESTINATION plugins COMPONENT Runtime)

+ 0 - 35
plugins/pyembed/pyembed.cpp

@@ -19,7 +19,6 @@
 #include "Python.h"
 #include "jexcept.hpp"
 #include "jthread.hpp"
-#include "hqlplugins.hpp"
 #include "deftype.hpp"
 #include "eclrtl.hpp"
 #include "eclrtl_imp.hpp"
@@ -30,40 +29,6 @@
 #define EXPORT
 #endif
 
-static const char * compatibleVersions[] = {
-    "Python2.7 Embed Helper 1.0.0",
-    NULL };
-
-static const char *version = "Python2.7 Embed Helper 1.0.0";
-
-static const char * EclDefinition =
-    "EXPORT Language := SERVICE\n"
-    "  boolean getEmbedContext():cpp,pure,namespace='pyembed',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';\n"
-    "  boolean syntaxCheck(const varstring src):cpp,pure,namespace='pyembed',entrypoint='syntaxCheck';\n"
-    "END;"
-    "EXPORT getEmbedContext := Language.getEmbedContext;"
-    "EXPORT syntaxCheck := Language.syntaxCheck;"
-    "EXPORT boolean supportsImport := true;"
-    "EXPORT boolean supportsScript := true;";
-
-extern "C" EXPORT bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb)
-{
-    if (pb->size == sizeof(ECLPluginDefinitionBlockEx))
-    {
-        ECLPluginDefinitionBlockEx * pbx = (ECLPluginDefinitionBlockEx *) pb;
-        pbx->compatibleVersions = compatibleVersions;
-    }
-    else if (pb->size != sizeof(ECLPluginDefinitionBlock))
-        return false;
-    pb->magicVersion = PLUGIN_VERSION;
-    pb->version = version;
-    pb->moduleName = "python";
-    pb->ECL = EclDefinition;
-    pb->flags = PLUGIN_DLL_MODULE | PLUGIN_MULTIPLE_VERSIONS;
-    pb->description = "Python2.7 Embed Helper";
-    return true;
-}
-
 namespace pyembed {
 
 // Use class OwnedPyObject for any objects that are not 'borrowed references'

+ 25 - 0
plugins/pyembed/python.ecllib

@@ -0,0 +1,25 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+EXPORT Language := SERVICE : plugin('pyembed')
+  boolean getEmbedContext():cpp,pure,namespace='pyembed',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';
+  boolean syntaxCheck(const varstring src):cpp,pure,namespace='pyembed',entrypoint='syntaxCheck';
+END;
+EXPORT getEmbedContext := Language.getEmbedContext;
+EXPORT syntaxCheck := Language.syntaxCheck;
+EXPORT boolean supportsImport := true;
+EXPORT boolean supportsScript := true;

+ 7 - 4
plugins/v8embed/CMakeLists.txt

@@ -25,9 +25,9 @@
 
 project( v8embed )
 
-ADD_PLUGIN(v8embed PACKAGES V8 OPTION MAKE_V8EMBED)
-
-if ( MAKE_V8EMBED )
+if (USE_V8)
+  ADD_PLUGIN(v8embed PACKAGES V8 OPTION MAKE_V8EMBED)
+  if ( MAKE_V8EMBED )
     set (    SRCS
              v8embed.cpp
         )
@@ -57,4 +57,7 @@ if ( MAKE_V8EMBED )
         eclrtl
         jlib
         )
-endif()
+  endif()
+endif()
+# Even if not making the V8 plugin, we want to install the header
+install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/javascript.ecllib DESTINATION plugins COMPONENT Runtime)

+ 25 - 0
plugins/v8embed/javascript.ecllib

@@ -0,0 +1,25 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+EXPORT Language := SERVICE : plugin('v8embed')
+  boolean getEmbedContext():cpp,pure,namespace='javascriptLanguageHelper',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';
+  boolean syntaxCheck(const varstring src):cpp,pure,namespace='javascriptLanguageHelper',entrypoint='syntaxCheck';
+END;
+EXPORT getEmbedContext := Language.getEmbedContext;
+EXPORT syntaxCheck := Language.syntaxCheck;
+EXPORT boolean supportsImport := false;
+EXPORT boolean supportsScript := true;

+ 0 - 34
plugins/v8embed/v8embed.cpp

@@ -19,7 +19,6 @@
 #include "v8.h"
 #include "jexcept.hpp"
 #include "jthread.hpp"
-#include "hqlplugins.hpp"
 #include "deftype.hpp"
 #include "eclrtl.hpp"
 #include "eclrtl_imp.hpp"
@@ -30,39 +29,6 @@
 #define EXPORT
 #endif
 
-static const char * compatibleVersions[] = {
-    "V8 JavaScript Embed Helper 1.0.0",
-    NULL };
-
-static const char *version = "V8 JavaScript Embed Helper 1.0.0";
-static const char * EclDefinition =
-    "EXPORT Language := SERVICE\n"
-    "  boolean getEmbedContext():cpp,pure,namespace='javascriptLanguageHelper',entrypoint='getEmbedContext',prototype='IEmbedContext* getEmbedContext()';\n"
-    "  boolean syntaxCheck(const varstring src):cpp,pure,namespace='javascriptLanguageHelper',entrypoint='syntaxCheck';\n"
-    "END;"
-    "export getEmbedContext := Language.getEmbedContext;"
-    "export syntaxCheck := Language.syntaxCheck;"
-    "EXPORT boolean supportsImport := false;"
-    "EXPORT boolean supportsScript := true;";
-
-extern "C" EXPORT bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb)
-{
-    if (pb->size == sizeof(ECLPluginDefinitionBlockEx))
-    {
-        ECLPluginDefinitionBlockEx * pbx = (ECLPluginDefinitionBlockEx *) pb;
-        pbx->compatibleVersions = compatibleVersions;
-    }
-    else if (pb->size != sizeof(ECLPluginDefinitionBlock))
-        return false;
-    pb->magicVersion = PLUGIN_VERSION;
-    pb->version = version;
-    pb->moduleName = "javascript";
-    pb->ECL = EclDefinition;
-    pb->flags = PLUGIN_DLL_MODULE | PLUGIN_MULTIPLE_VERSIONS;
-    pb->description = "V8 JavaScript Embed Helper";
-    return true;
-}
-
 namespace javascriptLanguageHelper {
 
 class V8JavascriptEmbedFunctionContext : public CInterfaceOf<IEmbedFunctionContext>