| 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 |     <!-- For Windows-specific stuff -->
 | 
|---|
| 16 |     <condition property="isWindows">
 | 
|---|
| 17 |         <os family="Windows"/>
 | 
|---|
| 18 |     </condition>
 | 
|---|
| 19 | 
 | 
|---|
| 20 |     <import file="nbproject/build-impl.xml"/>
 | 
|---|
| 21 |     <!--
 | 
|---|
| 22 | 
 | 
|---|
| 23 |     There exist several targets which are by default empty and which can be 
 | 
|---|
| 24 |     used for execution of your tasks. These targets are usually executed 
 | 
|---|
| 25 |     before and after some main targets. They are: 
 | 
|---|
| 26 | 
 | 
|---|
| 27 |       -pre-init:                 called before initialization of project properties
 | 
|---|
| 28 |       -post-init:                called after initialization of project properties
 | 
|---|
| 29 |       -pre-compile:              called before javac compilation
 | 
|---|
| 30 |       -post-compile:             called after javac compilation
 | 
|---|
| 31 |       -pre-compile-single:       called before javac compilation of single file
 | 
|---|
| 32 |       -post-compile-single:      called after javac compilation of single file
 | 
|---|
| 33 |       -pre-compile-test:         called before javac compilation of JUnit tests
 | 
|---|
| 34 |       -post-compile-test:        called after javac compilation of JUnit tests
 | 
|---|
| 35 |       -pre-compile-test-single:  called before javac compilation of single JUnit test
 | 
|---|
| 36 |       -post-compile-test-single: called after javac compilation of single JUunit test
 | 
|---|
| 37 |       -pre-jar:                  called before JAR building
 | 
|---|
| 38 |       -post-jar:                 called after JAR building
 | 
|---|
| 39 |       -post-clean:               called after cleaning build products
 | 
|---|
| 40 | 
 | 
|---|
| 41 |     (Targets beginning with '-' are not intended to be called on their own.)
 | 
|---|
| 42 | 
 | 
|---|
| 43 |     Example of inserting an obfuscator after compilation could look like this:
 | 
|---|
| 44 | 
 | 
|---|
| 45 |         <target name="-post-compile">
 | 
|---|
| 46 |             <obfuscate>
 | 
|---|
| 47 |                 <fileset dir="${build.classes.dir}"/>
 | 
|---|
| 48 |             </obfuscate>
 | 
|---|
| 49 |         </target>
 | 
|---|
| 50 | 
 | 
|---|
| 51 |     For list of available properties check the imported 
 | 
|---|
| 52 |     nbproject/build-impl.xml file. 
 | 
|---|
| 53 | 
 | 
|---|
| 54 | 
 | 
|---|
| 55 |     Another way to customize the build is by overriding existing main targets.
 | 
|---|
| 56 |     The targets of interest are: 
 | 
|---|
| 57 | 
 | 
|---|
| 58 |       -init-macrodef-javac:     defines macro for javac compilation
 | 
|---|
| 59 |       -init-macrodef-junit:     defines macro for junit execution
 | 
|---|
| 60 |       -init-macrodef-debug:     defines macro for class debugging
 | 
|---|
| 61 |       -init-macrodef-java:      defines macro for class execution
 | 
|---|
| 62 |       -do-jar-with-manifest:    JAR building (if you are using a manifest)
 | 
|---|
| 63 |       -do-jar-without-manifest: JAR building (if you are not using a manifest)
 | 
|---|
| 64 |       run:                      execution of project 
 | 
|---|
| 65 |       -javadoc-build:           Javadoc generation
 | 
|---|
| 66 |       test-report:              JUnit report generation
 | 
|---|
| 67 | 
 | 
|---|
| 68 |     An example of overriding the target for project execution could look like this:
 | 
|---|
| 69 | 
 | 
|---|
| 70 |         <target name="run" depends="josm-impl.jar">
 | 
|---|
| 71 |             <exec dir="bin" executable="launcher.exe">
 | 
