On 11/16/2013 09:54 AM, Alexander Thurgood wrote:
Le 15/11/13 13:48, Noel Grandin a écrit :
You need to do:

./autogen.sh --with-junit=/opt/local/share/java/junit-4.jar

or whatever your jar file name is.

Having tried this for a while the day before yesterday on OSX Mavericks,
with the latest hamcrest or junit from the project's download page, I
can confirm that I couldn't get this to work either.

There is two problems:

First, recent Junit as downloaded from <https://github.com/junit-team/junit/wiki/Download-and-Install> is split in two jars of which the junit-4.11.jar does not include the hamcrest-core-1.3.jar on its manifest Class-Path.

What worked for me is to run the attached Makefile and junit-manifest from some directory X and include --with-junit=X/junit.jar in LO's autogen.input.

However, the second problem is that LO's configure.ac "manually" inspects the given junit.jar to check it contains the class files of both junit and hamcrest. The attached configure.patch improves on that by instead using javah with -classpath junit.jar to check that the class files of both junit and hamcrest are available through the given junit.jar. But that trick apparently does not work with all versions of javah, so I did not push that patch. The best fix probably is to use javac with -classpath junit.jar for the check.

Stephan
diff --git a/configure.ac b/configure.ac
index 44dcde8..26c1147 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11979,13 +11979,14 @@ if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
     if test "$_os" = "WINNT"; then
         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
     fi
-    "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
-        grep org/junit/Before.class > /dev/null 2>&5
-    if test $? -eq 0; then
+    if "$JAVA_HOME/bin/javah" -o conftestj -classpath "$OOO_JUNIT_JAR" \
+        org.junit.Before > /dev/null 2>&5
+    then
         # check if either class-path entry is available for hamcrest or
         # it's bundled
-        if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
-            "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
+        if "$JAVA_HOME/bin/javah" -o conftestj -classpath "$OOO_JUNIT_JAR" \
+            org.hamcrest.BaseDescription > /dev/null 2>&5
+        then
             AC_MSG_RESULT([$OOO_JUNIT_JAR])
         else
             AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
@@ -11997,6 +11998,7 @@ provide a full junit jar or use --without-junit])
 location (/usr/share/java), specify its pathname via
 --with-junit=..., or disable it via --without-junit])
     fi
+    rm conftestj
     if test $OOO_JUNIT_JAR != ""; then
     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
     fi
Class-Path: junit-4.11.jar hamcrest-core-1.3.jar
junit.jar: hamcrest-core-1.3.jar junit-4.11.jar junit-manifest
        jar cmf junit-manifest junit.jar

hamcrest-core-1.3.jar:
        wget 
http://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
 -O hamcrest-core-1.3.jar

junit-4.11.jar:
        wget 
http://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11.jar 
-O junit-4.11.jar
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to