Re: junit autogen error?

2014-02-25 Thread Stephan Bergmann

On 11/19/2013 09:11 AM, Stephan Bergmann wrote:

The best fix probably is to use javac with -classpath junit.jar for
the check.


Fixed with 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=ded6334f7016cb59dcb140a23339b1ca3418ca8c 
Make JUnit/Hamcrest detection more flexible now.


Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: junit autogen error?

2013-11-20 Thread Stephan Bergmann

On 11/19/2013 11:58 AM, d.ostrov...@idaia.de wrote:

On Tue Nov 19 00:11:49 PST 2013 Stephan Bergmann wrote:


The best fix probably is to use javac with -classpath junit.jar for
the check.


You can use javap to check the existence of java classes in a JAR:


Nah, that unfortunately doesn't work universally either.  (Forgot 
exactly where it caused problems, but I had tried both, javah and javap, 
and neither did it in all cases.)


Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: junit autogen error?

2013-11-19 Thread Stephan Bergmann

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 25 | \
-grep org/junit/Before.class  /dev/null 25
-if test $? -eq 0; then
+if $JAVA_HOME/bin/javah -o conftestj -classpath $OOO_JUNIT_JAR \
+org.junit.Before  /dev/null 25
+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 25
+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


Re: junit autogen error?

2013-11-19 Thread Joseph Pellegrino

Thanks for the suggestion Noel. I tried that and got a similar message:

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

checking for JUnit 4... configure: error: your junit jar neither sets a 
classpath nor includes hamcrest; please
provide a full junit jar or use --without-junit
Error running configure at ./autogen.sh line 209.

I should mention that I also tried to set the classpath environment variable 
and got the same result.


On Nov 15, 2013, at 7:48 AM, Noel Grandin n...@peralex.com wrote:

 On 2013-11-13 04:14, Joseph Pellegrino wrote:
 When I specify the junit path:
 
 ./autogen.sh --with-junit=/opt/local/share/java/
 
 
 
 You need to do:
 
 ./autogen.sh --with-junit=/opt/local/share/java/junit-4.jar
 
 or whatever your jar file name is.
 
 
 
 Disclaimer: http://www.peralex.com/disclaimer.html
 

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: junit autogen error?

2013-11-19 Thread d . ostrovsky

On Tue Nov 19 00:11:49 PST 2013 Stephan Bergmann wrote:

The best fix probably is to use javac with -classpath junit.jar for  
the check.


You can use javap to check the existence of java classes in a JAR:

$javap -classpath /Users/davido/Downloads/junit4.11/junit-4.11.jar  
org.hamcrest.Matcher  /dev/null

$echo $?

$javap -classpath /Users/davido/Downloads/junit4.11/junit-4.11.jar  
org.hamcrest.Matcher2  /dev/null

$echo $?
1

David
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: junit autogen error?

2013-11-16 Thread Alexander Thurgood
Le 15/11/13 13:48, Noel Grandin a écrit :

Hi Noel,



 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.


Alex


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: junit autogen error?

2013-11-16 Thread Tor Lillqvist
For me it works if I point the --with-junit to an older junit jar
file, not a too new one.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


junit autogen error?

2013-11-15 Thread Joseph Pellegrino
I am not sure if this is the right list to post this question if not please 
accept my apologies and let me know which is the appropriate list. I’ve also 
tried to find similar posts along this line but I didn’t find one. Anyhow, I 
recently checked out the current version of LO (git clone 
git://gerrit.libreoffice.org/core) and tried to run the build configuration 
(autogen.sh) and ultimately got the following error:

checking for JUnit 4... no
configure: error: cannot find JUnit 4 jar; please install one in the default
location (/usr/share/java), specify its pathname via
--with-junit=..., or disable it via --without-junit
Error running configure at ./autogen.sh line 209.

When I specify the junit path:

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

I get the same error. I’ve tried several versions of junit with different 
versions of hamcrest but can’t seem to get a successful configuration without 
excluding junit. I am wondering if anyone could give me a hint as to the issue.

Some additional information:

OS X v10.9
junit-4.11, hamcrest-core-1.3

$ automake --version
automake (GNU automake) 1.14

$ gcc -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: junit autogen error?

2013-11-15 Thread Noel Grandin

On 2013-11-13 04:14, Joseph Pellegrino wrote:

When I specify the junit path:

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




You need to do:

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

or whatever your jar file name is.

Disclaimer: http://www.peralex.com/disclaimer.html


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice