Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 224 lines (192 sloc) 9.494 kb
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Licensed to the Apache Software Foundation (ASF) under one
4 or more contributor license agreements. See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership. The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License. You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations
18 under the License.
19 -->
20 <project name="Ant - Common">
8907c57 @eigood Slight tweak, so that ofbiz.home.dir is defined by macros.xml, so it
eigood authored
21 <dirname property="Ant - Common.dir" file="${ant.file.Ant - Common}"/>
22 <import file="${Ant - Common.dir}/macros.xml"/>
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
23
24 <property environment="env"/>
25 <property name="src.dir" value="src"/>
26 <property name="dtd.dir" value="dtd"/>
27 <property name="lib.dir" value="lib"/>
28 <property name="build.dir" value="build"/>
29
290e17e @eigood Add a target for per-component quick testing. Can only deal with tests
eigood authored
30 <path id="test.class.path">
31 <path refid="local.class.path"/>
32 <pathelement location="config"/>
33 </path>
34 <filelist id="test.classes"/>
35
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
36 <!-- ================================================================== -->
37 <!-- Removes all created files and directories -->
38 <!-- ================================================================== -->
39
c895958 @eigood prepare no longer removes build/lib.
eigood authored
40 <target name="clean">
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
41 <delete dir="${build.dir}"/>
42 </target>
43
44 <!-- ================================================================== -->
45 <!-- Makes sure the needed directory structure is in place -->
46 <!-- ================================================================== -->
47
74ac652 @eigood Add a shared init target, used by prepare anad prepare-docs.
eigood authored
48 <target name="prepare" depends="init">
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
49 <mkdir dir="${build.dir}/classes"/>
50 <mkdir dir="${build.dir}/lib"/>
51 </target>
52
74ac652 @eigood Add a shared init target, used by prepare anad prepare-docs.
eigood authored
53 <target name="prepare-docs" depends="init">
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
54 <mkdir dir="${build.dir}/javadocs"/>
55 </target>
56
74ac652 @eigood Add a shared init target, used by prepare anad prepare-docs.
eigood authored
57 <target name="init"/>
58
408595d @eigood With <if> always available, _src-extra-set can be defined at the
eigood authored
59 <if>
7132979 @JacquesLeRoux In r1100795 I missed some old <if> OOTB use cases.
JacquesLeRoux authored
60 <available file="${src.dir}"/>
61 <then>
cb367ce @eigood Don't define a fileset; instead separately define the extra source
eigood authored
62 <selector id="src-extra-set">
63 <or>
307962c @eigood In _src-extra-set, convert the implicit patternset list to a nested <or>
eigood authored
64 <filename name="**/*.properties"/>
65 <filename name="**/*.groovy"/>
66 <filename name="**/*.xml"/>
67 <filename name="**/*.bsh"/>
68 <filename name="**/*.logic"/>
69 <filename name="**/*.js"/>
70 <filename name="**/*.js"/>
71 <filename name="**/*.jacl"/>
72 <filename name="**/*.py"/>
73 <filename name="META-INF/**"/>
74 </or>
cb367ce @eigood Don't define a fileset; instead separately define the extra source
eigood authored
75 </selector>
76 <property name="src.extra.dir" value="${src.dir}"/>
7132979 @JacquesLeRoux In r1100795 I missed some old <if> OOTB use cases.
JacquesLeRoux authored
77 </then>
408595d @eigood With <if> always available, _src-extra-set can be defined at the
eigood authored
78 <else>
cb367ce @eigood Don't define a fileset; instead separately define the extra source
eigood authored
79 <selector id="src-extra-set">
80 <filename name="**" negate="true"/>
81 </selector>
82 <property name="src.extra.dir" value="."/>
408595d @eigood With <if> always available, _src-extra-set can be defined at the
eigood authored
83 </else>
84 </if>
8005ad1 @eigood Handle the case if the src dir doesn't exist.
eigood authored
85
8ec8438 @eigood Add a classes target to common.xml, and switch most build.xml to use it.
eigood authored
86 <!-- ================================================================== -->
87 <!-- Compilation of the source files -->
88 <!-- ================================================================== -->
89
90 <target name="classes" depends="prepare">
79f7a0b @adrian-crum Updated build files to use/require Java 7.
adrian-crum authored
91 <javac17/>
8ec8438 @eigood Add a classes target to common.xml, and switch most build.xml to use it.
eigood authored
92 </target>
93
408595d @eigood With <if> always available, _src-extra-set can be defined at the
eigood authored
94 <target name="jar" depends="classes">
b50989a @eigood Create a main-jar macro.
eigood authored
95 <main-jar/>
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
96 </target>
97
b5a3687 @eigood Remove most docs targets, they are all the same anyways.
eigood authored
98 <!-- ================================================================== -->
99 <!-- Build JavaDoc -->
100 <!-- ================================================================== -->
101
102 <target name="docs" depends="prepare-docs">
1b549f1 Made working correctly ant build target docs and docs-all for javadoc…
Marco Risaliti authored
103 <default-javadoc/>
b5a3687 @eigood Remove most docs targets, they are all the same anyways.
eigood authored
104 </target>
105
4f8091e @eigood Make tests and tests-cobertura use a macro for junit.
eigood authored
106 <macrodef name="run-junit">
107 <attribute name="build.jar" default="${build.dir}/lib/${name}.jar"/>
20613cb @eigood Fix stand-alone tests target, broken when separated -test.jar logic was
eigood authored
108 <attribute name="build-test.jar" default="${build.dir}/lib/${name}-test.jar"/>
4f8091e @eigood Make tests and tests-cobertura use a macro for junit.
eigood authored
109 <sequential>
110 <mkdir dir="${build.dir}/test-results"/>
8ce6fb1 @eigood It's been a rough ride, little ant and junit, but I'm glad you finally
eigood authored
111 <junit fork="on" haltonfailure="on" forkmode="once" showoutput="on" printsummary="off">
4f8091e @eigood Make tests and tests-cobertura use a macro for junit.
eigood authored
112 <classpath>
113 <path refid="junit.class.path"/>
114 <path refid="test.class.path"/>
115 <pathelement location="@{build.jar}"/>
20613cb @eigood Fix stand-alone tests target, broken when separated -test.jar logic was
eigood authored
116 <pathelement location="@{build-test.jar}"/>
4f8091e @eigood Make tests and tests-cobertura use a macro for junit.
eigood authored
117 </classpath>
118 <sysproperty key="net.sourceforge.cobertura.datafile" file="${build.dir}/test-results/cobertura.dat" />
119 <sysproperty key="ofbiz.home" value="${ofbiz.home.dir}"/>
8ce6fb1 @eigood It's been a rough ride, little ant and junit, but I'm glad you finally
eigood authored
120 <formatter usefile="false" type="plain"/>
4f8091e @eigood Make tests and tests-cobertura use a macro for junit.
eigood authored
121 <batchtest>
122 <filelist refid="test.classes"/>
123 </batchtest>
124 </junit>
125 </sequential>
126 </macrodef>
127
290e17e @eigood Add a target for per-component quick testing. Can only deal with tests
eigood authored
128 <target name="tests" depends="jar">
4f8091e @eigood Make tests and tests-cobertura use a macro for junit.
eigood authored
129 <run-junit/>
290e17e @eigood Add a target for per-component quick testing. Can only deal with tests
eigood authored
130 </target>
131
3cf4528 @eigood Fix cobertura-report when source has been generated(aka, when javacc or
eigood authored
132 <patternset id="cobertura-src-dirs">
133 <include name="src"/>
134 </patternset>
135
8d07bd5 @eigood Add target for running the short tests underneath cobertura, and then
eigood authored
136 <target name="tests-cobertura" depends="jar">
137 <mkdir dir="${build.dir}/cobertura-lib"/>
f64dba1 @eigood Fix detection of cobertura, for compilation of the hook used by the
eigood authored
138 <taskdef resource="tasks.properties" classpathref="cobertura.class.path"/>
0b853ec @eigood Delete cobertura.dat for each run, so that different runs don't overlap
eigood authored
139 <delete file="${build.dir}/test-results/cobertura.dat"/>
8d07bd5 @eigood Add target for running the short tests underneath cobertura, and then
eigood authored
140 <cobertura-instrument datafile="${build.dir}/test-results/cobertura.dat" todir="${build.dir}/cobertura-lib">
141 <fileset dir="${build.dir}/lib">
142 <include name="*.jar"/>
143 </fileset>
144 </cobertura-instrument>
bba91ee @eigood BUG FIX: Fix coverage on $foo-test.jar.
eigood authored
145 <run-junit build.jar="${build.dir}/cobertura-lib/${name}.jar" build-test.jar="${build.dir}/cobertura-lib/${name}-test.jar"/>
8d07bd5 @eigood Add target for running the short tests underneath cobertura, and then
eigood authored
146 <delete dir="${build.dir}/test-results/cobertura-report"/>
147 <mkdir dir="${build.dir}/test-results/cobertura-report"/>
148 <cobertura-report datafile="${build.dir}/test-results/cobertura.dat" destdir="${build.dir}/test-results/cobertura-report">
801adfa @eigood Add support for generated java files to the coverage report.
eigood authored
149 <dirset dir=".">
3cf4528 @eigood Fix cobertura-report when source has been generated(aka, when javacc or
eigood authored
150 <patternset refid="cobertura-src-dirs"/>
801adfa @eigood Add support for generated java files to the coverage report.
eigood authored
151 </dirset>
152
153 <include name="**/*.java"/>
8d07bd5 @eigood Add target for running the short tests underneath cobertura, and then
eigood authored
154 </cobertura-report>
155 </target>
156
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
157 <target name="all" depends="jar,docs"/>
4ebbb2b @JacquesLeRoux Adds new ant targets to handled patching in projects which use differ…
JacquesLeRoux authored
158
159 <!-- ================================================================== -->
160 <!-- Apply patches if exist -->
161 <!-- ================================================================== -->
162 <!--
163 This macro applies all patches found in ./patches/@{deployment} relative to ${ofbiz.home.dir}
164 and stops the build process if patches fail (to save time deleting all the rejects)
ce331ec @JacquesLeRoux Implements https://issues.apache.org/jira/browse/OFBIZ-5819 "Improve …
JacquesLeRoux authored
165 We use patch command here instead of svn patch because it's supposed to run in a server where patch is intalled in path
4ebbb2b @JacquesLeRoux Adds new ant targets to handled patching in projects which use differ…
JacquesLeRoux authored
166 -->
167 <macrodef name="apply-patches">
168 <attribute name="deployment" default="dev" />
169 <sequential>
170 <!-- patch task can't handle a fileset => create a global patch -->
171 <if>
172 <available file="patches"/>
173 <then>
174 <concat destfile="patches/@{deployment}.patch" encoding="UTF-8" outputencoding="UTF-8">
175 <!-- exclude the patch itself in case it's still there -->
176 <fileset dir="patches" includes="@{deployment}/*.patch"/>
177 </concat>
ce331ec @JacquesLeRoux Implements https://issues.apache.org/jira/browse/OFBIZ-5819 "Improve …
JacquesLeRoux authored
178 <patch strip="0" patchfile="patches/@{deployment}.patch" dir="${ofbiz.home.dir}" failonerror="true"/>
4ebbb2b @JacquesLeRoux Adds new ant targets to handled patching in projects which use differ…
JacquesLeRoux authored
179 <delete>
180 <fileset dir="patches" includes="@{deployment}.patch"/>
181 </delete>
ce331ec @JacquesLeRoux Implements https://issues.apache.org/jira/browse/OFBIZ-5819 "Improve …
JacquesLeRoux authored
182 </then>
4ebbb2b @JacquesLeRoux Adds new ant targets to handled patching in projects which use differ…
JacquesLeRoux authored
183 </if>
184 </sequential>
185 </macrodef>
186
187 <target name="prepare-to-build-dev"
188 description="Does everything needed to get you a ready to start building OFBiz for development. This include generic patches for OFBiz itself, not only hot-deploy components">
189 <apply-patches deployment="dev" />
190 </target>
191
192 <target name="prepare-to-build-test"
193 description="Does everything needed to get you a ready to start building OFBiz for integration testing">
194 <apply-patches deployment="test" />
195 </target>
196
197 <target name="prepare-to-build-qa"
198 description="Does everything needed to get you a ready to start building OFBiz in QA-Environment">
199 <apply-patches deployment="qa" />
200
201 <!-- need to use flatten here as qa dir might not exist and thus can't be included in "dir" -->
202 <copy toDir="config/" overwrite="true" flatten="true">
203 <fileset dir="patches" includes="qa/*.properties"/>
204 </copy>
205 </target>
206
207 <target name="prepare-to-build-production"
208 description="Does everything needed to get you a ready to start building OFBiz in production">
209 <apply-patches deployment="production" />
210
211 <!-- need to use flatten here as production dir might not exist and thus can't be included in "dir" -->
212 <copy toDir="config/" overwrite="true" flatten="true">
213 <fileset dir="patches" includes="production/*.properties"/>
214 </copy>
215 <!-- Some files might need to be deleted in production, notably some specific script files -->
216 <!--exec executable="svn" dir="${ofbiz.home.dir}">
217 <arg value="delete"/>
218 <arg value="filename.sh"/>
219 </exec-->
220 </target>
221
222
7582569 @eigood The build.xml files are now much smaller and simpler; they reuse a
eigood authored
223 </project>
Something went wrong with that request. Please try again.