Skip to content

Commit f010295

Browse files
author
Mate Szalay-Beko
committed
ZOOKEEPER-3436 Enhance Mavenized Make C client
1 parent 44f6ba5 commit f010295

7 files changed

Lines changed: 112 additions & 49 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ found in zookeeper-assembly/target directory after building the project with mav
2828

2929
Contains all the jar files required to run ZooKeeper
3030
Full documentation can also be found in the docs folder
31+
The compiled C-client is located in the /usr folder (if the build profile `-Pfull-build` used during maven install)
3132

3233
As of version 3.5.5, the parent, zookeeper and zookeeper-jute artifacts
3334
are deployed to the central repository after the release

README_packaging.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# README file for Packaging Notes
2+
3+
The ZooKeeper project publishes releases as tarballs. For ZooKeeper packages
4+
specific to your OS (such as rpm and deb), consider using Apache Bigtop:
5+
6+
http://bigtop.apache.org/
7+
8+
9+
## Requirements
10+
11+
ant (recommended version 1.9.4 or later for concurrent JUnit test execution) or maven
12+
gcc, cppunit and python-setuptools are required to build
13+
C and python bindings.
14+
15+
On RHEL machine:
16+
17+
`yum install cppunit`
18+
`yum install python-setuptools`
19+
20+
On Ubuntu:
21+
22+
`apt-get --install cppunit`
23+
`apt-get --install python-setuptools`
24+
25+
26+
27+
## Package build command (using ant)
28+
29+
Command to build tarball package: `ant tar`
30+
31+
`zookeeper-<version>.tar.gz` tarball file structure layout
32+
33+
/bin - User executable
34+
/sbin - System executable
35+
/libexec - Configuration boot trap script
36+
/lib - Library dependencies
37+
/docs - Documents
38+
/share/zookeeper - Project files
39+
40+
Command to build tarball package with native components: `ant package-native tar`
41+
42+
`zookeeper-<version>-lib.tar.gz` tarball file structure layout
43+
44+
/bin - User executable
45+
/lib - Native libraries
46+
/include/zookeeper - Native library headers
47+
48+
49+
## Package build command (using maven)
50+
51+
Command to clean everything and build the tarball package without executing the tests:
52+
`mvn clean -Pfull-build && mvn install -Pfull-build -DskipTests`
53+
54+
55+
Optional parameters you might consider when using maven:
56+
`-DskipTests` - this parameter will skip both java and C++ unit test execution during the build
57+
`-Pfull-build` - activates the full-build profile, causing the C client to be built
58+
`-Pc-test-coverage=true` - activates the test coverage calculation during the execution of C client tests
59+
60+
61+
Please note: if you don't provide the `-Pfull-build` parameter, then the C client will not be built, the C client tests
62+
will not be executed and the previous C client builds will no be cleaned up (e.g. with 'mvn clean').
63+
64+
`zookeeper-assembly/target/apache-zookeeper-<version>-bin.tar.gz` tarball file structure layout
65+
66+
/bin - User executables
67+
/conf - Configuration files
68+
/lib - ZooKeeper JAR files and all the required java library dependencies
69+
/docs - Documents
70+
/usr - Native artifacts (only present if `-Pfull-build` used)
71+
/usr/bin - User executable
72+
/usr/lib - Native libraries
73+
/usr/include/zookeeper - Native library headers
74+
75+
76+
Beside the binary tarball, you can find the whole original source project packaged into:
77+
`zookeeper-assembly/target/apache-zookeeper-<version>.tar.gz`

README_packaging.txt

Lines changed: 0 additions & 45 deletions
This file was deleted.

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
875875
<copy todir="${dist.dir}">
876876
<fileset file="CHANGES.txt"/>
877877
<fileset file="README.md"/>
878-
<fileset file="README_packaging.txt"/>
878+
<fileset file="README_packaging.md"/>
879879
<fileset file="build.xml"/>
880880
<fileset file="ivy.xml"/>
881881
<fileset file="ivysettings.xml"/>
@@ -1004,7 +1004,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
10041004
<copy todir="${dist.dir}">
10051005
<fileset file="CHANGES.txt"/>
10061006
<fileset file="README.md"/>
1007-
<fileset file="README_packaging.txt"/>
1007+
<fileset file="README_packaging.md"/>
10081008
<fileset file="build.xml"/>
10091009
<fileset file="ivy.xml"/>
10101010
<fileset file="ivysettings.xml"/>

zookeeper-assembly/src/main/assembly/bin-package.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@
7070
<fileMode>${rw.file.permission}</fileMode>
7171
<directoryMode>${rwx.file.permission}</directoryMode>
7272
</fileSet>
73+
<fileSet>
74+
<!-- ZooKeeper C client -->
75+
<directory>${project.basedir}/../zookeeper-client/zookeeper-client-c/target/c</directory>
76+
<outputDirectory>usr</outputDirectory>
77+
<includes>
78+
<include>bin/*</include>
79+
<include>include/**/*</include>
80+
<include>lib/*</include>
81+
</includes>
82+
<fileMode>${rw.file.permission}</fileMode>
83+
<directoryMode>${rwx.file.permission}</directoryMode>
84+
</fileSet>
7385
<fileSet>
7486
<!-- License files for 3rd party libs -->
7587
<directory>${project.basedir}/../zookeeper-server/src/main/resources/lib</directory>

zookeeper-assembly/src/main/assembly/components.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<include>NOTICE.txt</include>
3030
<include>LICENSE.txt</include>
3131
<include>README.md</include>
32-
<include>README_packaging.txt</include>
32+
<include>README_packaging.md</include>
3333
</includes>
3434
<fileMode>${rw.file.permission}</fileMode>
3535
</fileSet>

zookeeper-client/zookeeper-client-c/pom.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@
3333
<name>Apache ZooKeeper - Client - C</name>
3434
<description>ZooKeeper c client</description>
3535

36+
<profiles>
37+
<profile>
38+
<id>c-test-coverage</id>
39+
<properties>
40+
<c-test-coverage-arg>--enable-gcov</c-test-coverage-arg>
41+
</properties>
42+
</profile>
43+
<profile>
44+
<id>no-c-test-coverage</id>
45+
<activation>
46+
<activeByDefault>true</activeByDefault>
47+
</activation>
48+
<properties>
49+
<c-test-coverage-arg> </c-test-coverage-arg>
50+
</properties>
51+
</profile>
52+
</profiles>
53+
3654
<build>
3755
<plugins>
3856
<plugin>
@@ -71,7 +89,7 @@
7189
</environmentVariables>
7290
<arguments>
7391
<argument>--prefix=${project.build.directory}/c</argument>
74-
<argument>--enable-gcov</argument>
92+
<argument>${c-test-coverage-arg}</argument>
7593
</arguments>
7694
</configuration>
7795
</execution>

0 commit comments

Comments
 (0)