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 2019/04/26 13:19:55 UTC

[plc4x] branch feature/PLC4X-111-interop-server updated: - Made the assembly plugin package the thrift compiler

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

cdutz pushed a commit to branch feature/PLC4X-111-interop-server
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/feature/PLC4X-111-interop-server by this push:
     new ce4955a  - Made the assembly plugin package the thrift compiler
ce4955a is described below

commit ce4955ab9e1e9cd460bab42a81548cb92543b436
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Apr 26 15:19:47 2019 +0200

    - Made the assembly plugin package the thrift compiler
---
 plc4j/utils/interop/pom.xml            | 21 +++++-----
 pom.xml                                | 65 +++++++++++++++++++++++++++++
 tools/pom.xml                          | 64 -----------------------------
 tools/thrift/pom.xml                   | 75 ++++++++++++++++++++++++++++++++--
 tools/thrift/src/assembly/compiler.xml | 40 ++++++++++++++++++
 tools/thrift/src/assembly/cpp.xml      | 39 ++++++++++++++++++
 tools/thrift/src/assembly/python.xml   | 39 ++++++++++++++++++
 7 files changed, 266 insertions(+), 77 deletions(-)

diff --git a/plc4j/utils/interop/pom.xml b/plc4j/utils/interop/pom.xml
index 8a9613b..004d474 100644
--- a/plc4j/utils/interop/pom.xml
+++ b/plc4j/utils/interop/pom.xml
@@ -54,6 +54,16 @@
                   <overWrite>true</overWrite>
                   <outputDirectory>${project.build.directory}/protocol-spec</outputDirectory>
                 </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.plc4x</groupId>
+                  <artifactId>plc4x-tools-thrift</artifactId>
+                  <version>0.4.0-SNAPSHOT</version>
+                  <type>zip</type>
+                  <classifier>compiler-${os.classifier}</classifier>
+                  <overWrite>true</overWrite>
+                  <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory>
+                  <destFileName>${thrift.compiler.executable}</destFileName>
+                </artifactItem>
               </artifactItems>
             </configuration>
           </execution>
@@ -79,7 +89,7 @@
         <artifactId>maven-thrift-plugin</artifactId>
         <version>0.1.11</version>
         <configuration>
-          <thriftExecutable>${project.basedir}/../../../tools/thrift/target/make/compiler/cpp/bin/thrift</thriftExecutable>
+          <thriftExecutable>${project.build.directory}/thrift-compiler/plc4x-tools-thrift/${thrift.compiler.executable}</thriftExecutable>
           <generator>java</generator>
         </configuration>
         <executions>
@@ -137,15 +147,6 @@
       <artifactId>plc4j-protocol-driver-base</artifactId>
       <version>0.4.0-SNAPSHOT</version>
     </dependency>
-
-    <!-- Make sure this is built before this module -->
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4x-tools-thrift</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
-      <type>pom</type>
-      <optional>true</optional>
-    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f005b2a..0b0d166 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1250,6 +1250,71 @@
       </modules>
     </profile>
 
+    <!-- Profile for linux -->
+    <profile>
+      <id>unix</id>
+      <activation>
+        <os>
+          <family>unix</family>
+        </os>
+      </activation>
+      <properties>
+        <os.suffix>linux</os.suffix>
+        <os.classifier>linux-x86_64</os.classifier>
+        <cmake.generator>Unix Makefiles</cmake.generator>
+        <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.tar.gz</boost.url>
+        <boost.bootstrap.executable>./bootstrap.sh</boost.bootstrap.executable>
+        <boost.build.executable>./b2</boost.build.executable>
+        <thrift.bootstrap.executable>./bootstrap.sh</thrift.bootstrap.executable>
+        <thrift.configure.executable>./configure</thrift.configure.executable>
+        <thrift.make.executable>make</thrift.make.executable>
+        <thrift.compiler.executable>thrift</thrift.compiler.executable>
+      </properties>
+    </profile>
+    <!-- Profile for mac -->
+    <profile>
+      <id>max</id>
+      <activation>
+        <os>
+          <family>mac</family>
+        </os>
+      </activation>
+      <properties>
+        <os.suffix>mac</os.suffix>
+        <os.classifier>mac-x86_64</os.classifier>
+        <cmake.generator>Unix Makefiles</cmake.generator>
+        <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.tar.gz</boost.url>
+        <boost.bootstrap.executable>./bootstrap.sh</boost.bootstrap.executable>
+        <boost.build.executable>./b2</boost.build.executable>
+        <thrift.bootstrap.executable>./bootstrap.sh</thrift.bootstrap.executable>
+        <thrift.configure.executable>./configure</thrift.configure.executable>
+        <thrift.make.executable>make</thrift.make.executable>
+        <thrift.compiler.executable>thrift</thrift.compiler.executable>
+      </properties>
+    </profile>
+    <!-- profile for windows -->
+    <profile>
+      <id>windows</id>
+      <activation>
+        <os>
+          <family>windows</family>
+        </os>
+      </activation>
+      <properties>
+        <os.suffix>win</os.suffix>
+        <os.classifier>windows-x86_64</os.classifier>
+        <cmake.generator>MinGW Makefiles</cmake.generator>
+        <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.zip</boost.url>
+        <boost.bootstrap.executable>bootstrap.bat</boost.bootstrap.executable>
+        <boost.build.executable>${boost.working-directory}/b2.exe</boost.build.executable>
+        <boost.include-directory>libs/libs/boost/include/boost-${boost.version.underline-short}</boost.include-directory>
+        <thrift.bootstrap.executable>bootstrap.sh</thrift.bootstrap.executable>
+        <thrift.configure.executable>configure</thrift.configure.executable>
+        <thrift.make.executable>make</thrift.make.executable>
+        <thrift.compiler.executable>thrift.exe</thrift.compiler.executable>
+      </properties>
+    </profile>
+
     <!--
       This profile is intended to help when having problems with Maven.
       When enabled, it automatically generates an "effective.pom" in the target directory.
