summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMate Szalay-Beko <mszalay@cloudera.com>2019-10-10 14:42:46 +0200
committerAndor Molnar <andor@apache.org>2019-10-10 14:42:46 +0200
commitc9eeeda3bb83ee492a29ccbdc9f9541ee676e578 (patch)
tree9f3fee54679028dd406cb838dd5e5ab858855357
parent11c07921c15e2fb7692375327b53f26a583b77ca (diff)
downloadzookeeper-c9eeeda3bb83ee492a29ccbdc9f9541ee676e578.tar.gz
ZOOKEEPER-3436: Enhance Mavenized Make C client
Based on eolivelli 's [previous pull request](https://github.com/apache/zookeeper/pull/993) we enhanced now the maven C client build: - we can compile now the C-client without tests (using the -DskipTests option) - we can optionally enable the test coverage calculation for the C-client (-Pc-test-coverage) - we also package the C-client into the binary tarball (when -Pfull-build is used) - I also updated the README_packaging.md file to make user's life easier (happier? :) ) I tested the build on ubuntu 16.04. Author: Mate Szalay-Beko <mszalay@cloudera.com> Author: Enrico Olivelli <eolivelli@apache.org> Reviewers: nkalmar@apache.org, eolivelli@apache.org, andor@apache.org Closes #1078 from symat/ZOOKEEPER-3436 and squashes the following commits: 18250df41 [Mate Szalay-Beko] ZOOKEEPER-3436 remove the C binaries from the binary tarball; update the readme files 57b7cd61d [Mate Szalay-Beko] ZOOKEEPER-3436 fixing file permissions of usr/bin/* in binary tarball a2ac025a0 [Mate Szalay-Beko] ZOOKEEPER-3436 enhance / format README_packaging.md 30eea5e27 [Mate Szalay-Beko] ZOOKEEPER-3436 exclude README_packaging.md from license check 936550e48 [Mate Szalay-Beko] ZOOKEEPER-3436 fixing README_packaging.md f01029524 [Mate Szalay-Beko] ZOOKEEPER-3436 Enhance Mavenized Make C client 44f6ba5d2 [Enrico Olivelli] Better .gitignore 204603751 [Enrico Olivelli] Enhance Mavenized Make C client
-rw-r--r--.gitignore15
-rw-r--r--README_packaging.md89
-rw-r--r--README_packaging.txt45
-rw-r--r--build.xml6
-rwxr-xr-xpom.xml2
-rw-r--r--zookeeper-assembly/src/main/assembly/components.xml2
-rwxr-xr-xzookeeper-client/zookeeper-client-c/pom.xml138
7 files changed, 177 insertions, 120 deletions
diff --git a/.gitignore b/.gitignore
index c3a688e15..f8b39ded5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,14 +68,6 @@ tags
.cproject
.project
obj
-zookeeper-client/zookeeper-client-c/core.*
-zookeeper-client/zookeeper-client-c/TEST-*.txt
-zookeeper-client/zookeeper-client-c/*.la
-zookeeper-client/zookeeper-client-c/*.lo
-zookeeper-client/zookeeper-client-c/*.o
-zookeeper-client/zookeeper-client-c/generated/
-zookeeper-server/src/main/resources/lib/ant-eclipse-*
-zookeeper-server/src/main/resources/lib/ivy-*
zookeeper-client/zookeeper-client-c/Makefile.in
zookeeper-client/zookeeper-client-c/aclocal.m4
zookeeper-client/zookeeper-client-c/autom4te.cache/
@@ -88,7 +80,12 @@ zookeeper-client/zookeeper-client-c/depcomp
zookeeper-client/zookeeper-client-c/install-sh
zookeeper-client/zookeeper-client-c/ltmain.sh
zookeeper-client/zookeeper-client-c/missing
-zookeeper-server/src/test/resources/
+zookeeper-client/zookeeper-client-c/TEST-*.txt
+zookeeper-client/zookeeper-client-c/generated/
+zookeeper-server/src/main/resources/lib/ant-eclipse-*
+zookeeper-server/src/main/resources/lib/ivy-*
+zookeeper-server/src/main/java/org/apache/zookeeper/version/Info.java
+zookeeper-server/src/main/java/org/apache/zookeeper/version/VersionInfoMain.java
# Python
*.py[cod]
diff --git a/README_packaging.md b/README_packaging.md
new file mode 100644
index 000000000..fe731a7ff
--- /dev/null
+++ b/README_packaging.md
@@ -0,0 +1,89 @@
+# README file for Packaging Notes
+
+The ZooKeeper project publishes releases as tarballs. For ZooKeeper packages
+specific to your OS (such as rpm and deb), consider using Apache Bigtop:
+
+http://bigtop.apache.org/
+
+
+## Requirements
+
+- ant (recommended version 1.9.4 or later for concurrent JUnit test execution) or maven to build the java code
+- gcc, cppunit and python-setuptools are required to build C and python bindings.
+
+On RHEL machine:
+
+```
+yum install cppunit
+yum install python-setuptools
+```
+
+On Ubuntu:
+
+```
+apt-get install cppunit
+apt-get install python-setuptools
+```
+
+
+## Package build command (using maven)
+
+Commands to clean everything and build the tarball package without executing the tests: `mvn clean install -DskipTests`
+
+
+`zookeeper-assembly/target/apache-zookeeper-<version>-bin.tar.gz` tarball file structure layout:
+
+- `/bin` - User executables
+- `/conf` - Configuration files
+- `/lib` - ZooKeeper JAR files and all the required java library dependencies
+- `/docs` - Documents
+
+Beside the binary tarball, you can find the whole original source project packaged into:
+`zookeeper-assembly/target/apache-zookeeper-<version>.tar.gz`
+
+
+### Building the C client (using maven)
+
+To also build the C client, you need to activate the `full-build` profile:
+
+```
+mvn clean -Pfull-build
+mvn install -Pfull-build -DskipTests
+```
+
+Optional parameters you might consider when using maven:
+- `-Pfull-build` - activates the full-build profile, causing the C client to be built
+- `-DskipTests` - this parameter will skip both java and C++ unit test execution during the build
+- `-Pc-test-coverage` - activates the test coverage calculation during the execution of C client tests
+
+Please note: if you don't provide the `-Pfull-build` parameter, then the C client will not be built, the C client tests
+will not be executed and the previous C client builds will no be cleaned up (e.g. with simply using `mvn clean`).
+
+The compiled C client can be found here:
+- `zookeeper-client/zookeeper-client-c/target/c/bin` - User executable
+- `zookeeper-client/zookeeper-client-c/target/c/lib` - Native libraries
+- `zookeeper-client/zookeeper-client-c/target/c/include/zookeeper` - Native library headers
+
+
+## Package build command (using ant)
+
+**Command to build tarball package:** `ant tar`
+
+`zookeeper-<version>.tar.gz` tarball file structure layout:
+
+- `/bin` - User executable
+- `/sbin` - System executable
+- `/libexec` - Configuration boot trap script
+- `/lib` - Library dependencies
+- `/docs` - Documents
+- `/share/zookeeper` - Project files
+
+
+**Command to build tarball package with native components:** `ant package-native tar`
+
+`zookeeper-<version>-lib.tar.gz` tarball file structure layout:
+
+- `/bin` - User executable
+- `/lib` - Native libraries
+- `/include/zookeeper` - Native library headers
+
diff --git a/README_packaging.txt b/README_packaging.txt
deleted file mode 100644
index 9776f74ca..000000000
--- a/README_packaging.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-README file for Packaging Notes
-
-Requirement
------------
-
-ant (recommended version 1.9.4 or later for concurrent JUnit test execution)
-gcc, cppunit and python-setuptools are required to build
-C and python bindings.
-
-On RHEL machine:
-
-yum install cppunit
-yum install python-setuptools
-
-On Ubuntu:
-
-apt-get --install cppunit
-apt-get --install python-setuptools
-
-Package build command
----------------------
-
-The ZooKeeper project publishes releases as tarballs. For ZooKeeper packages
-specific to your OS (such as rpm and deb), consider using Apache Bigtop:
-
-http://bigtop.apache.org/
-
-Command to build tarball package: ant tar
-
-zookeeper-<version>.tar.gz tarball file structure layout
-
- /bin - User executable
- /sbin - System executable
- /libexec - Configuration boot trap script
- /lib - Library dependencies
- /docs - Documents
- /share/zookeeper - Project files
-
-Command to build tarball package with native components: ant package-native tar
-
-zookeeper-<version>-lib.tar.gz tarball file structure layout
-
- /bin - User executable
- /lib - Native libraries
- /include/zookeeper - Native library headers
diff --git a/build.xml b/build.xml
index ea856ce5b..da4ab2e0c 100644
--- a/build.xml
+++ b/build.xml
@@ -875,7 +875,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
<copy todir="${dist.dir}">
<fileset file="CHANGES.txt"/>
<fileset file="README.md"/>
- <fileset file="README_packaging.txt"/>
+ <fileset file="README_packaging.md"/>
<fileset file="build.xml"/>
<fileset file="ivy.xml"/>
<fileset file="ivysettings.xml"/>
@@ -1004,7 +1004,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
<copy todir="${dist.dir}">
<fileset file="CHANGES.txt"/>
<fileset file="README.md"/>
- <fileset file="README_packaging.txt"/>
+ <fileset file="README_packaging.md"/>
<fileset file="build.xml"/>
<fileset file="ivy.xml"/>
<fileset file="ivysettings.xml"/>
@@ -1760,7 +1760,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
<exclude name="**/wrappers*.opt"/>
<exclude name="CHANGES.txt"/>
<exclude name="**/README.md"/>
- <exclude name="README_packaging.txt"/>
+ <exclude name="README_packaging.md"/>
<exclude name="**/TODO"/>
<exclude name="**/VERSION"/>
<exclude name="**/ChangeLog"/>
diff --git a/pom.xml b/pom.xml
index 9dd967983..a08bb25e1 100755
--- a/pom.xml
+++ b/pom.xml
@@ -789,7 +789,7 @@
<exclude>conf/configuration.xsl</exclude>
<exclude>.travis.yml</exclude>
<exclude>excludeFindBugsFilter.xml</exclude>
- <exclude>README_packaging.txt</exclude>
+ <exclude>README_packaging.md</exclude>
<exclude>src/main/resources/markdown/skin/*</exclude>
<exclude>src/main/resources/markdown/html/*</exclude>
<exclude>src/main/resources/markdown/images/*</exclude>
diff --git a/zookeeper-assembly/src/main/assembly/components.xml b/zookeeper-assembly/src/main/assembly/components.xml
index 2510db1ba..e0df12bec 100644
--- a/zookeeper-assembly/src/main/assembly/components.xml
+++ b/zookeeper-assembly/src/main/assembly/components.xml
@@ -29,7 +29,7 @@
<include>NOTICE.txt</include>
<include>LICENSE.txt</include>
<include>README.md</include>
- <include>README_packaging.txt</include>
+ <include>README_packaging.md</include>
</includes>
<fileMode>${rw.file.permission}</fileMode>
</fileSet>
diff --git a/zookeeper-client/zookeeper-client-c/pom.xml b/zookeeper-client/zookeeper-client-c/pom.xml
index 82948105d..e3703f1f8 100755
--- a/zookeeper-client/zookeeper-client-c/pom.xml
+++ b/zookeeper-client/zookeeper-client-c/pom.xml
@@ -33,54 +33,33 @@
<name>Apache ZooKeeper - Client - C</name>
<description>ZooKeeper c client</description>
+ <profiles>
+ <profile>
+ <id>c-test-coverage</id>
+ <properties>
+ <c-test-coverage-arg>--enable-gcov</c-test-coverage-arg>
+ </properties>
+ </profile>
+ <profile>
+ <id>no-c-test-coverage</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <c-test-coverage-arg> </c-test-coverage-arg>
+ </properties>
+ </profile>
+ </profiles>
+
<build>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <mkdir dir="target/c" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>test-cppunit</id>
- <phase>test</phase>
- <configuration>
- <!-- do not run cpp tests if tests are globally skipped -->
- <skip>${skipTests}</skip>
- <tasks>
- <exec dir="${basedir}/target/c" executable="make" failonerror="true">
- <env key="LD_LIBRARY_PATH" value="${env.LD_LIBRARY_PATH};/usr/lib" />
- <env key="PATH" path="${env.PATH};${basedir};" />
- <env key="CALLER" value="ANT" />
- <env key="CLOVER_HOME" value="${basedir}/../../zookeeper-server/target" />
- <env key="base_dir" value="${basedir}/../.." />
- <arg line="clean check" />
- </exec>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>autoreconf</id>
- <phase>test-compile</phase>
+ <phase>process-sources</phase>
<goals>
<goal>exec</goal>
</goals>
@@ -97,7 +76,7 @@
</execution>
<execution>
<id>configure</id>
- <phase>test-compile</phase>
+ <phase>process-sources</phase>
<goals>
<goal>exec</goal>
</goals>
@@ -110,34 +89,71 @@
</environmentVariables>
<arguments>
<argument>--prefix=${project.build.directory}/c</argument>
- <argument>--enable-gcov</argument>
+ <argument>${c-test-coverage-arg}</argument>
</arguments>
</configuration>
</execution>
- <!--execution> TODO: Why is this not working?!
- <id>test-cppunit</id>
- <phase>test</phase>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target/c" />
+ </tasks>
+ </configuration>
<goals>
- <goal>exec</goal>
+ <goal>run</goal>
</goals>
+ </execution>
+ <execution>
+ <id>build-c-client</id>
+ <phase>compile</phase>
<configuration>
- <workingDirectory>${project.build.directory}/c</workingDirectory>
- <executable>make</executable>
- <environmentVariables>
- <LD_LIBRARY_PATH>${env.LD_LIBRARY_PATH};/usr/lib</LD_LIBRARY_PATH>
- <PATH>${env.PATH};${project.basedir};</PATH>
- <CALLER>ANT</CALLER>
- <CLOVER_HOME></CLOVER_HOME>
- <base_dir>${project.basedir}/../..</base_dir>
- </environmentVariables>
- <arguments>
- <argument>clean check</argument>
- </arguments>
+ <tasks>
+ <exec dir="${basedir}/target/c" executable="make" failonerror="true">
+ <env key="LD_LIBRARY_PATH" value="${env.LD_LIBRARY_PATH};/usr/lib" />
+ <env key="PATH" path="${env.PATH};${basedir};" />
+ <env key="CALLER" value="ANT" />
+ <env key="CLOVER_HOME" value="${basedir}/../../zookeeper-server/target" />
+ <env key="base_dir" value="${basedir}/../.." />
+ <arg line="clean install" />
+ </exec>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>test-cppunit</id>
+ <phase>test</phase>
+ <configuration>
+ <!-- do not run cpp tests if tests are globally skipped -->
+ <skip>${skipTests}</skip>
+ <tasks>
+ <exec dir="${basedir}/target/c" executable="make" failonerror="true">
+ <env key="LD_LIBRARY_PATH" value="${env.LD_LIBRARY_PATH};/usr/lib" />
+ <env key="PATH" path="${env.PATH};${basedir};" />
+ <env key="CALLER" value="ANT" />
+ <env key="CLOVER_HOME" value="${basedir}/../../zookeeper-server/target" />
+ <env key="base_dir" value="${basedir}/../.." />
+ <arg line="check" />
+ </exec>
+ </tasks>
</configuration>
- </execution-->
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
</plugins>
</build>
-</project> \ No newline at end of file
+</project>