|---|
| 72 |                 <arg file="${dist.jar}"/>
 | 
|---|
| 73 |             </exec>
 | 
|---|
| 74 |         </target>
 | 
|---|
| 75 | 
 | 
|---|
| 76 |     Notice that the overridden target depends on the jar target and not only on 
 | 
|---|
| 77 |     the compile target as the regular run target does. Again, for a list of available 
 | 
|---|
| 78 |     properties which you can use, check the target you are overriding in the
 | 
|---|
| 79 |     nbproject/build-impl.xml file. 
 | 
|---|
| 80 | 
 | 
|---|
| 81 |     -->
 | 
|---|
| 82 |     
 | 
|---|
| 83 |     <target name="-post-compile">
 | 
|---|
| 84 |     <!-- create the REVISION file to be included in the distribution -->
 | 
|---|
| 85 |                 <exec append="false" output="REVISION.XML" executable="svn" dir=".." failifexecutionfails="false">
 | 
|---|
| 86 |                         <env key="LANG" value="C"/>
 | 
|---|
| 87 |                         <arg value="info"/>
 | 
|---|
| 88 |                         <arg value="--xml"/>
 | 
|---|
| 89 |                         <arg value="."/>
 | 
|---|
| 90 |                 </exec>
 | 
|---|
| 91 |                 <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
 | 
|---|
| 92 |                 <delete file="REVISION.XML" />
 | 
|---|
| 93 |                 <tstamp>
 | 
|---|
| 94 |                         <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
 | 
|---|
| 95 |                 </tstamp>
 | 
|---|
| 96 | 
 | 
|---|
| 97 |                 <property name="version.entry.commit.revision" value="UNKNOWN"/>
 | 
|---|
| 98 |                 <echo file="${build.classes.dir}/REVISION">
 | 
|---|
| 99 | # automatically generated by JOSM build.xml - do not edit
 | 
|---|
| 100 | Revision: ${version.entry.commit.revision}
 | 
|---|
| 101 | Is-Local-Build: true
 | 
|---|
| 102 | Build-Date: ${build.tstamp}
 | 
|---|
| 103 | </echo>
 | 
|---|
| 104 |         </target>
 | 
|---|
| 105 | 
 | 
|---|
| 106 |     <target name="check-javacc">
 | 
|---|
| 107 |         <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
 | 
|---|
| 108 |             <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
 | 
|---|
| 109 |         </uptodate>
 | 
|---|
| 110 |     </target>   
 | 
|---|
| 111 |     <target name="javacc" depends="check-javacc" unless="javacc.notRequired">
 | 
|---|
| 112 |         <mkdir dir="${mapcss.dir}/parsergen"/>
 | 
|---|
| 113 |         <exec append="false" executable="java" failifexecutionfails="true">
 | 
|---|
| 114 |             <arg value="-cp"/>
 | 
|---|
| 115 |             <arg value="${javacc.home}/javacc.jar"/>
 | 
|---|
| 116 |             <arg value="javacc"/>
 | 
|---|
| 117 |             <arg value="-DEBUG_PARSER=false"/>
 | 
|---|
| 118 |             <arg value="-DEBUG_TOKEN_MANAGER=false"/>
 | 
|---|
| 119 |             <arg value="-JDK_VERSION=1.7"/>
 | 
|---|
| 120 |             <arg value="-GRAMMAR_ENCODING=UTF-8"/>
 | 
|---|
| 121 |             <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
 | 
|---|
| 122 |             <arg value="${mapcss.dir}/MapCSSParser.jj"/>
 | 
|---|
| 123 |         </exec>
 | 
|---|
| 124 |     </target>
 | 
|---|
| 125 |     <target name="-pre-compile" depends="javacc">
 | 
|---|
| 126 | <!--        <javacc target="${mapcss.dir}/MapCSSParser.jj" javacchome="${javacc.home}" outputdirectory="${mapcss.dir}/parsergen"/>-->
 | 
|---|
| 127 |     </target>    
 | 
|---|
| 128 | </project>
 | 
|---|