diff --git a/tools/pom.xml b/tools/pom.xml
index 9b96d1e..80f05d2 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -50,68 +50,4 @@
     </plugins>
   </build>
 
-  <profiles>
-    <!-- Profile for linux -->
-    <profile>
-      <id>unix</id>
-      <activation>
-        <os>
-          <family>unix</family>
-        </os>
-      </activation>
-      <properties>
-        <os.suffix>linux</os.suffix>
-        <os.classifier>linux-x86_64</os.classifier>
-        <cmake.generator>Unix Makefiles</cmake.generator>
-        <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.tar.gz</boost.url>
-        <boost.bootstrap.executable>./bootstrap.sh</boost.bootstrap.executable>
-        <boost.build.executable>./b2</boost.build.executable>
-        <thrift.bootstrap.executable>./bootstrap.sh</thrift.bootstrap.executable>
-        <thrift.configure.executable>./configure</thrift.configure.executable>
-        <thrift.make.executable>make</thrift.make.executable>
-      </properties>
-    </profile>
-    <!-- Profile for mac -->
-    <profile>
-      <id>max</id>
-      <activation>
-        <os>
-          <family>mac</family>
-        </os>
-      </activation>
-      <properties>
-        <os.suffix>mac</os.suffix>
-        <os.classifier>mac-x86_64</os.classifier>
-        <cmake.generator>Unix Makefiles</cmake.generator>
-        <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.tar.gz</boost.url>
-        <boost.bootstrap.executable>./bootstrap.sh</boost.bootstrap.executable>
-        <boost.build.executable>./b2</boost.build.executable>
-        <thrift.bootstrap.executable>./bootstrap.sh</thrift.bootstrap.executable>
-        <thrift.configure.executable>./configure</thrift.configure.executable>
-        <thrift.make.executable>make</thrift.make.executable>
-      </properties>
-    </profile>
-    <!-- profile for windows -->
-    <profile>
-      <id>windows</id>
-      <activation>
-        <os>
-          <family>windows</family>
-        </os>
-      </activation>
-      <properties>
-        <os.suffix>win</os.suffix>
-        <os.classifier>windows-x86_64</os.classifier>
-        <cmake.generator>MinGW Makefiles</cmake.generator>
-        <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.zip</boost.url>
-        <boost.bootstrap.executable>bootstrap.bat</boost.bootstrap.executable>
-        <boost.build.executable>${boost.working-directory}/b2.exe</boost.build.executable>
-        <boost.include-directory>libs/libs/boost/include/boost-${boost.version.underline-short}</boost.include-directory>
-        <thrift.bootstrap.executable>bootstrap.sh</thrift.bootstrap.executable>
-        <thrift.configure.executable>configure</thrift.configure.executable>
-        <thrift.make.executable>make</thrift.make.executable>
-      </properties>
-    </profile>
-  </profiles>
-
 </project>
\ No newline at end of file
diff --git a/tools/thrift/pom.xml b/tools/thrift/pom.xml
index c7c1ddf..d92828a 100644
--- a/tools/thrift/pom.xml
+++ b/tools/thrift/pom.xml
@@ -89,12 +89,59 @@
       <properties>
         <thrift.with.cpp>ON</thrift.with.cpp>
       </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>3.1.1</version>
