samples/livedb/build.xml
changeset 414 0e707eef1e4a
parent 413 f11943a373a7
child 415 f8492036f31c
     1.1 --- a/samples/livedb/build.xml	Mon Nov 11 13:17:34 2019 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,111 +0,0 @@
     1.4 -<?xml version="1.0" encoding="UTF-8"?>
     1.5 -<!-- You may freely edit this file. See commented blocks below for -->
     1.6 -<!-- some examples of how to customize the build. -->
     1.7 -<!-- (If you delete it and reopen the project it will be recreated.) -->
     1.8 -<!-- By default, only the Clean and Build commands use this build script. -->
     1.9 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
    1.10 -<!-- the Compile on Save feature is turned off for the project. -->
    1.11 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
    1.12 -<!-- in the project's Project Properties dialog box.-->
    1.13 -<project name="livedb" default="default" basedir=".">
    1.14 -    <description>Builds, tests, and runs the project livedb.</description>
    1.15 -    <import file="nbproject/build-impl.xml"/>
    1.16 -
    1.17 -    <ant dir="../libs/"/>
    1.18 -    <!--
    1.19 -
    1.20 -    There exist several targets which are by default empty and which can be 
    1.21 -    used for execution of your tasks. These targets are usually executed 
    1.22 -    before and after some main targets. They are: 
    1.23 -
    1.24 -      -pre-init:                 called before initialization of project properties
    1.25 -      -post-init:                called after initialization of project properties
    1.26 -      -pre-compile:              called before javac compilation
    1.27 -      -post-compile:             called after javac compilation
    1.28 -      -pre-compile-single:       called before javac compilation of single file
    1.29 -      -post-compile-single:      called after javac compilation of single file
    1.30 -      -pre-compile-test:         called before javac compilation of JUnit tests
    1.31 -      -post-compile-test:        called after javac compilation of JUnit tests
    1.32 -      -pre-compile-test-single:  called before javac compilation of single JUnit test
    1.33 -      -post-compile-test-single: called after javac compilation of single JUunit test
    1.34 -      -pre-jar:                  called before JAR building
    1.35 -      -post-jar:                 called after JAR building
    1.36 -      -post-clean:               called after cleaning build products
    1.37 -
    1.38 -    (Targets beginning with '-' are not intended to be called on their own.)
    1.39 -
    1.40 -    Example of inserting an obfuscator after compilation could look like this:
    1.41 -
    1.42 -        <target name="-post-compile">
    1.43 -            <obfuscate>
    1.44 -                <fileset dir="${build.classes.dir}"/>
    1.45 -            </obfuscate>
    1.46 -        </target>
    1.47 -
    1.48 -    For list of available properties check the imported 
    1.49 -    nbproject/build-impl.xml file. 
    1.50 -
    1.51 -
    1.52 -    Another way to customize the build is by overriding existing main targets.
    1.53 -    The targets of interest are: 
    1.54 -
    1.55 -      -init-macrodef-javac:     defines macro for javac compilation
    1.56 -      -init-macrodef-junit:     defines macro for junit execution
    1.57 -      -init-macrodef-debug:     defines macro for class debugging
    1.58 -      -init-macrodef-java:      defines macro for class execution
    1.59 -      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    1.60 -      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    1.61 -      run:                      execution of project 
    1.62 -      -javadoc-build:           Javadoc generation
    1.63 -      test-report:              JUnit report generation
    1.64 -
    1.65 -    An example of overriding the target for project execution could look like this:
    1.66 -
    1.67 -        <target name="run" depends="livedb-impl.jar">
    1.68 -            <exec dir="bin" executable="launcher.exe">
    1.69 -                <arg file="${dist.jar}"/>
    1.70 -            </exec>
    1.71 -        </target>
    1.72 -
    1.73 -    Notice that the overridden target depends on the jar target and not only on 
    1.74 -    the compile target as the regular run target does. Again, for a list of available 
    1.75 -    properties which you can use, check the target you are overriding in the
    1.76 -    nbproject/build-impl.xml file. 
    1.77 -
    1.78 -    -->
    1.79 -    
    1.80 -    <target name="-pre-compile-test">
    1.81 -        <antcall target="create-db"/>
    1.82 -    </target>
    1.83 -    
    1.84 -    <!-- BEGIN: livedb.derby.create -->
    1.85 -    <target name="-check-db">
    1.86 -        <property name="db" location="build/classes/db"/>
    1.87 -        <available property="db.exists" file="${db}"/>
    1.88 -    </target>
    1.89 -    <target name="create-db" unless="db.exists" depends="init,-check-db">
    1.90 -        <mkdir dir="${db}"/>
    1.91 -        <delete dir="${db}"/>
    1.92 -        <echo message="Creating DB in ${db}"/>
    1.93 -        <sql classpath="${file.reference.derby.jar}" userid="j1" password="j1" 
    1.94 -            url="jdbc:derby:${db};create=true" 
    1.95 -            driver="org.apache.derby.jdbc.EmbeddedDriver"
    1.96 -        >
    1.97 -        create table APP.AGE (
    1.98 -            NAME VARCHAR(30),
    1.99 -            AGE NUMERIC(3)
   1.100 -        );
   1.101 -        insert into APP.AGE values ('apidesign', 3);
   1.102 -        </sql>
   1.103 -        <!-- don't forget to shutdown the DB -->
   1.104 -        <sql classpath="${file.reference.derby.jar}" userid="j1" password="j1" 
   1.105 -            url="jdbc:derby:${db};shutdown=true" 
   1.106 -            driver="org.apache.derby.jdbc.EmbeddedDriver" 
   1.107 -            onerror="continue"
   1.108 -            errorproperty="ignore.error" 
   1.109 -            failonconnectionerror="false"
   1.110 -        >none</sql>
   1.111 -        <echo message="DB created OK."/>
   1.112 -    </target>
   1.113 -    <!-- END: livedb.derby.create -->
   1.114 -</project>