You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/04/03 13:40:05 UTC

[plc4x] branch develop updated: - Fixed some remaining issues with building in Thrift-Related modules.

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 86e7edb  - Fixed some remaining issues with building in Thrift-Related modules.
86e7edb is described below

commit 86e7edb02f6ec34ac081a025f0ee0163949280b6
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Apr 3 15:39:56 2020 +0200

    - Fixed some remaining issues with building in Thrift-Related modules.
---
 plc4j/tools/interop/pom.xml                        | 33 ++++----
 .../org/apache/plc4x/interop/impl/Handler.java     |  2 +-
 .../java/org/apache/plc4x/interop/impl/Server.java |  8 +-
 tools/thrift/pom.xml                               | 90 ++++++++++++++++++----
 4 files changed, 97 insertions(+), 36 deletions(-)

diff --git a/plc4j/tools/interop/pom.xml b/plc4j/tools/interop/pom.xml
index b6b57ed..55585bf 100644
--- a/plc4j/tools/interop/pom.xml
+++ b/plc4j/tools/interop/pom.xml
@@ -147,29 +147,30 @@
 
   <dependencies>
     <dependency>
-      <groupId>javax.annotation</groupId>
-      <artifactId>jsr250-api</artifactId>
-      <version>1.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.thrift</groupId>
-      <artifactId>libthrift</artifactId>
-      <version>0.12.0</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.plc4x</groupId>
       <artifactId>plc4j-api</artifactId>
       <version>0.7.0-SNAPSHOT</version>
     </dependency>
-    <!--dependency>
+    <dependency>
       <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-transport-test</artifactId>
+      <artifactId>plc4j-spi</artifactId>
       <version>0.7.0-SNAPSHOT</version>
-    </dependency-->
+    </dependency>
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-      <version>20030203.000129</version>
+      <groupId>javax.annotation</groupId>
+      <artifactId>jsr250-api</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.thrift</groupId>
+      <artifactId>libthrift</artifactId>
+      <version>${thrift.version}</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>javax.annotation-api</artifactId>
+          <groupId>javax.annotation</groupId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
diff --git a/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Handler.java b/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Handler.java
index bdf9d95..c784af8 100644
--- a/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Handler.java
+++ b/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Handler.java
@@ -19,8 +19,8 @@
 
 package org.apache.plc4x.interop.impl;
 
-import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.lang3.NotImplementedException;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.plc4x.interop.*;
 import org.apache.plc4x.java.PlcDriverManager;
 import org.apache.plc4x.java.api.PlcConnection;
diff --git a/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Server.java b/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Server.java
index 1216893..df93d53 100644
--- a/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Server.java
+++ b/plc4j/tools/interop/src/main/java/org/apache/plc4x/interop/impl/Server.java
@@ -19,7 +19,6 @@
 
 package org.apache.plc4x.interop.impl;
 
-import org.apache.commons.lang3.tuple.Pair;
 import org.apache.plc4x.interop.InteropServer;
 import org.apache.plc4x.java.PlcDriverManager;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
@@ -31,6 +30,7 @@ import org.apache.plc4x.java.api.value.PlcLong;
 import org.apache.plc4x.java.api.value.PlcValue;
 import org.apache.plc4x.java.mock.connection.MockConnection;
 import org.apache.plc4x.java.mock.connection.MockDevice;
+import org.apache.plc4x.java.spi.messages.utils.ResponseItem;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.server.TSimpleServer;
 import org.apache.thrift.transport.TServerSocket;