+            <executions>
+              <execution>
+                <id>package-thrift-compiler</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+                <configuration>
+                  <finalName>${project.artifactId}</finalName>
+                  <descriptors>
+                    <descriptor>src/assembly/cpp.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
     </profile>
+
     <profile>
       <id>with-python</id>
       <properties>
         <thrift.with.python>ON</thrift.with.python>
       </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>3.1.1</version>
+            <executions>
+              <execution>
+                <id>package-thrift-compiler</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+                <configuration>
+                  <finalName>${project.artifactId}</finalName>
+                  <descriptors>
+                    <descriptor>src/assembly/python.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
     </profile>
 
     <profile>
@@ -172,7 +219,7 @@
                 </goals>
                 <configuration>
                   <sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
-                  <targetPath>${project.build.directory}/make</targetPath>
+                  <targetPath>${project.build.directory}/build</targetPath>
                   <generator>${cmake.generator}</generator>
                   <!--
                     The classifier of the current platform. One of
@@ -184,7 +231,8 @@
                     <!-- Disable testing for now -->
                     <option>-DBUILD_TESTING=OFF</option>
                     <option>-DBUILD_CPP=${thrift.with.cpp}</option>
-                    <option>-DBUILD_JAVA=ON</option>
+                    <!-- Don't build Java, as the libs are available via Maven -->
+                    <option>-DBUILD_JAVA=OFF</option>
                     <option>-DBUILD_PYTHON=${thrift.with.python}</option>
                     <option>-DBUILD_HASKELL=OFF</option>
                   </options>
@@ -203,12 +251,33 @@
                 </goals>
                 <configuration>
                   <!-- The directory where the "generate" step generated the build configuration -->
-                  <projectDirectory>${project.build.directory}/make</projectDirectory>
+                  <projectDirectory>${project.build.directory}/build</projectDirectory>
                   <classifier>${os.classifier}</classifier>
                 </configuration>
               </execution>
             </executions>
           </plugin>
+
+          <!-- Add the thrift compiler executable to the build -->
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>3.1.1</version>
+            <executions>
+              <execution>
+                <id>package-thrift-compiler</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+                <configuration>
+                  <finalName>${project.artifactId}</finalName>
+                  <descriptors>
+                    <descriptor>src/assembly/compiler.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
         </plugins>
       </build>
     </profile>
diff --git a/tools/thrift/src/assembly/compiler.xml b/tools/thrift/src/assembly/compiler.xml
new file mode 100644
index 0000000..ce4140e
--- /dev/null
+++ b/tools/thrift/src/assembly/compiler.xml
@@ -0,0 +1,40 @@
+<!--
+  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.
+  -->
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+
+  <id>compiler-${os.classifier}</id>
+
+  <formats>
+    <format>zip</format>
+  </formats>
+
+  <fileSets>
+    <fileSet>
+      <directory>${project.build.directory}/build/compiler/cpp/bin</directory>
+      <includes>
+        <include>*</include>
+      </includes>
+      <outputDirectory/>
+      <!-- Make sure the files are executable. -->
+      <fileMode>755</fileMode>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file
diff --git a/tools/thrift/src/assembly/cpp.xml b/tools/thrift/src/assembly/cpp.xml
new file mode 100644
index 0000000..c9cc25c
--- /dev/null
+++ b/tools/thrift/src/assembly/cpp.xml
@@ -0,0 +1,39 @@
+<!--
+  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.
+  -->
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+
+  <id>cpp</id>
+
+  <formats>
+    <format>zip</format>
+  </formats>
+
+  <fileSets>
+    <fileSet>
+      <directory>${project.build.directory}/build/compiler/cpp</directory>
+      <includes>
+        <include>*.a</include>
+        <include>*.dylib</include>
+      </includes>
+      <outputDirectory/>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file
diff --git a/tools/thrift/src/assembly/python.xml b/tools/thrift/src/assembly/python.xml
new file mode 100644
index 0000000..bd52b18
--- /dev/null
+++ b/tools/thrift/src/assembly/python.xml
@@ -0,0 +1,39 @@
+<!--
+  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.
+  -->
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+
+  <id>python</id>
+
+  <formats>
+    <format>zip</format>
+  </formats>
+
+  <fileSets>
+    <fileSet>
+      <directory>${project.build.directory}/build/lib/py</directory>
+      <includes>
+        <include>*.a</include>
+        <include>*.dylib</include>
+      </includes>
+      <outputDirectory/>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file