1*cdf0e10cSrcweir#************************************************************************* 2*cdf0e10cSrcweir# 3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir# 5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# This file is part of OpenOffice.org. 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir# 15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir# 21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir# 26*cdf0e10cSrcweir#************************************************************************* 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir# Makefile template for directories that contain Java unit tests. 29*cdf0e10cSrcweir# 30*cdf0e10cSrcweir# Before including this makefile, the following variables should be set: 31*cdf0e10cSrcweir# - PRJ, PRJNAME, TARGET 32*cdf0e10cSrcweir# - PACKAGE 33*cdf0e10cSrcweir# - JAVATESTFILES: the unit test classes; 34*cdf0e10cSrcweir# each one of the form <basename>.java; 35*cdf0e10cSrcweir# these java files must only define classes within the package corresponding 36*cdf0e10cSrcweir# to PACKAGE, the name of each defined (outer) class should end with "_Test" 37*cdf0e10cSrcweir# - JAVAFILES: optional java files, corresponding class files are generated 38*cdf0e10cSrcweir# that can be used when compiling or running the tests; 39*cdf0e10cSrcweir# each one of the form <basename>.java; 40*cdf0e10cSrcweir# these java files must only define classes within the package corresponding 41*cdf0e10cSrcweir# to PACKAGE, the name of each defined (outer) class should start with 42*cdf0e10cSrcweir# "Test" 43*cdf0e10cSrcweir# - IDLTESTFILES: optional idl files, corresponding class files are generated 44*cdf0e10cSrcweir# that can be used when compiling or running the tests; 45*cdf0e10cSrcweir# each one of the form <basename>.idl; 46*cdf0e10cSrcweir# these idl files must only define entities within the module corresponding 47*cdf0e10cSrcweir# to PACKAGE, the name of each defined entity should start with "Test" 48*cdf0e10cSrcweir# - JARFILES: optional jar files that can be used when compiling or running the 49*cdf0e10cSrcweir# tests; 50*cdf0e10cSrcweir# each one of the form <basename>.jar 51*cdf0e10cSrcweir# All generated class files are placed into <platform>/class/test/ instead of 52*cdf0e10cSrcweir# <platform>/class/, so that they are not accidentally included in jar files 53*cdf0e10cSrcweir# packed from <platform>/class/ subdirectories. 54*cdf0e10cSrcweir 55*cdf0e10cSrcweirJAVAFILES +:= $(JAVATESTFILES) 56*cdf0e10cSrcweirEXTRAJARFILES += $(OOO_JUNIT_JAR) 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir.INCLUDE: settings.mk 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir.IF "$(XCLASSPATH)" == "" 61*cdf0e10cSrcweirXCLASSPATH := $(CLASSDIR) 62*cdf0e10cSrcweir.ELSE 63*cdf0e10cSrcweirXCLASSPATH !:= $(XCLASSPATH)$(PATH_SEPERATOR)$(CLASSDIR) 64*cdf0e10cSrcweir.ENDIF 65*cdf0e10cSrcweirCLASSDIR !:= $(CLASSDIR)/test 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir.INCLUDE: target.mk 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir$(JAVATARGET) : $(MISC)/$(TARGET).classdir.flag 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir$(MISC)/$(TARGET).classdir.flag: 72*cdf0e10cSrcweir - $(MKDIR) $(CLASSDIR) 73*cdf0e10cSrcweir $(TOUCH) $@ 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir.IF "$(JAVATESTFILES)" != "" 76*cdf0e10cSrcweirALLTAR : test 77*cdf0e10cSrcweir.END 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir.IF "$(SOLAR_JAVA)" == "TRUE" && "$(OOO_JUNIT_JAR)" != "" 80*cdf0e10cSrcweirtest .PHONY : $(JAVATARGET) 81*cdf0e10cSrcweir $(JAVAI) $(JAVAIFLAGS) $(JAVACPS) \ 82*cdf0e10cSrcweir '$(OOO_JUNIT_JAR)$(PATH_SEPERATOR)$(CLASSPATH)' \ 83*cdf0e10cSrcweir org.junit.runner.JUnitCore \ 84*cdf0e10cSrcweir $(foreach,i,$(JAVATESTFILES) $(subst,/,. $(PACKAGE)).$(i:s/.java//)) 85*cdf0e10cSrcweir.ELSE 86*cdf0e10cSrcweirtest .PHONY : 87*cdf0e10cSrcweir echo 'test needs SOLAR_JAVA=TRUE and OOO_JUNIT_JAR' 88*cdf0e10cSrcweir.END 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir.IF "$(IDLTESTFILES)" != "" 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir# The following dependency (to execute javac whenever javamaker has run) does 93*cdf0e10cSrcweir# not work reliably, see #i28827#: 94*cdf0e10cSrcweir$(JAVAFILES) $(JAVACLASSFILES): $(MISC)/$(TARGET).javamaker.flag 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir$(MISC)/$(TARGET).javamaker.flag: $(MISC)/$(TARGET).rdb 97*cdf0e10cSrcweir $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD $< -X$(SOLARBINDIR)/types.rdb 98*cdf0e10cSrcweir $(TOUCH) $@ 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir$(MISC)/$(TARGET).rdb .ERRREMOVE: \ 101*cdf0e10cSrcweir $(foreach,i,$(IDLTESTFILES) $(subst,.idl,.urd $(MISC)/$(TARGET)/$i)) 102*cdf0e10cSrcweir - rm $@ 103*cdf0e10cSrcweir $(REGMERGE) $@ /UCR $< 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir$(foreach,i,$(IDLTESTFILES) $(subst,.idl,.urd $(MISC)/$(TARGET)/$i)): \ 106*cdf0e10cSrcweir $(IDLTESTFILES) 107*cdf0e10cSrcweir - $(MKDIR) $(MISC)/$(TARGET) 108*cdf0e10cSrcweir $(IDLC) -O$(MISC)/$(TARGET) -I$(SOLARIDLDIR) -cid -we $< 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir.ENDIF 111