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 809de68  - Refactroed the structure of the python module to be more 
like the other modules
809de68 is described below

commit 809de68e51737e2eaa5d4aecd73c9cdcf989c04e
Author: Christofer Dutz <christofer.d...@c-ware.de>
AuthorDate: Tue Apr 30 12:28:26 2019 +0200

    - Refactroed the structure of the python module to be more like the other 
modules
---
 .../java/ads/protocol/Plc4x2AdsProtocolTest.java   |  1 +
 plc4j/utils/interop/pom.xml                        |  2 +-
 plc4py/initialize_interop_server.sh                | 29 -------
 plc4py/pom.xml                                     | 89 ++++++++++++++++++++--
 plc4py/{ => src/main/python}/__init__.py           |  0
 plc4py/{test => src/main/python/org}/__init__.py   |  0
 .../main/python/org/apache}/__init__.py            |  0
 .../main/python}/org/apache/plc4x/InteropClient.py |  5 +-
 .../main/python}/org/apache/plc4x/PlcConnection.py |  0
 .../python}/org/apache/plc4x/PlcDriverManager.py   |  3 +-
 .../main/python/org/apache/plc4x}/__init__.py      |  0
 plc4py/{ => src/main/resources}/lib/log4j2.xml     |  0
 plc4py/{ => src/test/python}/__init__.py           |  0
 plc4py/{ => src/test/python/org}/__init__.py       |  0
 .../{ => src/test/python/org/apache}/__init__.py   |  0
 .../test/python/org/apache/plc4x}/__init__.py      |  0
 .../org/apache/plc4x}/test_PlcDriverManager.py     |  2 +-
 17 files changed, 90 insertions(+), 41 deletions(-)

diff --git 
a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
 
b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
index 2890aca..69d08d2 100644
--- 
a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
+++ 
b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
@@ -252,4 +252,5 @@ public class Plc4x2AdsProtocolTest {
         invokeIdField.setAccessible(true);
         invokeIdField.set(amsHeader, Invoke.of(correlationBuilder.get()));
     }
+
 }
\ No newline at end of file
diff --git a/plc4j/utils/interop/pom.xml b/plc4j/utils/interop/pom.xml
index 590948a..28d5f02 100644
--- a/plc4j/utils/interop/pom.xml
+++ b/plc4j/utils/interop/pom.xml
@@ -24,8 +24,8 @@
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <artifactId>plc4j-utils</artifactId>
     <groupId>org.apache.plc4x</groupId>
+    <artifactId>plc4j-utils</artifactId>
     <version>0.4.0-SNAPSHOT</version>
   </parent>
 
