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