jtulach@355
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
jtulach@355
|
2 |
<!-- You may freely edit this file. See commented blocks below for -->
|
jtulach@355
|
3 |
<!-- some examples of how to customize the build. -->
|
jtulach@355
|
4 |
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
jtulach@355
|
5 |
<!-- By default, only the Clean and Build commands use this build script. -->
|
jtulach@355
|
6 |
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
jtulach@355
|
7 |
<!-- the Compile on Save feature is turned off for the project. -->
|
jtulach@355
|
8 |
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
jtulach@355
|
9 |
<!-- in the project's Project Properties dialog box.-->
|
jtulach@355
|
10 |
<project name="livedb" default="default" basedir=".">
|
jtulach@355
|
11 |
<description>Builds, tests, and runs the project livedb.</description>
|
jtulach@355
|
12 |
<import file="nbproject/build-impl.xml"/>
|
jtulach@355
|
13 |
<!--
|
jtulach@355
|
14 |
|
jtulach@355
|
15 |
There exist several targets which are by default empty and which can be
|
jtulach@355
|
16 |
used for execution of your tasks. These targets are usually executed
|
jtulach@355
|
17 |
before and after some main targets. They are:
|
jtulach@355
|
18 |
|
jtulach@355
|
19 |
-pre-init: called before initialization of project properties
|
jtulach@355
|
20 |
-post-init: called after initialization of project properties
|
jtulach@355
|
21 |
-pre-compile: called before javac compilation
|
jtulach@355
|
22 |
-post-compile: called after javac compilation
|
jtulach@355
|
23 |
-pre-compile-single: called before javac compilation of single file
|
jtulach@355
|
24 |
-post-compile-single: called after javac compilation of single file
|
jtulach@355
|
25 |
-pre-compile-test: called before javac compilation of JUnit tests
|
jtulach@355
|
26 |
-post-compile-test: called after javac compilation of JUnit tests
|
jtulach@355
|
27 |
-pre-compile-test-single: called before javac compilation of single JUnit test
|
jtulach@355
|
28 |
-post-compile-test-single: called after javac compilation of single JUunit test
|
jtulach@355
|
29 |
-pre-jar: called before JAR building
|
jtulach@355
|
30 |
-post-jar: called after JAR building
|
jtulach@355
|
31 |
-post-clean: called after cleaning build products
|
jtulach@355
|
32 |
|
jtulach@355
|
33 |
(Targets beginning with '-' are not intended to be called on their own.)
|
jtulach@355
|
34 |
|
jtulach@355
|
35 |
Example of inserting an obfuscator after compilation could look like this:
|
jtulach@355
|
36 |
|
jtulach@355
|
37 |
<target name="-post-compile">
|
jtulach@355
|
38 |
<obfuscate>
|
jtulach@355
|
39 |
<fileset dir="${build.classes.dir}"/>
|
jtulach@355
|
40 |
</obfuscate>
|
jtulach@355
|
41 |
</target>
|
jtulach@355
|
42 |
|
jtulach@355
|
43 |
For list of available properties check the imported
|
jtulach@355
|
44 |
nbproject/build-impl.xml file.
|
jtulach@355
|
45 |
|
jtulach@355
|
46 |
|
jtulach@355
|
47 |
Another way to customize the build is by overriding existing main targets.
|
jtulach@355
|
48 |
The targets of interest are:
|
jtulach@355
|
49 |
|
jtulach@355
|
50 |
-init-macrodef-javac: defines macro for javac compilation
|
jtulach@355
|
51 |
-init-macrodef-junit: defines macro for junit execution
|
jtulach@355
|
52 |
-init-macrodef-debug: defines macro for class debugging
|
jtulach@355
|
53 |
-init-macrodef-java: defines macro for class execution
|
jtulach@355
|
54 |
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
jtulach@355
|
55 |
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
jtulach@355
|
56 |
run: execution of project
|
jtulach@355
|
57 |
-javadoc-build: Javadoc generation
|
jtulach@355
|
58 |
test-report: JUnit report generation
|
jtulach@355
|
59 |
|
jtulach@355
|
60 |
An example of overriding the target for project execution could look like this:
|
jtulach@355
|
61 |
|
jtulach@355
|
62 |
<target name="run" depends="livedb-impl.jar">
|
jtulach@355
|
63 |
<exec dir="bin" executable="launcher.exe">
|
jtulach@355
|
64 |
<arg file="${dist.jar}"/>
|
jtulach@355
|
65 |
</exec>
|
jtulach@355
|
66 |
</target>
|
jtulach@355
|
67 |
|
jtulach@355
|
68 |
Notice that the overridden target depends on the jar target and not only on
|
jtulach@355
|
69 |
the compile target as the regular run target does. Again, for a list of available
|
jtulach@355
|
70 |
properties which you can use, check the target you are overriding in the
|
jtulach@355
|
71 |
nbproject/build-impl.xml file.
|
jtulach@355
|
72 |
|
jtulach@355
|
73 |
-->
|
jtulach@359
|
74 |
|
jtulach@359
|
75 |
<target name="-pre-compile-test">
|
jtulach@359
|
76 |
<antcall target="create-db"/>
|
jtulach@359
|
77 |
</target>
|
jtulach@359
|
78 |
|
jtulach@359
|
79 |
<!-- BEGIN: livedb.derby.create -->
|
jtulach@359
|
80 |
<target name="-check-db">
|
jtulach@359
|
81 |
<property name="db" location="build/classes/db"/>
|
jtulach@359
|
82 |
<available property="db.exists" file="${db}"/>
|
jtulach@359
|
83 |
</target>
|
jtulach@359
|
84 |
<target name="create-db" unless="db.exists" depends="init,-check-db">
|
jtulach@359
|
85 |
<mkdir dir="${db}"/>
|
jtulach@359
|
86 |
<delete dir="${db}"/>
|
jtulach@359
|
87 |
<echo message="Creating DB in ${db}"/>
|
jtulach@359
|
88 |
<sql classpath="${file.reference.derby.jar}" userid="j1" password="j1"
|
jtulach@359
|
89 |
url="jdbc:derby:${db};create=true"
|
jtulach@359
|
90 |
driver="org.apache.derby.jdbc.EmbeddedDriver"
|
jtulach@359
|
91 |
>
|
jtulach@359
|
92 |
create table APP.AGE (
|
jtulach@359
|
93 |
NAME VARCHAR(30),
|
jtulach@359
|
94 |
AGE NUMERIC(3)
|
jtulach@359
|
95 |
);
|
jtulach@359
|
96 |
insert into APP.AGE values ('apidesign', 3);
|
jtulach@359
|
97 |
</sql>
|
jtulach@359
|
98 |
<!-- don't forget to shutdown the DB -->
|
jtulach@359
|
99 |
<sql classpath="${file.reference.derby.jar}" userid="j1" password="j1"
|
jtulach@359
|
100 |
url="jdbc:derby:${db};shutdown=true"
|
jtulach@359
|
101 |
driver="org.apache.derby.jdbc.EmbeddedDriver"
|
jtulach@359
|
102 |
onerror="continue"
|
jtulach@359
|
103 |
errorproperty="ignore.error"
|
jtulach@359
|
104 |
failonconnectionerror="false"
|
jtulach@359
|
105 |
>none</sql>
|
jtulach@359
|
106 |
<echo message="DB created OK."/>
|
jtulach@359
|
107 |
</target>
|
jtulach@359
|
108 |
<!-- END: livedb.derby.create -->
|
jtulach@355
|
109 |
</project>
|