diff --git a/plc4py/initialize_interop_server.sh 
b/plc4py/initialize_interop_server.sh
deleted file mode 100755
index 4b72d2e..0000000
--- a/plc4py/initialize_interop_server.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-################################################################################
-##
-##  Licensed to the Apache Software Foundation (ASF) under one or more
-##  contributor license agreements.  See the NOTICE file distributed with
-##  this work for additional information regarding copyright ownership.
-##  The ASF licenses this file to You 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.
-##
-################################################################################
-
-# Clean the directory
-rm -f lib/*.jar
-
-# Builds the interop server module with maven
-mvn clean package -f ../plc4j/utils/interop/pom.xml
-
-# Moves the server from the target folder here
-cp 
../plc4j/utils/interop/target/apache-plc4x-*-SNAPSHOT-jar-with-dependencies.jar 
lib/interop-server.jar
\ No newline at end of file
diff --git a/plc4py/pom.xml b/plc4py/pom.xml
index f580358..3bcd1e4 100644
--- a/plc4py/pom.xml
+++ b/plc4py/pom.xml
@@ -34,12 +34,13 @@
   <description>Implementation of the protocol adapters for usage as Python 
module.</description>
 
   <build>
+    <sourceDirectory>src/main/python</sourceDirectory>
+    <testSourceDirectory>src/test/python</testSourceDirectory>
     <plugins>
       <!-- Unpack the protocol spec -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
-        <version>3.1.1</version>
         <executions>
           <execution>
             <id>unpack-protocol-spec</id>
@@ -71,6 +72,27 @@
             </configuration>
           </execution>
           <execution>
+            <id>copy-interop-server</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.plc4x</groupId>
+                  <artifactId>interop-server</artifactId>
+                  <version>0.4.0-SNAPSHOT</version>
+                  <type>jar</type>
+                  <classifier>jar-with-dependencies</classifier>
+                  <overWrite>true</overWrite>
+                  
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
+                  <destFileName>interop-server.jar</destFileName>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+          <execution>
             <id>check-dependencies</id>
             <phase>verify</phase>
             <goals>
@@ -88,13 +110,69 @@
       </plugin>
 
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <!-- For Python we don't really compile anything, so just copy the 
files here -->
+          <execution>
+            <id>copy-python</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              
<outputDirectory>${project.build.directory}/classes</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>src/main/python</directory>
+                  <filtering>false</filtering>
+                </resource>
+                <resource>
+                  
<directory>${project.build.directory}/generated-sources/thrift</directory>
+                  <filtering>false</filtering>
+                </resource>
+                <resource>
+                  <directory>src/main/resources</directory>
+                  <filtering>false</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+          <!-- For Python we don't really compile anything, so just copy the 
files here -->
+          <execution>
+            <id>copy-test-python</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              
<outputDirectory>${project.build.directory}/test-classes</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>src/test/python</directory>
+                  <filtering>false</filtering>
+                </resource>
+                <resource>
+                  
<directory>${project.build.directory}/generated-test-sources/thrift</directory>
+                  <filtering>false</filtering>
+                </resource>
+                <resource>
+                  <directory>src/test/resources</directory>
+                  <filtering>false</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
         <groupId>org.apache.thrift.tools</groupId>
         <artifactId>maven-thrift-plugin</artifactId>
         <version>0.1.11</version>
         <configuration>
           
<thriftExecutable>${project.build.directory}/thrift-compiler/${thrift.compiler.executable}</thriftExecutable>
           
<thriftSourceRoot>${project.build.directory}/protocol-spec</thriftSourceRoot>
-          <outputDirectory>${basedir}/generated/</outputDirectory>
           <includes>
             <include>**/interop.thrift</include>
           </includes>
@@ -103,7 +181,7 @@
         <executions>
           <execution>
             <id>thrift-sources</id>
-            <phase>generate-sources</phase>
+            <phase>process-sources</phase>
             <goals>
               <goal>compile</goal>
             </goals>
@@ -121,13 +199,14 @@
     </plugins>
   </build>
 
-  <!-- TODO copy artifact from interop-server here, to make the 
initialize_interop_server.sh obsolete-->
-
   <dependencies>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
       <artifactId>interop-server</artifactId>
       <version>0.4.0-SNAPSHOT</version>
+      <type>pom</type>
+      <scope>provided</scope>
+      <optional>true</optional>
     </dependency>
   </dependencies>
 
diff --git a/plc4py/__init__.py b/plc4py/src/main/python/__init__.py
similarity index 100%
copy from plc4py/__init__.py
copy to plc4py/src/main/python/__init__.py
diff --git a/plc4py/test/__init__.py b/plc4py/src/main/python/org/__init__.py
similarity index 100%
rename from plc4py/test/__init__.py
rename to plc4py/src/main/python/org/__init__.py
diff --git a/plc4py/org/apache/plc4x/__init__.py 
b/plc4py/src/main/python/org/apache/__init__.py
similarity index 100%
rename from plc4py/org/apache/plc4x/__init__.py
rename to plc4py/src/main/python/org/apache/__init__.py
diff --git a/plc4py/org/apache/plc4x/InteropClient.py 
b/plc4py/src/main/python/org/apache/plc4x/InteropClient.py
similarity index 98%
rename from plc4py/org/apache/plc4x/InteropClient.py
rename to plc4py/src/main/python/org/apache/plc4x/InteropClient.py
index 7754bec..8cfea80 100644
--- a/plc4py/org/apache/plc4x/InteropClient.py
+++ b/plc4py/src/main/python/org/apache/plc4x/InteropClient.py
@@ -15,13 +15,12 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
+from generated.org.apache.plc4x.interop.InteropServer import Client
+from generated.org.apache.plc4x.interop.ttypes import Request
 from thrift.protocol import TBinaryProtocol
 from thrift.transport import TSocket, TTransport
 from thrift.transport.TTransport import TTransportException
 