@@ -65,8 +65,8 @@ public class Server {
 
     private static class MyMockDevice implements MockDevice {
         @Override
-        public Pair<PlcResponseCode, PlcValue> read(String fieldQuery) {
-            return Pair.of(PlcResponseCode.OK, new PlcLong(100L));
+        public ResponseItem<PlcValue> read(String fieldQuery) {
+            return new ResponseItem<>(PlcResponseCode.OK, new PlcLong(100L));
         }
 
         @Override
@@ -75,7 +75,7 @@ public class Server {
         }
 
         @Override
-        public Pair<PlcResponseCode, PlcSubscriptionHandle> subscribe(String fieldQuery) {
+        public ResponseItem<PlcSubscriptionHandle> subscribe(String fieldQuery) {
             return null;
         }
 
diff --git a/tools/thrift/pom.xml b/tools/thrift/pom.xml
index f422b67..4bf12ae 100644
--- a/tools/thrift/pom.xml
+++ b/tools/thrift/pom.xml
@@ -35,6 +35,7 @@
 
   <properties>
     <thrift.with.cpp>OFF</thrift.with.cpp>
+    <thrift.with.csharp>OFF</thrift.with.csharp>
     <thrift.with.python>OFF</thrift.with.python>
   </properties>
 
@@ -61,11 +62,11 @@
                   <goal>exec</goal>
                 </goals>
                 <configuration>
-                  <basedir>${cmake.root-dir}</basedir>
+                  <basedir>${cmake.root}</basedir>
                   <executable>chmod</executable>
                   <arguments>
                     <argument>+x</argument>
-                    <argument>${cmake.child-dir}</argument>
+                    <argument>cmake</argument>
                   </arguments>
                 </configuration>
               </execution>
@@ -96,11 +97,11 @@
                   <goal>exec</goal>
                 </goals>
                 <configuration>
-                  <basedir>${cmake.root-dir}</basedir>
+                  <basedir>${cmake.root}</basedir>
                   <executable>chmod</executable>
                   <arguments>
                     <argument>+x</argument>
-                    <argument>${cmake.child-dir}</argument>
+                    <argument>cmake</argument>
                   </arguments>
                 </configuration>
               </execution>
@@ -139,6 +140,37 @@
         </plugins>
       </build>
     </profile>
+    <!-- If C++ is enabled, we need to add another assembly to the build to package the libraries -->
+    <profile>
+      <id>with-dotnet</id>
+      <properties>
+        <thrift.with.csharp>ON</thrift.with.csharp>
+      </properties>
+      <build>
+        <plugins>
+          <!-- This library is currently not buildable via CMake (yet) -->
+          <!--plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>package-thrift-cpp</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+                <configuration>
+                  <finalName>${project.artifactId}-${project.version}</finalName>
+                  <descriptors>
+                    <descriptor>src/assembly/csharp.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin-->
+        </plugins>
+      </build>
+    </profile>
     <!-- If Python is enabled, we need to add another assembly to the build to package the libraries -->
     <profile>
       <id>with-python</id>
@@ -252,23 +284,53 @@
                 and tell the plugin where to find that version.
               -->
               <downloadBinaries>false</downloadBinaries>
-              <cmakeRootDir>${cmake.root-dir}</cmakeRootDir>
-              <cmakeChildDir>${cmake.child-dir}</cmakeChildDir>
+              <cmakeDir>${cmake.root}</cmakeDir>
 
               <sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
               <targetPath>${project.build.directory}/build</targetPath>
               <generator>${cmake.generator}</generator>
-              <!--
-                The classifier of the current platform. One of
-                [windows-x86_32, windows-x86_64, linux-x86_32, linux-x86_64, linux-arm_32, mac-x86_64].
-                It defines the version and type of the cmake installation to download.
-              -->
-              <classifier>${os.classifier}</classifier>
               <options>
                 <!-- Disable testing for now -->
                 <option>-DBUILD_TESTING=OFF</option>
+
+                <!-- Enable and disable the building of code generators for different languages -->
+                <option>-DTHRIFT_COMPILER_AS3=OFF</option>
+                <option>-DTHRIFT_COMPILER_C_GLIB=OFF</option>
+                <option>-DTHRIFT_COMPILER_CL=OFF</option>
+                <option>-DTHRIFT_COMPILER_CPP=${thrift.with.cpp}</option>
+                <option>-DTHRIFT_COMPILER_CSHARP=${thrift.with.csharp}</option>
+                <option>-DTHRIFT_COMPILER_D=OFF</option>
+                <option>-DTHRIFT_COMPILER_DART=OFF</option>
+                <option>-DTHRIFT_COMPILER_DELPHI=OFF</option>
+                <option>-DTHRIFT_COMPILER_ERL=OFF</option>
+                <option>-DTHRIFT_COMPILER_GO=OFF</option>
+                <option>-DTHRIFT_COMPILER_GV=OFF</option>
+                <option>-DTHRIFT_COMPILER_HAXE=OFF</option>
+                <option>-DTHRIFT_COMPILER_HS=OFF</option>
+                <option>-DTHRIFT_COMPILER_HTML=OFF</option>
+                <option>-DTHRIFT_COMPILER_JAVA=ON</option>
+                <option>-DTHRIFT_COMPILER_JAVAME=OFF</option>
+                <option>-DTHRIFT_COMPILER_JS=OFF</option>
+                <option>-DTHRIFT_COMPILER_JSON=OFF</option>
+                <option>-DTHRIFT_COMPILER_LUA=OFF</option>
+                <option>-DTHRIFT_COMPILER_NETCORE=OFF</option>
+                <option>-DTHRIFT_COMPILER_NETSTD=OFF</option>
+                <option>-DTHRIFT_COMPILER_OCAML=OFF</option>
+                <option>-DTHRIFT_COMPILER_PERL=OFF</option>
+                <option>-DTHRIFT_COMPILER_PHP=OFF</option>
+                <option>-DTHRIFT_COMPILER_PY=${thrift.with.python}</option>
+                <option>-DTHRIFT_COMPILER_RB=OFF</option>
+                <option>-DTHRIFT_COMPILER_RS=OFF</option>
+                <option>-DTHRIFT_COMPILER_ST=OFF</option>
+                <option>-DTHRIFT_COMPILER_SWIFT=OFF</option>
+                <option>-DTHRIFT_COMPILER_XML=OFF</option>
+                <option>-DTHRIFT_COMPILER_XSD=OFF</option>
+
+                <!-- Enable and disable the building of libs for different languages -->
                 <option>-DBUILD_C_GLIB=OFF</option>
                 <option>-DBUILD_CPP=${thrift.with.cpp}</option>
+                <!-- Unfortunately this doesn't exist yet -->
+                <option>-DBUILD_CSHARP=${thrift.with.csharp}</option>
                 <!-- Don't build Java, as the libs are available via Maven -->
                 <option>-DBUILD_JAVA=OFF</option>
                 <option>-DBUILD_PYTHON=${thrift.with.python}</option>
@@ -292,12 +354,10 @@
                 and tell the plugin where to find that version.
               -->
               <downloadBinaries>false</downloadBinaries>
-              <cmakeRootDir>${cmake.root-dir}</cmakeRootDir>
-              <cmakeChildDir>${cmake.child-dir}</cmakeChildDir>
+              <cmakeDir>${cmake.root}</cmakeDir>
 
               <!-- The directory where the "generate" step generated the build configuration -->
               <projectDirectory>${project.build.directory}/build</projectDirectory>
-              <classifier>${os.classifier}</classifier>
             </configuration>
           </execution>
         </executions>