Add support for external hamcrest when using junit 4.11+
Starting with junit 4.11 hamcrest is no longer bundled, so add a --with-hamcrest option to support this. Change-Id: Icdae946af82b9c56bf25d37cbf88275fc6a6a1eb Reviewed-on: https://gerrit.libreoffice.org/11383 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
2f270990f4
commit
4db2d600eb
@ -239,6 +239,7 @@ export GTK_LIBS=$(gb_SPACE)@GTK_LIBS@
|
|||||||
export GTK_PRINT_CFLAGS=$(gb_SPACE)@GTK_PRINT_CFLAGS@
|
export GTK_PRINT_CFLAGS=$(gb_SPACE)@GTK_PRINT_CFLAGS@
|
||||||
export GTK_PRINT_LIBS=$(gb_SPACE)@GTK_PRINT_LIBS@
|
export GTK_PRINT_LIBS=$(gb_SPACE)@GTK_PRINT_LIBS@
|
||||||
export GUIBASE=@GUIBASE@
|
export GUIBASE=@GUIBASE@
|
||||||
|
export HAMCREST_JAR=@HAMCREST_JAR@
|
||||||
export HARDLINKDELIVER=@HARDLINKDELIVER@
|
export HARDLINKDELIVER=@HARDLINKDELIVER@
|
||||||
export HAVE_GCC_AVX=@HAVE_GCC_AVX@
|
export HAVE_GCC_AVX=@HAVE_GCC_AVX@
|
||||||
export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@
|
export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@
|
||||||
|
51
configure.ac
51
configure.ac
@ -1987,6 +1987,15 @@ AC_ARG_WITH(junit,
|
|||||||
],
|
],
|
||||||
,with_junit=yes)
|
,with_junit=yes)
|
||||||
|
|
||||||
|
AC_ARG_WITH(hamcrest,
|
||||||
|
AS_HELP_STRING([--with-hamcrest],
|
||||||
|
[Specifies the hamcrest jar file to use for JUnit-based tests.
|
||||||
|
--without-junit disables those tests. Not relevant in the --without-java case.])
|
||||||
|
[
|
||||||
|
Usage: --with-hamcrest=<absolute path to hamcrest jar>
|
||||||
|
],
|
||||||
|
,with_hamcrest=yes)
|
||||||
|
|
||||||
AC_ARG_WITH(perl-home,
|
AC_ARG_WITH(perl-home,
|
||||||
AS_HELP_STRING([--with-perl-home],
|
AS_HELP_STRING([--with-perl-home],
|
||||||
[If you have installed Perl 5 Distribution, on your system, please
|
[If you have installed Perl 5 Distribution, on your system, please
|
||||||
@ -12051,23 +12060,53 @@ if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
|
|||||||
if test "$_os" = "WINNT"; then
|
if test "$_os" = "WINNT"; then
|
||||||
OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
|
OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
|
||||||
fi
|
fi
|
||||||
printf 'import org.junit.Before; import org.hamcrest.BaseDescription;' \
|
printf 'import org.junit.Before;' > conftest.java
|
||||||
> conftest.java
|
|
||||||
if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
|
if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
|
||||||
AC_MSG_RESULT([$OOO_JUNIT_JAR])
|
AC_MSG_RESULT([$OOO_JUNIT_JAR])
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR(
|
AC_MSG_ERROR(
|
||||||
[cannot find JUnit 4 jar, or JUnit 4 jar does not provide Hamcrest; please
|
[cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
|
||||||
install one in the default location (/usr/share/java), specify its pathname via
|
specify its pathname via --with-junit=..., or disable it via --without-junit])
|
||||||
--with-junit=..., or disable it via --without-junit])
|
|
||||||
fi
|
fi
|
||||||
rm -f conftestj.class conftestj.java
|
rm -f conftest.class conftest.java
|
||||||
if test $OOO_JUNIT_JAR != ""; then
|
if test $OOO_JUNIT_JAR != ""; then
|
||||||
BUILD_TYPE="$BUILD_TYPE QADEVOOO"
|
BUILD_TYPE="$BUILD_TYPE QADEVOOO"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AC_SUBST(OOO_JUNIT_JAR)
|
AC_SUBST(OOO_JUNIT_JAR)
|
||||||
|
|
||||||
|
HAMCREST_JAR=
|
||||||
|
if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
|
||||||
|
AC_MSG_CHECKING([for included Hamcrest])
|
||||||
|
printf 'import org.hamcrest.BaseDescription;' > conftest.java
|
||||||
|
if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
|
||||||
|
AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([Not included])
|
||||||
|
AC_MSG_CHECKING([for standalone hamcrest jar.])
|
||||||
|
if test "$with_hamcrest" = "yes"; then
|
||||||
|
if test -e /usr/share/lib/java/hamcrest.jar; then
|
||||||
|
HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
|
||||||
|
else
|
||||||
|
HAMCREST_JAR=/usr/share/java/hamcrest.jar
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
HAMCREST_JAR=$with_hamcrest
|
||||||
|
fi
|
||||||
|
if test "$_os" = "WINNT"; then
|
||||||
|
HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
|
||||||
|
fi
|
||||||
|
if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
|
||||||
|
AC_MSG_RESULT([$HAMCREST_JAR])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([junit does not contain hamcrest; please use a junit jar that includes hamcrest, install a hamcrest jar in the default location (/usr/share/java),
|
||||||
|
specify its path with --with-hamcrest=..., or disable junit with --without-junit])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f conftest.class conftest.java
|
||||||
|
fi
|
||||||
|
AC_SUBST(HAMCREST_JAR)
|
||||||
|
|
||||||
|
|
||||||
AC_SUBST(SCPDEFS)
|
AC_SUBST(SCPDEFS)
|
||||||
|
|
||||||
|
@ -54,12 +54,13 @@ $(call gb_JunitTest_get_target,%) :
|
|||||||
$(CLEAN_CMD)
|
$(CLEAN_CMD)
|
||||||
|
|
||||||
define gb_JunitTest_JunitTest
|
define gb_JunitTest_JunitTest
|
||||||
$(call gb_JunitTest_get_target,$(1)) : T_CP := $(call gb_JavaClassSet_get_classdir,$(call gb_JunitTest_get_classsetname,$(1)))$$(gb_CLASSPATHSEP)$(OOO_JUNIT_JAR)$$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_URE_LIB_FOLDER)
|
$(call gb_JunitTest_get_target,$(1)) : T_CP := $(call gb_JavaClassSet_get_classdir,$(call gb_JunitTest_get_classsetname,$(1)))$$(gb_CLASSPATHSEP)$(OOO_JUNIT_JAR)$(if $(HAMCREST_JAR),$$(gb_CLASSPATHSEP)$(HAMCREST_JAR))$$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_URE_LIB_FOLDER)
|
||||||
$(call gb_JunitTest_get_target,$(1)) : CLASSES :=
|
$(call gb_JunitTest_get_target,$(1)) : CLASSES :=
|
||||||
$(eval $(call gb_JunitTest_JunitTest_platform,$(1)))
|
$(eval $(call gb_JunitTest_JunitTest_platform,$(1)))
|
||||||
|
|
||||||
$(call gb_JavaClassSet_JavaClassSet,$(call gb_JunitTest_get_classsetname,$(1)))
|
$(call gb_JavaClassSet_JavaClassSet,$(call gb_JunitTest_get_classsetname,$(1)))
|
||||||
$(call gb_JavaClassSet_use_system_jar,$(call gb_JunitTest_get_classsetname,$(1)),$(OOO_JUNIT_JAR))
|
$(call gb_JavaClassSet_use_system_jar,$(call gb_JunitTest_get_classsetname,$(1)),$(OOO_JUNIT_JAR))
|
||||||
|
$(if $(HAMCREST_JAR),$(call gb_JavaClassSet_use_system_jar,$(call gb_JunitTest_get_classsetname,$(1)),$(HAMCREST_JAR)))
|
||||||
$(call gb_JunitTest_get_target,$(1)) : $(call gb_JavaClassSet_get_target,$(call gb_JunitTest_get_classsetname,$(1)))
|
$(call gb_JunitTest_get_target,$(1)) : $(call gb_JavaClassSet_get_target,$(call gb_JunitTest_get_classsetname,$(1)))
|
||||||
$(eval $(call gb_Module_register_target,$(call gb_JunitTest_get_target,$(1)),$(call gb_JunitTest_get_clean_target,$(1))))
|
$(eval $(call gb_Module_register_target,$(call gb_JunitTest_get_target,$(1)),$(call gb_JunitTest_get_clean_target,$(1))))
|
||||||
$(call gb_Helper_make_userfriendly_targets,$(1),JunitTest)
|
$(call gb_Helper_make_userfriendly_targets,$(1),JunitTest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user