Change proton's build systems to allow for the creation of a Java binding for proton-c.

Details

Description

The catalyst for this work was the need to conveniently build and test the JNI bindings created in PROTON-192. However, there are a number of other requirements for our build system that are worth reiterating.

Activity

Ideally I think you would not want to impose java's toolchain on C developers (or indeed C's toolchain on java developers). Clearly those working on the JNI implementation would have both as would many core developers. But being able to build and run available tests using only one toolchain (e.g. either mvn and javac or cmake, make and gcc) would in my view be beneficial if we can find a good way to accommodate that. This is especially important for releases (but I think also nice for building from svn).

Gordon Sim
added a comment - 21/Jan/13 19:02 Ideally I think you would not want to impose java's toolchain on C developers (or indeed C's toolchain on java developers). Clearly those working on the JNI implementation would have both as would many core developers. But being able to build and run available tests using only one toolchain (e.g. either mvn and javac or cmake, make and gcc) would in my view be beneficial if we can find a good way to accommodate that. This is especially important for releases (but I think also nice for building from svn).

Philip Harvey
added a comment - 25/Jan/13 14:25 Discussions on how to implement this JIRA are primarily on the Proton mailing list in the thread titled "Changing the Proton build system to accommodate jni bindings": http://mail-archives.apache.org/mod_mbox/qpid-proton/201301.mbox/browser

The changes on the jni-branch are nearing completion. The changes with respect to current trunk are summarised below.

README/LICENSE files-

README/LICENCE files have been moved to the proton level. The README has been updated to reflect the new practice.

Building Proton-C

Build is now performed from the parent (proton) directory rather than proton-c.
If Cmake can find the JDK, proton-api and proton-jni will be built, otherwise they are skipped
If Cmake can find** Bouncycastle JARs, proton-j-impl will be built, otherwise it is skipped.

cd proton
mkdir build
cd build
cmake ..
...

JAR search path is defined by Cmake's find_jar() function as /usr/share/java/ and /usr/local/share/java/. This can be supplemented on the command line via:

cmake -DPROTON_JAR_DEPEND_DIR=... ..

Testing Proton-C (Python tests)

proton-test script and the Python tests have moved to accommodate tests written in other languages.

cd proton
. ./config.sh
./tests/python/proton-test

Building Proton-J

Build is now performed from the parent (proton) directory rather than proton-j.

Keith Wall
added a comment - 30/Jan/13 16:35 The changes on the jni-branch are nearing completion. The changes with respect to current trunk are summarised below.
README/LICENSE files-
README/LICENCE files have been moved to the proton level. The README has been updated to reflect the new practice.
Building Proton-C
Build is now performed from the parent (proton) directory rather than proton-c.
If Cmake can find the JDK, proton-api and proton-jni will be built, otherwise they are skipped
If Cmake can find** Bouncycastle JARs, proton-j-impl will be built, otherwise it is skipped.
cd proton
mkdir build
cd build
cmake ..
...
JAR search path is defined by Cmake's find_jar() function as /usr/share/java/ and /usr/local/share/java/. This can be supplemented on the command line via:
cmake -DPROTON_JAR_DEPEND_DIR=... ..
Testing Proton-C (Python tests)
proton-test script and the Python tests have moved to accommodate tests written in other languages.
cd proton
. ./config.sh
./tests/python/proton-test
Building Proton-J
Build is now performed from the parent (proton) directory rather than proton-j.
Typical maven commands:
mvn compile -DskipTests # compile everything, skipping the tests
mvn package # package everything
Testing Proton-J/Proton-C via JNI bindings
mvn test -Pproton-j # Run all system tests against proton-j
mvn test -Pproton-jnj # Run all system tests against proton-c using jni wrappers ***
mvn test -Pproton-j -Dproton.pythontest.pattern='proton_tests.transport.TransportTest.*' # Run Python tests matching patterm
you need to have previously built proton-c with the JNI bindings.