| 1 | <?xml version="1.0" encoding="UTF-8"?> | 
|---|
| 2 | <!-- You may freely edit this file. See commented blocks below for --> | 
|---|
| 3 | <!-- some examples of how to customize the build. --> | 
|---|
| 4 | <!-- (If you delete it and reopen the project it will be recreated.) --> | 
|---|
| 5 | <!-- By default, only the Clean and Build commands use this build script. --> | 
|---|
| 6 | <!-- Commands such as Run, Debug, and Test only use this build script if --> | 
|---|
| 7 | <!-- the Compile on Save feature is turned off for the project. --> | 
|---|
| 8 | <!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | 
|---|
| 9 | <!-- in the project's Project Properties dialog box.--> | 
|---|
| 10 | <project name="josm" default="default" basedir="."> | 
|---|
| 11 | <description>Builds, tests, and runs the project josm.</description> | 
|---|
| 12 |  | 
|---|
| 13 | <property name="javacc.home" location="../tools"/> | 
|---|
| 14 | <property name="mapcss.dir" location="../src/org/openstreetmap/josm/gui/mappaint/mapcss"/> | 
|---|
| 15 |  | 
|---|
| 16 | <import file="nbproject/build-impl.xml"/> | 
|---|
| 17 | <!-- | 
|---|
| 18 |  | 
|---|
| 19 | There exist several targets which are by default empty and which can be | 
|---|
| 20 | used for execution of your tasks. These targets are usually executed | 
|---|
| 21 | before and after some main targets. They are: | 
|---|
| 22 |  | 
|---|
| 23 | -pre-init:                 called before initialization of project properties | 
|---|
| 24 | -post-init:                called after initialization of project properties | 
|---|
| 25 | -pre-compile:              called before javac compilation | 
|---|
| 26 | -post-compile:             called after javac compilation | 
|---|
| 27 | -pre-compile-single:       called before javac compilation of single file | 
|---|
| 28 | -post-compile-single:      called after javac compilation of single file | 
|---|
| 29 | -pre-compile-test:         called before javac compilation of JUnit tests | 
|---|
| 30 | -post-compile-test:        called after javac compilation of JUnit tests | 
|---|
| 31 | -pre-compile-test-single:  called before javac compilation of single JUnit test | 
|---|
| 32 | -post-compile-test-single: called after javac compilation of single JUunit test | 
|---|
| 33 | -pre-jar:                  called before JAR building | 
|---|
| 34 | -post-jar:                 called after JAR building | 
|---|
| 35 | -post-clean:               called after cleaning build products | 
|---|
| 36 |  | 
|---|
| 37 | (Targets beginning with '-' are not intended to be called on their own.) | 
|---|
| 38 |  | 
|---|
| 39 | Example of inserting an obfuscator after compilation could look like this: | 
|---|
| 40 |  | 
|---|
| 41 | <target name="-post-compile"> | 
|---|
| 42 | <obfuscate> | 
|---|
| 43 | <fileset dir="${build.classes.dir}"/> | 
|---|
| 44 | </obfuscate> | 
|---|
| 45 | </target> | 
|---|
| 46 |  | 
|---|
| 47 | For list of available properties check the imported | 
|---|
| 48 | nbproject/build-impl.xml file. | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 | Another way to customize the build is by overriding existing main targets. | 
|---|
| 52 | The targets of interest are: | 
|---|
| 53 |  | 
|---|
| 54 | -init-macrodef-javac:     defines macro for javac compilation | 
|---|
| 55 | -init-macrodef-junit:     defines macro for junit execution | 
|---|
| 56 | -init-macrodef-debug:     defines macro for class debugging | 
|---|
| 57 | -init-macrodef-java:      defines macro for class execution | 
|---|
| 58 | -do-jar-with-manifest:    JAR building (if you are using a manifest) | 
|---|
| 59 | -do-jar-without-manifest: JAR building (if you are not using a manifest) | 
|---|
| 60 | run:                      execution of project | 
|---|
| 61 | -javadoc-build:           Javadoc generation | 
|---|
| 62 | test-report:              JUnit report generation | 
|---|
| 63 |  | 
|---|
| 64 | An example of overriding the target for project execution could look like this: | 
|---|
| 65 |  | 
|---|
| 66 | <target name="run" depends="josm-impl.jar"> | 
|---|
| 67 | <exec dir="bin" executable="launcher.exe"> | 
|---|
| 68 | <arg file="${dist.jar}"/> | 
|---|
| 69 | </exec> | 
|---|
| 70 | </target> | 
|---|
| 71 |  | 
|---|
| 72 | Notice that the overridden target depends on the jar target and not only on | 
|---|
| 73 | the compile target as the regular run target does. Again, for a list of available | 
|---|
| 74 | properties which you can use, check the target you are overriding in the | 
|---|
| 75 | nbproject/build-impl.xml file. | 
|---|
| 76 |  | 
|---|
| 77 | --> | 
|---|
| 78 |  | 
|---|
| 79 | <target name="-post-compile"> | 
|---|
| 80 | <!-- create the REVISION file to be included in the distribution --> | 
|---|
| 81 | <exec append="false" output="REVISION.XML" executable="svn" dir=".." failifexecutionfails="false"> | 
|---|
| 82 | <env key="LANG" value="C"/> | 
|---|
| 83 | <arg value="info"/> | 
|---|
| 84 | <arg value="--xml"/> | 
|---|
| 85 | <arg value="."/> | 
|---|
| 86 | </exec> | 
|---|
| 87 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/> | 
|---|
| 88 | <delete file="REVISION.XML" /> | 
|---|
| 89 | <tstamp> | 
|---|
| 90 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/> | 
|---|
| 91 | </tstamp> | 
|---|
| 92 |  | 
|---|
| 93 | <property name="version.entry.commit.revision" value="UNKNOWN"/> | 
|---|
| 94 | <echo file="${build.classes.dir}/REVISION"> | 
|---|
| 95 | # automatically generated by JOSM build.xml - do not edit | 
|---|
| 96 | Revision: ${version.entry.commit.revision} | 
|---|
| 97 | Is-Local-Build: true | 
|---|
| 98 | Build-Date: ${build.tstamp} | 
|---|
| 99 | </echo> | 
|---|
| 100 | </target> | 
|---|
| 101 |  | 
|---|
| 102 | <target name="-pre-compile"> | 
|---|
| 103 | <mkdir dir="${mapcss.dir}/parsergen"/> | 
|---|
| 104 | <exec append="false" executable="java" failifexecutionfails="true"> | 
|---|
| 105 | <arg value="-cp"/> | 
|---|
| 106 | <arg value="${javacc.home}/javacc.jar"/> | 
|---|
| 107 | <arg value="javacc"/> | 
|---|
| 108 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/> | 
|---|
| 109 | <arg value="${mapcss.dir}/MapCSSParser.jj"/> | 
|---|
| 110 | </exec> | 
|---|
| 111 | <!--        <javacc target="${mapcss.dir}/MapCSSParser.jj" javacchome="${javacc.home}" outputdirectory="${mapcss.dir}/parsergen"/>--> | 
|---|
| 112 | </target> | 
|---|
| 113 | </project> | 
|---|