You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2016/08/09 15:51:25 UTC
svn commit: r1755627 - in /openoffice/trunk/main: configure.ac set_soenv.in
solenv/gbuild/JunitTest.mk
Author: damjan
Date: Tue Aug 9 15:51:25 2016
New Revision: 1755627
URL: http://svn.apache.org/viewvc?rev=1755627&view=rev
Log:
Modern versions of JUnit need the hamcrest-core JAR.
Patch by: me
Modified:
openoffice/trunk/main/configure.ac
openoffice/trunk/main/set_soenv.in
openoffice/trunk/main/solenv/gbuild/JunitTest.mk
Modified: openoffice/trunk/main/configure.ac
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/configure.ac?rev=1755627&r1=1755626&r2=1755627&view=diff
==============================================================================
--- openoffice/trunk/main/configure.ac (original)
+++ openoffice/trunk/main/configure.ac Tue Aug 9 15:51:25 2016
@@ -680,10 +680,17 @@ AC_ARG_WITH(ant-home,
AC_ARG_WITH(junit,
[ --with-junit Specifies the JUnit 4 jar file to use for JUnit-based
tests. --without-junit disables those tests. Not
- relevant in the --without-java case.
+ relevant in the --without-java case. The --with-hamcrest-core
+ option is also necessary.
Usage: --with-junit=<absolute path to JUnit 4 jar>
],,with_junit=yes)
+AC_ARG_WITH(hamcrest-core,
+[ --with-hamcrest-core Specifies the hamcrest-core 1.3 jar file to use for
+ JUnit-based tests. --without-junit disables those
+ tests. Not relevant in the --without-java or
+ --without-junit cases.
+],,with_hamcrest_core=yes)
AC_ARG_WITH(perl-home,
[ --with-perl-home If you have installed the Perl 5 Distribution, on your
system, please supply the path here.
@@ -7001,8 +7008,9 @@ fi
rm -f conftest* core core.* *.core
OOO_JUNIT_JAR=
-if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
- AC_MSG_CHECKING([for JUnit 4])
+HAMCREST_CORE_JAR=
+if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no" && test "$with_hamcrest_core" != "no"; then
+ AC_MSG_CHECKING([for JUnit >= 4.11])
if test "$with_junit" = "yes"; then
if test -e /usr/share/java/junit4.jar; then
OOO_JUNIT_JAR=/usr/share/java/junit4.jar
@@ -7019,18 +7027,82 @@ if test "$SOLAR_JAVA" != "" && test "$wi
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
+ export OOO_JUNIT_JAR
+ if $PERL -e 'use Archive::Zip;
+ my $file = "$ENV{'OOO_JUNIT_JAR'}";
+ if (! -f $file) {
+ exit 1;
+ }
+ my $zip = Archive::Zip->new( $file );
+ my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
+ push @l, split(/\n/, $mf);
+ foreach my $line (@l) {
+ if ($line =~ m/Implementation-Version:/) {
+ ($t, $version) = split (/:/,$line);
+ $version =~ s/^\s//;
+ ($a, $b, $c, $d) = split (/\./,$version);
+ if ($a == 4 && $b >= 11) {
+ exit 0;
+ } else {
+ exit 1;
+ }
+ }
+ }
+ exit 1;
+ '; then
AC_MSG_RESULT([$OOO_JUNIT_JAR])
else
AC_MSG_RESULT([no])
- AC_MSG_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])
+ AC_MSG_ERROR([cannot find JUnit >= 4.11 jar; please install one in the default location (/usr/share/java), specify its pathname via --with-junit=..., or disable it via --without-junit])
+ fi
+
+ AC_MSG_CHECKING([for hamcrest-core 1.3])
+ if test "$with_hamcrest_core" = "yes"; then
+ if test -e /usr/share/java/hamcrest-core-1.3.jar; then
+ HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core-1.3.jar
+ else
+ if test -e /usr/share/lib/java/hamcrest-core.jar; then
+ HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest-core.jar
+ else
+ HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core.jar
+ fi
+ fi
+ else
+ HAMCREST_CORE_JAR=$with_hamcrest_core
+ fi
+ if test "$_os" = "WINNT"; then
+ HAMCREST_CORE_JAR=`cygpath -m "$HAMCREST_CORE_JAR"`
+ fi
+ export HAMCREST_CORE_JAR
+ if $PERL -e 'use Archive::Zip;
+ my $file = "$ENV{'HAMCREST_CORE_JAR'}";
+ if (! -f $file) {
+ exit 1;
+ }
+ my $zip = Archive::Zip->new( $file );
+ my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
+ push @l, split(/\n/, $mf);
+ foreach my $line (@l) {
+ if ($line =~ m/Implementation-Version:/) {
+ ($t, $version) = split (/:/,$line);
+ $version =~ s/^\s//;
+ ($a, $b, $c, $d) = split (/\./,$version);
+ if ($a == 1 && $b == 3) {
+ exit 0;
+ } else {
+ exit 1;
+ }
+ }
+ }
+ exit 1;
+ '; then
+ AC_MSG_RESULT([$HAMCREST_CORE_JAR])
+ else
+ AC_MSG_ERROR([cannot find hamcrest-core 1.3 jar; please install one in the default location (/usr/share/java), specify its pathname via --with-hamcrest-core=..., or disable it via --without-junit or --without-hamcrest-core])
fi
fi
AC_SUBST(OOO_JUNIT_JAR)
+AC_SUBST(HAMCREST_CORE_JAR)
AC_MSG_CHECKING([which languages to be built])
WITH_LANG="$with_lang"
Modified: openoffice/trunk/main/set_soenv.in
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/set_soenv.in?rev=1755627&r1=1755626&r2=1755627&view=diff
==============================================================================
--- openoffice/trunk/main/set_soenv.in (original)
+++ openoffice/trunk/main/set_soenv.in Tue Aug 9 15:51:25 2016
@@ -1641,6 +1641,7 @@ ToFile( "ENABLE_PDFIMPORT", "@ENABLE_PD
ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
ToFile( "OOO_JUNIT_JAR", "@OOO_JUNIT_JAR@", "e" );
+ToFile( "HAMCREST_CORE_JAR", "@HAMCREST_CORE_JAR@","e" );
ToFile( "SAC_JAR", "@SAC_JAR@", "e" );
ToFile( "LIBXML_JAR", "@LIBXML_JAR@", "e" );
ToFile( "FLUTE_JAR", "@FLUTE_JAR@", "e" );
Modified: openoffice/trunk/main/solenv/gbuild/JunitTest.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/gbuild/JunitTest.mk?rev=1755627&r1=1755626&r2=1755627&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/gbuild/JunitTest.mk (original)
+++ openoffice/trunk/main/solenv/gbuild/JunitTest.mk Tue Aug 9 15:51:25 2016
@@ -46,7 +46,7 @@ $(call gb_JunitTest_get_target,%) :
$(CLEAN_CMD)
define gb_JunitTest_JunitTest
-$(call gb_JunitTest_get_target,$(1)) : CLASSPATH := $(value XCLASSPATH)$(gb_CLASSPATHSEP)$(call gb_JavaClassSet_get_classdir,$(call gb_JunitTest_get_classsetname,$(1)))$(gb_CLASSPATHSEP)$(OOO_JUNIT_JAR)$(gb_CLASSPATHSEP)$(OUTDIR)/lib
+$(call gb_JunitTest_get_target,$(1)) : CLASSPATH := $(value XCLASSPATH)$(gb_CLASSPATHSEP)$(call gb_JavaClassSet_get_classdir,$(call gb_JunitTest_get_classsetname,$(1)))$(gb_CLASSPATHSEP)$(OOO_JUNIT_JAR)$(gb_CLASSPATHSEP)$(HAMCREST_CORE_JAR)$(gb_CLASSPATHSEP)$(OUTDIR)/lib
$(call gb_JunitTest_get_target,$(1)) : CLASSES :=
$(call gb_JunitTest_JunitTest_platform,$(1))