samples/misuse/build.xml
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 11 Nov 2019 13:17:34 +0100
changeset 413 f11943a373a7
parent 101 c27834b52df0
permissions -rw-r--r--
Updating to projects from NetBeans 11.2
jtulach@101
     1
<?xml version="1.0" encoding="UTF-8"?>
jtulach@101
     2
<!-- You may freely edit this file. See commented blocks below for -->
jtulach@101
     3
<!-- some examples of how to customize the build. -->
jtulach@101
     4
<!-- (If you delete it and reopen the project it will be recreated.) -->
jaroslav@413
     5
<!-- By default, only the Clean and Build commands use this build script. -->
jaroslav@413
     6
<!-- Commands such as Run, Debug, and Test only use this build script if -->
jaroslav@413
     7
<!-- the Compile on Save feature is turned off for the project. -->
jaroslav@413
     8
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
jaroslav@413
     9
<!-- in the project's Project Properties dialog box.-->
jtulach@101
    10
<project name="misuse" default="default" basedir=".">
jtulach@101
    11
    <description>Builds, tests, and runs the project misuse.</description>
jtulach@101
    12
    <import file="nbproject/build-impl.xml"/>
jtulach@101
    13
    <!--
jtulach@101
    14
jtulach@101
    15
    There exist several targets which are by default empty and which can be 
jtulach@101
    16
    used for execution of your tasks. These targets are usually executed 
jtulach@101
    17
    before and after some main targets. They are: 
jtulach@101
    18
jtulach@101
    19
      -pre-init:                 called before initialization of project properties
jtulach@101
    20
      -post-init:                called after initialization of project properties
jtulach@101
    21
      -pre-compile:              called before javac compilation
jtulach@101
    22
      -post-compile:             called after javac compilation
jtulach@101
    23
      -pre-compile-single:       called before javac compilation of single file
jtulach@101
    24
      -post-compile-single:      called after javac compilation of single file
jtulach@101
    25
      -pre-compile-test:         called before javac compilation of JUnit tests
jtulach@101
    26
      -post-compile-test:        called after javac compilation of JUnit tests
jtulach@101
    27
      -pre-compile-test-single:  called before javac compilation of single JUnit test
jtulach@101
    28
      -post-compile-test-single: called after javac compilation of single JUunit test
jtulach@101
    29
      -pre-jar:                  called before JAR building
jtulach@101
    30
      -post-jar:                 called after JAR building
jtulach@101
    31
      -post-clean:               called after cleaning build products
jtulach@101
    32
jtulach@101
    33
    (Targets beginning with '-' are not intended to be called on their own.)
jtulach@101
    34
jtulach@101
    35
    Example of inserting an obfuscator after compilation could look like this:
jtulach@101
    36
jtulach@101
    37
        <target name="-post-compile">
jtulach@101
    38
            <obfuscate>
jtulach@101
    39
                <fileset dir="${build.classes.dir}"/>
jtulach@101
    40
            </obfuscate>
jtulach@101
    41
        </target>
jtulach@101
    42
jtulach@101
    43
    For list of available properties check the imported 
jtulach@101
    44
    nbproject/build-impl.xml file. 
jtulach@101
    45
jtulach@101
    46
jtulach@101
    47
    Another way to customize the build is by overriding existing main targets.
jtulach@101
    48
    The targets of interest are: 
jtulach@101
    49
jtulach@101
    50
      -init-macrodef-javac:     defines macro for javac compilation
jtulach@101
    51
      -init-macrodef-junit:     defines macro for junit execution
jtulach@101
    52
      -init-macrodef-debug:     defines macro for class debugging
jtulach@101
    53
      -init-macrodef-java:      defines macro for class execution
jaroslav@413
    54
      -do-jar:                  JAR building
jtulach@101
    55
      run:                      execution of project 
jtulach@101
    56
      -javadoc-build:           Javadoc generation
jtulach@101
    57
      test-report:              JUnit report generation
jtulach@101
    58
jtulach@101
    59
    An example of overriding the target for project execution could look like this:
jtulach@101
    60
jtulach@101
    61
        <target name="run" depends="misuse-impl.jar">
jtulach@101
    62
            <exec dir="bin" executable="launcher.exe">
jtulach@101
    63
                <arg file="${dist.jar}"/>
jtulach@101
    64
            </exec>
jtulach@101
    65
        </target>
jtulach@101
    66
jtulach@101
    67
    Notice that the overridden target depends on the jar target and not only on 
jtulach@101
    68
    the compile target as the regular run target does. Again, for a list of available 
jtulach@101
    69
    properties which you can use, check the target you are overriding in the
jtulach@101
    70
    nbproject/build-impl.xml file. 
jtulach@101
    71
jtulach@101
    72
    -->
jtulach@101
    73
</project>