-from generated.org.apache.plc4x.interop.InteropServer import Client, 
PlcException
-from generated.org.apache.plc4x.interop.ttypes import Request
-
 transport = TSocket.TSocket('localhost', 9090)
 transport = TTransport.TBufferedTransport(transport)
 protocol = TBinaryProtocol.TBinaryProtocol(transport)
diff --git a/plc4py/org/apache/plc4x/PlcConnection.py 
b/plc4py/src/main/python/org/apache/plc4x/PlcConnection.py
similarity index 100%
rename from plc4py/org/apache/plc4x/PlcConnection.py
rename to plc4py/src/main/python/org/apache/plc4x/PlcConnection.py
diff --git a/plc4py/org/apache/plc4x/PlcDriverManager.py 
b/plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py
similarity index 99%
rename from plc4py/org/apache/plc4x/PlcDriverManager.py
rename to plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py
index 4ce9dc3..8f98e63 100644
--- a/plc4py/org/apache/plc4x/PlcDriverManager.py
+++ b/plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py
@@ -18,13 +18,12 @@
 import subprocess
 import time
 import warnings
-
+from generated.org.apache.plc4x.interop.InteropServer import Client, 
PlcException
 from thrift.protocol import TBinaryProtocol
 from thrift.transport import TSocket, TTransport
 from thrift.transport.TTransport import TTransportException
 
 from org.apache.plc4x.PlcConnection import PlcConnection
-from generated.org.apache.plc4x.interop.InteropServer import Client, 
PlcException
 
 
 class PlcDriverManager:
diff --git a/plc4py/org/apache/__init__.py 
b/plc4py/src/main/python/org/apache/plc4x/__init__.py
similarity index 100%
rename from plc4py/org/apache/__init__.py
rename to plc4py/src/main/python/org/apache/plc4x/__init__.py
diff --git a/plc4py/lib/log4j2.xml b/plc4py/src/main/resources/lib/log4j2.xml
similarity index 100%
rename from plc4py/lib/log4j2.xml
rename to plc4py/src/main/resources/lib/log4j2.xml
diff --git a/plc4py/__init__.py b/plc4py/src/test/python/__init__.py
similarity index 100%
copy from plc4py/__init__.py
copy to plc4py/src/test/python/__init__.py
diff --git a/plc4py/__init__.py b/plc4py/src/test/python/org/__init__.py
similarity index 100%
copy from plc4py/__init__.py
copy to plc4py/src/test/python/org/__init__.py
diff --git a/plc4py/__init__.py b/plc4py/src/test/python/org/apache/__init__.py
similarity index 100%
rename from plc4py/__init__.py
rename to plc4py/src/test/python/org/apache/__init__.py
diff --git a/plc4py/org/__init__.py 
b/plc4py/src/test/python/org/apache/plc4x/__init__.py
similarity index 100%
rename from plc4py/org/__init__.py
rename to plc4py/src/test/python/org/apache/plc4x/__init__.py
diff --git a/plc4py/test/test_PlcDriverManager.py 
b/plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py
similarity index 97%
rename from plc4py/test/test_PlcDriverManager.py
rename to plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py
index aba3a28..63d4e0d 100644
--- a/plc4py/test/test_PlcDriverManager.py
+++ b/plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py
@@ -17,11 +17,11 @@
 
 import time
 import unittest
+from generated.org.apache.plc4x.interop.InteropServer import Request, 
PlcException
 from subprocess import Popen
 from unittest import TestCase
 
 from org.apache.plc4x.PlcDriverManager import PlcDriverManager
-from generated.org.apache.plc4x.interop.InteropServer import Client, Request, 
PlcException
 
 if __name__ == '__main__':
     unittest.main()

Reply via email to