update dev300-m58
[ooovba.git] / solenv / inc / javaunittest.mk
blob6d34ced82a619e0d3e45e38e5171f9f6bb383e1f
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: javaunittest.mk,v $
11 # $Revision: 1.8 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 # Makefile template for directories that contain Java unit tests.
34 # Before including this makefile, the following variables should be set:
35 # - PRJ, PRJNAME, TARGET
36 # - PACKAGE
37 # - JAVATESTFILES: the unit test classes;
38 # each one of the form <basename>.java;
39 # these java files must only define classes within the package corresponding
40 # to PACKAGE, the name of each defined (outer) class should end with "_Test"
41 # - JAVAFILES: optional java files, corresponding class files are generated
42 # that can be used when compiling or running the tests;
43 # each one of the form <basename>.java;
44 # these java files must only define classes within the package corresponding
45 # to PACKAGE, the name of each defined (outer) class should start with
46 # "Test"
47 # - IDLTESTFILES: optional idl files, corresponding class files are generated
48 # that can be used when compiling or running the tests;
49 # each one of the form <basename>.idl;
50 # these idl files must only define entities within the module corresponding
51 # to PACKAGE, the name of each defined entity should start with "Test"
52 # - JARFILES: optional jar files that can be used when compiling or running the
53 # tests;
54 # each one of the form <basename>.jar
55 # All generated class files are placed into <platform>/class/test/ instead of
56 # <platform>/class/, so that they are not accidentally included in jar files
57 # packed from <platform>/class/ subdirectories.
59 TESTS := $(subst,.java,.test $(JAVATESTFILES))
60 JAVAFILES +:= $(JAVATESTFILES)
61 JARFILES +:= OOoRunner.jar
63 .INCLUDE: settings.mk
65 .IF "$(XCLASSPATH)" == ""
66 XCLASSPATH := $(CLASSDIR)
67 .ELSE
68 XCLASSPATH !:= $(XCLASSPATH)$(PATH_SEPERATOR)$(CLASSDIR)
69 .ENDIF
70 CLASSDIR !:= $(CLASSDIR)/test
72 .INCLUDE: target.mk
74 ALLTAR: $(TESTS)
76 $(JAVAFILES): $(MISC)/$(TARGET).classdir.flag
78 $(MISC)/$(TARGET).classdir.flag:
79 - $(MKDIR) $(CLASSDIR)
80 $(TOUCH) $@
82 .IF "$(TESTS)" != ""
83 $(TESTS): $(JAVACLASSFILES)
84 .ENDIF
86 %.test .PHONY: %.java
87 $(JAVAI) $(JAVACPS) $(CLASSPATH) org.openoffice.Runner -TestBase java_complex \
88 -NoOffice yes -o $(subst,/,. $(subst,.test, $(PACKAGE).$@))
90 .IF "$(IDLTESTFILES)" != ""
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
96 $(MISC)/$(TARGET).javamaker.flag: $(MISC)/$(TARGET).rdb
97 $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD $< -X$(SOLARBINDIR)/types.rdb
98 $(TOUCH) $@
100 $(MISC)/$(TARGET).rdb .ERRREMOVE: \
101 $(foreach,i,$(IDLTESTFILES) $(subst,.idl,.urd $(MISC)/$(TARGET)/$i))
102 - rm $@
103 $(REGMERGE) $@ /UCR $<
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 $<
110 .ENDIF