1.1 --- a/.hgignore Wed Jan 27 18:30:40 2010 +0100
1.2 +++ b/.hgignore Wed Jan 27 18:30:57 2010 +0100
1.3 @@ -1,5 +1,6 @@
1.4 .*/build/.*
1.5 .*/dist/.*
1.6 .*/nbproject/private/.*
1.7 -.*orig$
1.8 +.*.orig$
1.9 +.*~$
1.10
2.1 --- a/samples/componentinjection/anagram-plain/build.xml Wed Jan 27 18:30:40 2010 +0100
2.2 +++ b/samples/componentinjection/anagram-plain/build.xml Wed Jan 27 18:30:57 2010 +0100
2.3 @@ -2,6 +2,11 @@
2.4 <!-- You may freely edit this file. See commented blocks below for -->
2.5 <!-- some examples of how to customize the build. -->
2.6 <!-- (If you delete it and reopen the project it will be recreated.) -->
2.7 +<!-- By default, only the Clean and Build commands use this build script. -->
2.8 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
2.9 +<!-- the Compile on Save feature is turned off for the project. -->
2.10 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
2.11 +<!-- in the project's Project Properties dialog box.-->
2.12 <project name="anagram-plain" default="default" basedir=".">
2.13 <description>Builds, tests, and runs the project anagram-plain.</description>
2.14 <import file="nbproject/build-impl.xml"/>
3.1 --- a/samples/componentinjection/anagram-plain/nbproject/build-impl.xml Wed Jan 27 18:30:40 2010 +0100
3.2 +++ b/samples/componentinjection/anagram-plain/nbproject/build-impl.xml Wed Jan 27 18:30:57 2010 +0100
3.3 @@ -19,7 +19,14 @@
3.4 - cleanup
3.5
3.6 -->
3.7 -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="anagram-plain-impl">
3.8 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="anagram-plain-impl">
3.9 + <fail message="Please build using Ant 1.7.1 or higher.">
3.10 + <condition>
3.11 + <not>
3.12 + <antversion atleast="1.7.1"/>
3.13 + </not>
3.14 + </condition>
3.15 + </fail>
3.16 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
3.17 <!--
3.18 ======================
3.19 @@ -48,21 +55,52 @@
3.20 </target>
3.21 <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
3.22 <available file="${manifest.file}" property="manifest.available"/>
3.23 - <condition property="manifest.available+main.class">
3.24 + <condition property="main.class.available">
3.25 <and>
3.26 - <isset property="manifest.available"/>
3.27 <isset property="main.class"/>
3.28 <not>
3.29 <equals arg1="${main.class}" arg2="" trim="true"/>
3.30 </not>
3.31 </and>
3.32 </condition>
3.33 + <condition property="manifest.available+main.class">
3.34 + <and>
3.35 + <isset property="manifest.available"/>
3.36 + <isset property="main.class.available"/>
3.37 + </and>
3.38 + </condition>
3.39 + <condition property="do.mkdist">
3.40 + <and>
3.41 + <isset property="libs.CopyLibs.classpath"/>
3.42 + <not>
3.43 + <istrue value="${mkdist.disabled}"/>
3.44 + </not>
3.45 + </and>
3.46 + </condition>
3.47 <condition property="manifest.available+main.class+mkdist.available">
3.48 <and>
3.49 <istrue value="${manifest.available+main.class}"/>
3.50 - <isset property="libs.CopyLibs.classpath"/>
3.51 + <isset property="do.mkdist"/>
3.52 </and>
3.53 </condition>
3.54 + <condition property="manifest.available+mkdist.available">
3.55 + <and>
3.56 + <istrue value="${manifest.available}"/>
3.57 + <isset property="do.mkdist"/>
3.58 + </and>
3.59 + </condition>
3.60 + <condition property="manifest.available-mkdist.available">
3.61 + <or>
3.62 + <istrue value="${manifest.available}"/>
3.63 + <isset property="do.mkdist"/>
3.64 + </or>
3.65 + </condition>
3.66 + <condition property="manifest.available+main.class-mkdist.available">
3.67 + <or>
3.68 + <istrue value="${manifest.available+main.class}"/>
3.69 + <isset property="do.mkdist"/>
3.70 + </or>
3.71 + </condition>
3.72 <condition property="have.tests">
3.73 <or>
3.74 <available file="${test.src.dir}"/>
3.75 @@ -97,6 +135,7 @@
3.76 <property name="javadoc.preview" value="true"/>
3.77 <property name="application.args" value=""/>
3.78 <property name="source.encoding" value="${file.encoding}"/>
3.79 + <property name="runtime.encoding" value="${source.encoding}"/>
3.80 <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
3.81 <and>
3.82 <isset property="javadoc.encoding"/>
3.83 @@ -112,12 +151,11 @@
3.84 <condition property="do.depend.true">
3.85 <istrue value="${do.depend}"/>
3.86 </condition>
3.87 - <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
3.88 - <and>
3.89 - <isset property="jaxws.endorsed.dir"/>
3.90 - <available file="nbproject/jaxws-build.xml"/>
3.91 - </and>
3.92 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
3.93 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
3.94 + <length length="0" string="${endorsed.classpath}" when="greater"/>
3.95 </condition>
3.96 + <property name="javac.fork" value="false"/>
3.97 </target>
3.98 <target name="-post-init">
3.99 <!-- Empty placeholder for easier customization. -->
3.100 @@ -152,14 +190,23 @@
3.101 <attribute default="${includes}" name="includes"/>
3.102 <attribute default="${excludes}" name="excludes"/>
3.103 <attribute default="${javac.debug}" name="debug"/>
3.104 - <attribute default="" name="sourcepath"/>
3.105 + <attribute default="${empty.dir}" name="sourcepath"/>
3.106 + <attribute default="${empty.dir}" name="gensrcdir"/>
3.107 <element name="customize" optional="true"/>
3.108 <sequential>
3.109 - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
3.110 + <property location="${build.dir}/empty" name="empty.dir"/>
3.111 + <mkdir dir="${empty.dir}"/>
3.112 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
3.113 + <src>
3.114 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
3.115 + <include name="*"/>
3.116 + </dirset>
3.117 + </src>
3.118 <classpath>
3.119 <path path="@{classpath}"/>
3.120 </classpath>
3.121 - <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
3.122 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
3.123 + <compilerarg line="${javac.compilerargs}"/>
3.124 <customize/>
3.125 </javac>
3.126 </sequential>
3.127 @@ -198,7 +245,7 @@
3.128 <attribute default="${excludes}" name="excludes"/>
3.129 <attribute default="**" name="testincludes"/>
3.130 <sequential>
3.131 - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
3.132 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
3.133 <batchtest todir="${build.test.results.dir}">
3.134 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
3.135 <filename name="@{testincludes}"/>
3.136 @@ -213,18 +260,19 @@
3.137 </syspropertyset>
3.138 <formatter type="brief" usefile="false"/>
3.139 <formatter type="xml"/>
3.140 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.141 <jvmarg line="${run.jvmargs}"/>
3.142 </junit>
3.143 </sequential>
3.144 </macrodef>
3.145 </target>
3.146 - <target name="-init-macrodef-nbjpda">
3.147 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
3.148 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
3.149 <attribute default="${main.class}" name="name"/>
3.150 <attribute default="${debug.classpath}" name="classpath"/>
3.151 <attribute default="" name="stopclassname"/>
3.152 <sequential>
3.153 - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
3.154 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
3.155 <classpath>
3.156 <path path="@{classpath}"/>
3.157 </classpath>
3.158 @@ -235,7 +283,9 @@
3.159 <attribute default="${build.classes.dir}" name="dir"/>
3.160 <sequential>
3.161 <nbjpdareload>
3.162 - <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
3.163 + <fileset dir="@{dir}" includes="${fix.classes}">
3.164 + <include name="${fix.includes}*.class"/>
3.165 + </fileset>
3.166 </nbjpdareload>
3.167 </sequential>
3.168 </macrodef>
3.169 @@ -253,6 +303,12 @@
3.170 <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
3.171 <istrue value="${have-jdk-older-than-1.4}"/>
3.172 </condition>
3.173 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
3.174 + <os family="windows"/>
3.175 + </condition>
3.176 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
3.177 + <isset property="debug.transport"/>
3.178 + </condition>
3.179 </target>
3.180 <target depends="-init-debug-args" name="-init-macrodef-debug">
3.181 <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
3.182 @@ -261,8 +317,11 @@
3.183 <element name="customize" optional="true"/>
3.184 <sequential>
3.185 <java classname="@{classname}" dir="${work.dir}" fork="true">
3.186 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.187 <jvmarg line="${debug-args-line}"/>
3.188 - <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
3.189 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
3.190 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
3.191 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
3.192 <jvmarg line="${run.jvmargs}"/>
3.193 <classpath>
3.194 <path path="@{classpath}"/>
3.195 @@ -279,12 +338,16 @@
3.196 <target name="-init-macrodef-java">
3.197 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
3.198 <attribute default="${main.class}" name="classname"/>
3.199 + <attribute default="${run.classpath}" name="classpath"/>
3.200 <element name="customize" optional="true"/>
3.201 <sequential>
3.202 <java classname="@{classname}" dir="${work.dir}" fork="true">
3.203 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
3.204 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
3.205 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
3.206 <jvmarg line="${run.jvmargs}"/>
3.207 <classpath>
3.208 - <path path="${run.classpath}"/>
3.209 + <path path="@{classpath}"/>
3.210 </classpath>
3.211 <syspropertyset>
3.212 <propertyref prefix="run-sys-prop."/>
3.213 @@ -308,7 +371,29 @@
3.214 COMPILATION SECTION
3.215 ===================
3.216 -->
3.217 - <target depends="init" name="deps-jar" unless="no.deps"/>
3.218 + <target name="-deps-jar-init" unless="built-jar.properties">
3.219 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
3.220 + <delete file="${built-jar.properties}" quiet="true"/>
3.221 + </target>
3.222 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
3.223 + <echo level="warn" message="Cycle detected: anagram-plain was already built"/>
3.224 + </target>
3.225 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
3.226 + <mkdir dir="${build.dir}"/>
3.227 + <touch file="${built-jar.properties}" verbose="false"/>
3.228 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
3.229 + <antcall target="-warn-already-built-jar"/>
3.230 + <propertyfile file="${built-jar.properties}">
3.231 + <entry key="${basedir}" value=""/>
3.232 + </propertyfile>
3.233 + </target>
3.234 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
3.235 + <target depends="init" name="-check-automatic-build">
3.236 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
3.237 + </target>
3.238 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
3.239 + <antcall target="clean"/>
3.240 + </target>
3.241 <target depends="init,deps-jar" name="-pre-pre-compile">
3.242 <mkdir dir="${build.classes.dir}"/>
3.243 </target>
3.244 @@ -317,10 +402,15 @@
3.245 <!-- You can override this target in the ../build.xml file. -->
3.246 </target>
3.247 <target if="do.depend.true" name="-compile-depend">
3.248 - <j2seproject3:depend/>
3.249 + <pathconvert property="build.generated.subdirs">
3.250 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3.251 + <include name="*"/>
3.252 + </dirset>
3.253 + </pathconvert>
3.254 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
3.255 </target>
3.256 <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
3.257 - <j2seproject3:javac/>
3.258 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
3.259 <copy todir="${build.classes.dir}">
3.260 <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
3.261 </copy>
3.262 @@ -329,7 +419,7 @@
3.263 <!-- Empty placeholder for easier customization. -->
3.264 <!-- You can override this target in the ../build.xml file. -->
3.265 </target>
3.266 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
3.267 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
3.268 <target name="-pre-compile-single">
3.269 <!-- Empty placeholder for easier customization. -->
3.270 <!-- You can override this target in the ../build.xml file. -->
3.271 @@ -337,13 +427,13 @@
3.272 <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
3.273 <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
3.274 <j2seproject3:force-recompile/>
3.275 - <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
3.276 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
3.277 </target>
3.278 <target name="-post-compile-single">
3.279 <!-- Empty placeholder for easier customization. -->
3.280 <!-- You can override this target in the ../build.xml file. -->
3.281 </target>
3.282 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
3.283 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
3.284 <!--
3.285 ====================
3.286 JAR BUILDING SECTION
3.287 @@ -357,10 +447,10 @@
3.288 <!-- Empty placeholder for easier customization. -->
3.289 <!-- You can override this target in the ../build.xml file. -->
3.290 </target>
3.291 - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
3.292 + <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
3.293 <j2seproject1:jar/>
3.294 </target>
3.295 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
3.296 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
3.297 <j2seproject1:jar manifest="${manifest.file}"/>
3.298 </target>
3.299 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
3.300 @@ -403,11 +493,53 @@
3.301 <property location="${dist.jar}" name="dist.jar.resolved"/>
3.302 <echo>java -jar "${dist.jar.resolved}"</echo>
3.303 </target>
3.304 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
3.305 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
3.306 + <pathconvert property="run.classpath.without.build.classes.dir">
3.307 + <path path="${run.classpath}"/>
3.308 + <map from="${build.classes.dir.resolved}" to=""/>
3.309 + </pathconvert>
3.310 + <pathconvert pathsep=" " property="jar.classpath">
3.311 + <path path="${run.classpath.without.build.classes.dir}"/>
3.312 + <chainedmapper>
3.313 + <flattenmapper/>
3.314 + <globmapper from="*" to="lib/*"/>
3.315 + </chainedmapper>
3.316 + </pathconvert>
3.317 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
3.318 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
3.319 + <fileset dir="${build.classes.dir}"/>
3.320 + <manifest>
3.321 + <attribute name="Class-Path" value="${jar.classpath}"/>
3.322 + </manifest>
3.323 + </copylibs>
3.324 + </target>
3.325 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
3.326 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
3.327 + <pathconvert property="run.classpath.without.build.classes.dir">
3.328 + <path path="${run.classpath}"/>
3.329 + <map from="${build.classes.dir.resolved}" to=""/>
3.330 + </pathconvert>
3.331 + <pathconvert pathsep=" " property="jar.classpath">
3.332 + <path path="${run.classpath.without.build.classes.dir}"/>
3.333 + <chainedmapper>
3.334 + <flattenmapper/>
3.335 + <globmapper from="*" to="lib/*"/>
3.336 + </chainedmapper>
3.337 + </pathconvert>
3.338 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
3.339 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
3.340 + <fileset dir="${build.classes.dir}"/>
3.341 + <manifest>
3.342 + <attribute name="Class-Path" value="${jar.classpath}"/>
3.343 + </manifest>
3.344 + </copylibs>
3.345 + </target>
3.346 <target name="-post-jar">
3.347 <!-- Empty placeholder for easier customization. -->
3.348 <!-- You can override this target in the ../build.xml file. -->
3.349 </target>
3.350 - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
3.351 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
3.352 <!--
3.353 =================
3.354 EXECUTION SECTION
3.355 @@ -423,10 +555,14 @@
3.356 <target name="-do-not-recompile">
3.357 <property name="javac.includes.binary" value=""/>
3.358 </target>
3.359 - <target depends="init,-do-not-recompile,compile-single" name="run-single">
3.360 + <target depends="init,compile-single" name="run-single">
3.361 <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3.362 <j2seproject1:java classname="${run.class}"/>
3.363 </target>
3.364 + <target depends="init,compile-test-single" name="run-test-with-main">
3.365 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
3.366 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
3.367 + </target>
3.368 <!--
3.369 =================
3.370 DEBUGGING SECTION
3.371 @@ -435,6 +571,9 @@
3.372 <target depends="init" if="netbeans.home" name="-debug-start-debugger">
3.373 <j2seproject1:nbjpdastart name="${debug.class}"/>
3.374 </target>
3.375 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
3.376 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
3.377 + </target>
3.378 <target depends="init,compile" name="-debug-start-debuggee">
3.379 <j2seproject3:debug>
3.380 <customize>
3.381 @@ -451,7 +590,12 @@
3.382 <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
3.383 <j2seproject3:debug classname="${debug.class}"/>
3.384 </target>
3.385 - <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
3.386 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
3.387 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
3.388 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
3.389 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
3.390 + </target>
3.391 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
3.392 <target depends="init" name="-pre-debug-fix">
3.393 <fail unless="fix.includes">Must set fix.includes</fail>
3.394 <property name="javac.includes" value="${fix.includes}.java"/>
3.395 @@ -474,6 +618,9 @@
3.396 <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
3.397 <filename name="**/*.java"/>
3.398 </fileset>
3.399 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
3.400 + <include name="**/*.java"/>
3.401 + </fileset>
3.402 </javadoc>
3.403 </target>
3.404 <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
3.405 @@ -535,7 +682,7 @@
3.406 <j2seproject3:junit testincludes="**/*Test.java"/>
3.407 </target>
3.408 <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
3.409 - <fail if="tests.failed">Some tests failed; see details above.</fail>
3.410 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3.411 </target>
3.412 <target depends="init" if="have.tests" name="test-report"/>
3.413 <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
3.414 @@ -548,9 +695,9 @@
3.415 <j2seproject3:junit excludes="" includes="${test.includes}"/>
3.416 </target>
3.417 <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
3.418 - <fail if="tests.failed">Some tests failed; see details above.</fail>
3.419 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
3.420 </target>
3.421 - <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
3.422 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
3.423 <!--
3.424 =======================
3.425 JUNIT DEBUGGING SECTION
3.426 @@ -577,7 +724,7 @@
3.427 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
3.428 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
3.429 </target>
3.430 - <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
3.431 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
3.432 <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
3.433 <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
3.434 </target>
3.435 @@ -614,14 +761,45 @@
3.436 CLEANUP SECTION
3.437 ===============
3.438 -->
3.439 - <target depends="init" name="deps-clean" unless="no.deps"/>
3.440 + <target name="-deps-clean-init" unless="built-clean.properties">
3.441 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
3.442 + <delete file="${built-clean.properties}" quiet="true"/>
3.443 + </target>
3.444 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
3.445 + <echo level="warn" message="Cycle detected: anagram-plain was already built"/>
3.446 + </target>
3.447 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
3.448 + <mkdir dir="${build.dir}"/>
3.449 + <touch file="${built-clean.properties}" verbose="false"/>
3.450 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
3.451 + <antcall target="-warn-already-built-clean"/>
3.452 + <propertyfile file="${built-clean.properties}">
3.453 + <entry key="${basedir}" value=""/>
3.454 + </propertyfile>
3.455 + </target>
3.456 <target depends="init" name="-do-clean">
3.457 <delete dir="${build.dir}"/>
3.458 - <delete dir="${dist.dir}"/>
3.459 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
3.460 </target>
3.461 <target name="-post-clean">
3.462 <!-- Empty placeholder for easier customization. -->
3.463 <!-- You can override this target in the ../build.xml file. -->
3.464 </target>
3.465 <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
3.466 + <target name="-check-call-dep">
3.467 + <property file="${call.built.properties}" prefix="already.built."/>
3.468 + <condition property="should.call.dep">
3.469 + <not>
3.470 + <isset property="already.built.${call.subproject}"/>
3.471 + </not>
3.472 + </condition>
3.473 + </target>
3.474 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
3.475 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
3.476 + <propertyset>
3.477 + <propertyref prefix="transfer."/>
3.478 + <mapper from="transfer.*" to="*" type="glob"/>
3.479 + </propertyset>
3.480 + </ant>
3.481 + </target>
3.482 </project>
4.1 --- a/samples/componentinjection/anagram-plain/nbproject/genfiles.properties Wed Jan 27 18:30:40 2010 +0100
4.2 +++ b/samples/componentinjection/anagram-plain/nbproject/genfiles.properties Wed Jan 27 18:30:57 2010 +0100
4.3 @@ -1,8 +1,8 @@
4.4 build.xml.data.CRC32=a145f2df
4.5 -build.xml.script.CRC32=d6f783b7
4.6 -build.xml.stylesheet.CRC32=be360661
4.7 +build.xml.script.CRC32=5535cf40
4.8 +build.xml.stylesheet.CRC32=958a1d3e@1.34.0.45
4.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
4.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
4.11 nbproject/build-impl.xml.data.CRC32=a145f2df
4.12 -nbproject/build-impl.xml.script.CRC32=751fa40b
4.13 -nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
4.14 +nbproject/build-impl.xml.script.CRC32=e5485127
4.15 +nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.34.0.45
5.1 --- a/samples/componentinjection/anagram-plain/nbproject/project.properties Wed Jan 27 18:30:40 2010 +0100
5.2 +++ b/samples/componentinjection/anagram-plain/nbproject/project.properties Wed Jan 27 18:30:57 2010 +0100
5.3 @@ -3,6 +3,7 @@
5.4 # This directory is removed when the project is cleaned:
5.5 build.dir=build
5.6 build.generated.dir=${build.dir}/generated
5.7 +build.generated.sources.dir=${build.dir}/generated-sources
5.8 # Only compile against the classpath explicitly listed here:
5.9 build.sysclasspath=ignore
5.10 build.test.classes.dir=${build.dir}/test/classes
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/samples/singletons/build.xml Wed Jan 27 18:30:57 2010 +0100
6.3 @@ -0,0 +1,74 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<!-- You may freely edit this file. See commented blocks below for -->
6.6 +<!-- some examples of how to customize the build. -->
6.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
6.8 +<!-- By default, only the Clean and Build commands use this build script. -->
6.9 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
6.10 +<!-- the Compile on Save feature is turned off for the project. -->
6.11 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
6.12 +<!-- in the project's Project Properties dialog box.-->
6.13 +<project name="singletons" default="default" basedir=".">
6.14 + <description>Builds, tests, and runs the project singletons.</description>
6.15 + <import file="nbproject/build-impl.xml"/>
6.16 + <!--
6.17 +
6.18 + There exist several targets which are by default empty and which can be
6.19 + used for execution of your tasks. These targets are usually executed
6.20 + before and after some main targets. They are:
6.21 +
6.22 + -pre-init: called before initialization of project properties
6.23 + -post-init: called after initialization of project properties
6.24 + -pre-compile: called before javac compilation
6.25 + -post-compile: called after javac compilation
6.26 + -pre-compile-single: called before javac compilation of single file
6.27 + -post-compile-single: called after javac compilation of single file
6.28 + -pre-compile-test: called before javac compilation of JUnit tests
6.29 + -post-compile-test: called after javac compilation of JUnit tests
6.30 + -pre-compile-test-single: called before javac compilation of single JUnit test
6.31 + -post-compile-test-single: called after javac compilation of single JUunit test
6.32 + -pre-jar: called before JAR building
6.33 + -post-jar: called after JAR building
6.34 + -post-clean: called after cleaning build products
6.35 +
6.36 + (Targets beginning with '-' are not intended to be called on their own.)
6.37 +
6.38 + Example of inserting an obfuscator after compilation could look like this:
6.39 +
6.40 + <target name="-post-compile">
6.41 + <obfuscate>
6.42 + <fileset dir="${build.classes.dir}"/>
6.43 + </obfuscate>
6.44 + </target>
6.45 +
6.46 + For list of available properties check the imported
6.47 + nbproject/build-impl.xml file.
6.48 +
6.49 +
6.50 + Another way to customize the build is by overriding existing main targets.
6.51 + The targets of interest are:
6.52 +
6.53 + -init-macrodef-javac: defines macro for javac compilation
6.54 + -init-macrodef-junit: defines macro for junit execution
6.55 + -init-macrodef-debug: defines macro for class debugging
6.56 + -init-macrodef-java: defines macro for class execution
6.57 + -do-jar-with-manifest: JAR building (if you are using a manifest)
6.58 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
6.59 + run: execution of project
6.60 + -javadoc-build: Javadoc generation
6.61 + test-report: JUnit report generation
6.62 +
6.63 + An example of overriding the target for project execution could look like this:
6.64 +
6.65 + <target name="run" depends="singletons-impl.jar">
6.66 + <exec dir="bin" executable="launcher.exe">
6.67 + <arg file="${dist.jar}"/>
6.68 + </exec>
6.69 + </target>
6.70 +
6.71 + Notice that the overridden target depends on the jar target and not only on
6.72 + the compile target as the regular run target does. Again, for a list of available
6.73 + properties which you can use, check the target you are overriding in the
6.74 + nbproject/build-impl.xml file.
6.75 +
6.76 + -->
6.77 +</project>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/samples/singletons/nbproject/build-impl.xml Wed Jan 27 18:30:57 2010 +0100
7.3 @@ -0,0 +1,805 @@
7.4 +<?xml version="1.0" encoding="UTF-8"?>
7.5 +<!--
7.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
7.7 +*** EDIT ../build.xml INSTEAD ***
7.8 +
7.9 +For the purpose of easier reading the script
7.10 +is divided into following sections:
7.11 +
7.12 + - initialization
7.13 + - compilation
7.14 + - jar
7.15 + - execution
7.16 + - debugging
7.17 + - javadoc
7.18 + - junit compilation
7.19 + - junit execution
7.20 + - junit debugging
7.21 + - applet
7.22 + - cleanup
7.23 +
7.24 + -->
7.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="singletons-impl">
7.26 + <fail message="Please build using Ant 1.7.1 or higher.">
7.27 + <condition>
7.28 + <not>
7.29 + <antversion atleast="1.7.1"/>
7.30 + </not>
7.31 + </condition>
7.32 + </fail>
7.33 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
7.34 + <!--
7.35 + ======================
7.36 + INITIALIZATION SECTION
7.37 + ======================
7.38 + -->
7.39 + <target name="-pre-init">
7.40 + <!-- Empty placeholder for easier customization. -->
7.41 + <!-- You can override this target in the ../build.xml file. -->
7.42 + </target>
7.43 + <target depends="-pre-init" name="-init-private">
7.44 + <property file="nbproject/private/config.properties"/>
7.45 + <property file="nbproject/private/configs/${config}.properties"/>
7.46 + <property file="nbproject/private/private.properties"/>
7.47 + </target>
7.48 + <target depends="-pre-init,-init-private" name="-init-user">
7.49 + <property file="${user.properties.file}"/>
7.50 + <!-- The two properties below are usually overridden -->
7.51 + <!-- by the active platform. Just a fallback. -->
7.52 + <property name="default.javac.source" value="1.4"/>
7.53 + <property name="default.javac.target" value="1.4"/>
7.54 + </target>
7.55 + <target depends="-pre-init,-init-private,-init-user" name="-init-project">
7.56 + <property file="nbproject/configs/${config}.properties"/>
7.57 + <property file="nbproject/project.properties"/>
7.58 + </target>
7.59 + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
7.60 + <available file="${manifest.file}" property="manifest.available"/>
7.61 + <condition property="main.class.available">
7.62 + <and>
7.63 + <isset property="main.class"/>
7.64 + <not>
7.65 + <equals arg1="${main.class}" arg2="" trim="true"/>
7.66 + </not>
7.67 + </and>
7.68 + </condition>
7.69 + <condition property="manifest.available+main.class">
7.70 + <and>
7.71 + <isset property="manifest.available"/>
7.72 + <isset property="main.class.available"/>
7.73 + </and>
7.74 + </condition>
7.75 + <condition property="do.mkdist">
7.76 + <and>
7.77 + <isset property="libs.CopyLibs.classpath"/>
7.78 + <not>
7.79 + <istrue value="${mkdist.disabled}"/>
7.80 + </not>
7.81 + </and>
7.82 + </condition>
7.83 + <condition property="manifest.available+main.class+mkdist.available">
7.84 + <and>
7.85 + <istrue value="${manifest.available+main.class}"/>
7.86 + <isset property="do.mkdist"/>
7.87 + </and>
7.88 + </condition>
7.89 + <condition property="manifest.available+mkdist.available">
7.90 + <and>
7.91 + <istrue value="${manifest.available}"/>
7.92 + <isset property="do.mkdist"/>
7.93 + </and>
7.94 + </condition>
7.95 + <condition property="manifest.available-mkdist.available">
7.96 + <or>
7.97 + <istrue value="${manifest.available}"/>
7.98 + <isset property="do.mkdist"/>
7.99 + </or>
7.100 + </condition>
7.101 + <condition property="manifest.available+main.class-mkdist.available">
7.102 + <or>
7.103 + <istrue value="${manifest.available+main.class}"/>
7.104 + <isset property="do.mkdist"/>
7.105 + </or>
7.106 + </condition>
7.107 + <condition property="have.tests">
7.108 + <or>
7.109 + <available file="${test.src.dir}"/>
7.110 + </or>
7.111 + </condition>
7.112 + <condition property="have.sources">
7.113 + <or>
7.114 + <available file="${src.dir}"/>
7.115 + </or>
7.116 + </condition>
7.117 + <condition property="netbeans.home+have.tests">
7.118 + <and>
7.119 + <isset property="netbeans.home"/>
7.120 + <isset property="have.tests"/>
7.121 + </and>
7.122 + </condition>
7.123 + <condition property="no.javadoc.preview">
7.124 + <and>
7.125 + <isset property="javadoc.preview"/>
7.126 + <isfalse value="${javadoc.preview}"/>
7.127 + </and>
7.128 + </condition>
7.129 + <property name="run.jvmargs" value=""/>
7.130 + <property name="javac.compilerargs" value=""/>
7.131 + <property name="work.dir" value="${basedir}"/>
7.132 + <condition property="no.deps">
7.133 + <and>
7.134 + <istrue value="${no.dependencies}"/>
7.135 + </and>
7.136 + </condition>
7.137 + <property name="javac.debug" value="true"/>
7.138 + <property name="javadoc.preview" value="true"/>
7.139 + <property name="application.args" value=""/>
7.140 + <property name="source.encoding" value="${file.encoding}"/>
7.141 + <property name="runtime.encoding" value="${source.encoding}"/>
7.142 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
7.143 + <and>
7.144 + <isset property="javadoc.encoding"/>
7.145 + <not>
7.146 + <equals arg1="${javadoc.encoding}" arg2=""/>
7.147 + </not>
7.148 + </and>
7.149 + </condition>
7.150 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
7.151 + <property name="includes" value="**"/>
7.152 + <property name="excludes" value=""/>
7.153 + <property name="do.depend" value="false"/>
7.154 + <condition property="do.depend.true">
7.155 + <istrue value="${do.depend}"/>
7.156 + </condition>
7.157 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
7.158 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
7.159 + <length length="0" string="${endorsed.classpath}" when="greater"/>
7.160 + </condition>
7.161 + <property name="javac.fork" value="false"/>
7.162 + </target>
7.163 + <target name="-post-init">
7.164 + <!-- Empty placeholder for easier customization. -->
7.165 + <!-- You can override this target in the ../build.xml file. -->
7.166 + </target>
7.167 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
7.168 + <fail unless="src.dir">Must set src.dir</fail>
7.169 + <fail unless="test.src.dir">Must set test.src.dir</fail>
7.170 + <fail unless="build.dir">Must set build.dir</fail>
7.171 + <fail unless="dist.dir">Must set dist.dir</fail>
7.172 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
7.173 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
7.174 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
7.175 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
7.176 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
7.177 + <fail unless="dist.jar">Must set dist.jar</fail>
7.178 + </target>
7.179 + <target name="-init-macrodef-property">
7.180 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
7.181 + <attribute name="name"/>
7.182 + <attribute name="value"/>
7.183 + <sequential>
7.184 + <property name="@{name}" value="${@{value}}"/>
7.185 + </sequential>
7.186 + </macrodef>
7.187 + </target>
7.188 + <target name="-init-macrodef-javac">
7.189 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
7.190 + <attribute default="${src.dir}" name="srcdir"/>
7.191 + <attribute default="${build.classes.dir}" name="destdir"/>
7.192 + <attribute default="${javac.classpath}" name="classpath"/>
7.193 + <attribute default="${includes}" name="includes"/>
7.194 + <attribute default="${excludes}" name="excludes"/>
7.195 + <attribute default="${javac.debug}" name="debug"/>
7.196 + <attribute default="${empty.dir}" name="sourcepath"/>
7.197 + <attribute default="${empty.dir}" name="gensrcdir"/>
7.198 + <element name="customize" optional="true"/>
7.199 + <sequential>
7.200 + <property location="${build.dir}/empty" name="empty.dir"/>
7.201 + <mkdir dir="${empty.dir}"/>
7.202 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
7.203 + <src>
7.204 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
7.205 + <include name="*"/>
7.206 + </dirset>
7.207 + </src>
7.208 + <classpath>
7.209 + <path path="@{classpath}"/>
7.210 + </classpath>
7.211 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
7.212 + <compilerarg line="${javac.compilerargs}"/>
7.213 + <customize/>
7.214 + </javac>
7.215 + </sequential>
7.216 + </macrodef>
7.217 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
7.218 + <attribute default="${src.dir}" name="srcdir"/>
7.219 + <attribute default="${build.classes.dir}" name="destdir"/>
7.220 + <attribute default="${javac.classpath}" name="classpath"/>
7.221 + <sequential>
7.222 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
7.223 + <classpath>
7.224 + <path path="@{classpath}"/>
7.225 + </classpath>
7.226 + </depend>
7.227 + </sequential>
7.228 + </macrodef>
7.229 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
7.230 + <attribute default="${build.classes.dir}" name="destdir"/>
7.231 + <sequential>
7.232 + <fail unless="javac.includes">Must set javac.includes</fail>
7.233 + <pathconvert pathsep="," property="javac.includes.binary">
7.234 + <path>
7.235 + <filelist dir="@{destdir}" files="${javac.includes}"/>
7.236 + </path>
7.237 + <globmapper from="*.java" to="*.class"/>
7.238 + </pathconvert>
7.239 + <delete>
7.240 + <files includes="${javac.includes.binary}"/>
7.241 + </delete>
7.242 + </sequential>
7.243 + </macrodef>
7.244 + </target>
7.245 + <target name="-init-macrodef-junit">
7.246 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
7.247 + <attribute default="${includes}" name="includes"/>
7.248 + <attribute default="${excludes}" name="excludes"/>
7.249 + <attribute default="**" name="testincludes"/>
7.250 + <sequential>
7.251 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
7.252 + <batchtest todir="${build.test.results.dir}">
7.253 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.254 + <filename name="@{testincludes}"/>
7.255 + </fileset>
7.256 + </batchtest>
7.257 + <classpath>
7.258 + <path path="${run.test.classpath}"/>
7.259 + </classpath>
7.260 + <syspropertyset>
7.261 + <propertyref prefix="test-sys-prop."/>
7.262 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.263 + </syspropertyset>
7.264 + <formatter type="brief" usefile="false"/>
7.265 + <formatter type="xml"/>
7.266 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
7.267 + <jvmarg line="${run.jvmargs}"/>
7.268 + </junit>
7.269 + </sequential>
7.270 + </macrodef>
7.271 + </target>
7.272 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
7.273 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
7.274 + <attribute default="${main.class}" name="name"/>
7.275 + <attribute default="${debug.classpath}" name="classpath"/>
7.276 + <attribute default="" name="stopclassname"/>
7.277 + <sequential>
7.278 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
7.279 + <classpath>
7.280 + <path path="@{classpath}"/>
7.281 + </classpath>
7.282 + </nbjpdastart>
7.283 + </sequential>
7.284 + </macrodef>
7.285 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
7.286 + <attribute default="${build.classes.dir}" name="dir"/>
7.287 + <sequential>
7.288 + <nbjpdareload>
7.289 + <fileset dir="@{dir}" includes="${fix.classes}">
7.290 + <include name="${fix.includes}*.class"/>
7.291 + </fileset>
7.292 + </nbjpdareload>
7.293 + </sequential>
7.294 + </macrodef>
7.295 + </target>
7.296 + <target name="-init-debug-args">
7.297 + <property name="version-output" value="java version "${ant.java.version}"/>
7.298 + <condition property="have-jdk-older-than-1.4">
7.299 + <or>
7.300 + <contains string="${version-output}" substring="java version "1.0"/>
7.301 + <contains string="${version-output}" substring="java version "1.1"/>
7.302 + <contains string="${version-output}" substring="java version "1.2"/>
7.303 + <contains string="${version-output}" substring="java version "1.3"/>
7.304 + </or>
7.305 + </condition>
7.306 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
7.307 + <istrue value="${have-jdk-older-than-1.4}"/>
7.308 + </condition>
7.309 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
7.310 + <os family="windows"/>
7.311 + </condition>
7.312 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
7.313 + <isset property="debug.transport"/>
7.314 + </condition>
7.315 + </target>
7.316 + <target depends="-init-debug-args" name="-init-macrodef-debug">
7.317 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
7.318 + <attribute default="${main.class}" name="classname"/>
7.319 + <attribute default="${debug.classpath}" name="classpath"/>
7.320 + <element name="customize" optional="true"/>
7.321 + <sequential>
7.322 + <java classname="@{classname}" dir="${work.dir}" fork="true">
7.323 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
7.324 + <jvmarg line="${debug-args-line}"/>
7.325 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
7.326 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
7.327 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
7.328 + <jvmarg line="${run.jvmargs}"/>
7.329 + <classpath>
7.330 + <path path="@{classpath}"/>
7.331 + </classpath>
7.332 + <syspropertyset>
7.333 + <propertyref prefix="run-sys-prop."/>
7.334 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
7.335 + </syspropertyset>
7.336 + <customize/>
7.337 + </java>
7.338 + </sequential>
7.339 + </macrodef>
7.340 + </target>
7.341 + <target name="-init-macrodef-java">
7.342 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
7.343 + <attribute default="${main.class}" name="classname"/>
7.344 + <attribute default="${run.classpath}" name="classpath"/>
7.345 + <element name="customize" optional="true"/>
7.346 + <sequential>
7.347 + <java classname="@{classname}" dir="${work.dir}" fork="true">
7.348 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
7.349 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
7.350 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
7.351 + <jvmarg line="${run.jvmargs}"/>
7.352 + <classpath>
7.353 + <path path="@{classpath}"/>
7.354 + </classpath>
7.355 + <syspropertyset>
7.356 + <propertyref prefix="run-sys-prop."/>
7.357 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
7.358 + </syspropertyset>
7.359 + <customize/>
7.360 + </java>
7.361 + </sequential>
7.362 + </macrodef>
7.363 + </target>
7.364 + <target name="-init-presetdef-jar">
7.365 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
7.366 + <jar compress="${jar.compress}" jarfile="${dist.jar}">
7.367 + <j2seproject1:fileset dir="${build.classes.dir}"/>
7.368 + </jar>
7.369 + </presetdef>
7.370 + </target>
7.371 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
7.372 + <!--
7.373 + ===================
7.374 + COMPILATION SECTION
7.375 + ===================
7.376 + -->
7.377 + <target name="-deps-jar-init" unless="built-jar.properties">
7.378 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
7.379 + <delete file="${built-jar.properties}" quiet="true"/>
7.380 + </target>
7.381 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
7.382 + <echo level="warn" message="Cycle detected: singletons was already built"/>
7.383 + </target>
7.384 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
7.385 + <mkdir dir="${build.dir}"/>
7.386 + <touch file="${built-jar.properties}" verbose="false"/>
7.387 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
7.388 + <antcall target="-warn-already-built-jar"/>
7.389 + <propertyfile file="${built-jar.properties}">
7.390 + <entry key="${basedir}" value=""/>
7.391 + </propertyfile>
7.392 + </target>
7.393 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
7.394 + <target depends="init" name="-check-automatic-build">
7.395 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
7.396 + </target>
7.397 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
7.398 + <antcall target="clean"/>
7.399 + </target>
7.400 + <target depends="init,deps-jar" name="-pre-pre-compile">
7.401 + <mkdir dir="${build.classes.dir}"/>
7.402 + </target>
7.403 + <target name="-pre-compile">
7.404 + <!-- Empty placeholder for easier customization. -->
7.405 + <!-- You can override this target in the ../build.xml file. -->
7.406 + </target>
7.407 + <target if="do.depend.true" name="-compile-depend">
7.408 + <pathconvert property="build.generated.subdirs">
7.409 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
7.410 + <include name="*"/>
7.411 + </dirset>
7.412 + </pathconvert>
7.413 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
7.414 + </target>
7.415 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
7.416 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
7.417 + <copy todir="${build.classes.dir}">
7.418 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
7.419 + </copy>
7.420 + </target>
7.421 + <target name="-post-compile">
7.422 + <!-- Empty placeholder for easier customization. -->
7.423 + <!-- You can override this target in the ../build.xml file. -->
7.424 + </target>
7.425 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
7.426 + <target name="-pre-compile-single">
7.427 + <!-- Empty placeholder for easier customization. -->
7.428 + <!-- You can override this target in the ../build.xml file. -->
7.429 + </target>
7.430 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
7.431 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
7.432 + <j2seproject3:force-recompile/>
7.433 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
7.434 + </target>
7.435 + <target name="-post-compile-single">
7.436 + <!-- Empty placeholder for easier customization. -->
7.437 + <!-- You can override this target in the ../build.xml file. -->
7.438 + </target>
7.439 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
7.440 + <!--
7.441 + ====================
7.442 + JAR BUILDING SECTION
7.443 + ====================
7.444 + -->
7.445 + <target depends="init" name="-pre-pre-jar">
7.446 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
7.447 + <mkdir dir="${dist.jar.dir}"/>
7.448 + </target>
7.449 + <target name="-pre-jar">
7.450 + <!-- Empty placeholder for easier customization. -->
7.451 + <!-- You can override this target in the ../build.xml file. -->
7.452 + </target>
7.453 + <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
7.454 + <j2seproject1:jar/>
7.455 + </target>
7.456 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
7.457 + <j2seproject1:jar manifest="${manifest.file}"/>
7.458 + </target>
7.459 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
7.460 + <j2seproject1:jar manifest="${manifest.file}">
7.461 + <j2seproject1:manifest>
7.462 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
7.463 + </j2seproject1:manifest>
7.464 + </j2seproject1:jar>
7.465 + <echo>To run this application from the command line without Ant, try:</echo>
7.466 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
7.467 + <property location="${dist.jar}" name="dist.jar.resolved"/>
7.468 + <pathconvert property="run.classpath.with.dist.jar">
7.469 + <path path="${run.classpath}"/>
7.470 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
7.471 + </pathconvert>
7.472 + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
7.473 + </target>
7.474 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
7.475 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
7.476 + <pathconvert property="run.classpath.without.build.classes.dir">
7.477 + <path path="${run.classpath}"/>
7.478 + <map from="${build.classes.dir.resolved}" to=""/>
7.479 + </pathconvert>
7.480 + <pathconvert pathsep=" " property="jar.classpath">
7.481 + <path path="${run.classpath.without.build.classes.dir}"/>
7.482 + <chainedmapper>
7.483 + <flattenmapper/>
7.484 + <globmapper from="*" to="lib/*"/>
7.485 + </chainedmapper>
7.486 + </pathconvert>
7.487 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
7.488 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
7.489 + <fileset dir="${build.classes.dir}"/>
7.490 + <manifest>
7.491 + <attribute name="Main-Class" value="${main.class}"/>
7.492 + <attribute name="Class-Path" value="${jar.classpath}"/>
7.493 + </manifest>
7.494 + </copylibs>
7.495 + <echo>To run this application from the command line without Ant, try:</echo>
7.496 + <property location="${dist.jar}" name="dist.jar.resolved"/>
7.497 + <echo>java -jar "${dist.jar.resolved}"</echo>
7.498 + </target>
7.499 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
7.500 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
7.501 + <pathconvert property="run.classpath.without.build.classes.dir">
7.502 + <path path="${run.classpath}"/>
7.503 + <map from="${build.classes.dir.resolved}" to=""/>
7.504 + </pathconvert>
7.505 + <pathconvert pathsep=" " property="jar.classpath">
7.506 + <path path="${run.classpath.without.build.classes.dir}"/>
7.507 + <chainedmapper>
7.508 + <flattenmapper/>
7.509 + <globmapper from="*" to="lib/*"/>
7.510 + </chainedmapper>
7.511 + </pathconvert>
7.512 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
7.513 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
7.514 + <fileset dir="${build.classes.dir}"/>
7.515 + <manifest>
7.516 + <attribute name="Class-Path" value="${jar.classpath}"/>
7.517 + </manifest>
7.518 + </copylibs>
7.519 + </target>
7.520 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
7.521 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
7.522 + <pathconvert property="run.classpath.without.build.classes.dir">
7.523 + <path path="${run.classpath}"/>
7.524 + <map from="${build.classes.dir.resolved}" to=""/>
7.525 + </pathconvert>
7.526 + <pathconvert pathsep=" " property="jar.classpath">
7.527 + <path path="${run.classpath.without.build.classes.dir}"/>
7.528 + <chainedmapper>
7.529 + <flattenmapper/>
7.530 + <globmapper from="*" to="lib/*"/>
7.531 + </chainedmapper>
7.532 + </pathconvert>
7.533 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
7.534 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
7.535 + <fileset dir="${build.classes.dir}"/>
7.536 + <manifest>
7.537 + <attribute name="Class-Path" value="${jar.classpath}"/>
7.538 + </manifest>
7.539 + </copylibs>
7.540 + </target>
7.541 + <target name="-post-jar">
7.542 + <!-- Empty placeholder for easier customization. -->
7.543 + <!-- You can override this target in the ../build.xml file. -->
7.544 + </target>
7.545 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
7.546 + <!--
7.547 + =================
7.548 + EXECUTION SECTION
7.549 + =================
7.550 + -->
7.551 + <target depends="init,compile" description="Run a main class." name="run">
7.552 + <j2seproject1:java>
7.553 + <customize>
7.554 + <arg line="${application.args}"/>
7.555 + </customize>
7.556 + </j2seproject1:java>
7.557 + </target>
7.558 + <target name="-do-not-recompile">
7.559 + <property name="javac.includes.binary" value=""/>
7.560 + </target>
7.561 + <target depends="init,compile-single" name="run-single">
7.562 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
7.563 + <j2seproject1:java classname="${run.class}"/>
7.564 + </target>
7.565 + <target depends="init,compile-test-single" name="run-test-with-main">
7.566 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
7.567 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
7.568 + </target>
7.569 + <!--
7.570 + =================
7.571 + DEBUGGING SECTION
7.572 + =================
7.573 + -->
7.574 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
7.575 + <j2seproject1:nbjpdastart name="${debug.class}"/>
7.576 + </target>
7.577 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
7.578 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
7.579 + </target>
7.580 + <target depends="init,compile" name="-debug-start-debuggee">
7.581 + <j2seproject3:debug>
7.582 + <customize>
7.583 + <arg line="${application.args}"/>
7.584 + </customize>
7.585 + </j2seproject3:debug>
7.586 + </target>
7.587 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
7.588 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
7.589 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
7.590 + </target>
7.591 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
7.592 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
7.593 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
7.594 + <j2seproject3:debug classname="${debug.class}"/>
7.595 + </target>
7.596 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
7.597 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
7.598 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
7.599 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
7.600 + </target>
7.601 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
7.602 + <target depends="init" name="-pre-debug-fix">
7.603 + <fail unless="fix.includes">Must set fix.includes</fail>
7.604 + <property name="javac.includes" value="${fix.includes}.java"/>
7.605 + </target>
7.606 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
7.607 + <j2seproject1:nbjpdareload/>
7.608 + </target>
7.609 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
7.610 + <!--
7.611 + ===============
7.612 + JAVADOC SECTION
7.613 + ===============
7.614 + -->
7.615 + <target depends="init" name="-javadoc-build">
7.616 + <mkdir dir="${dist.javadoc.dir}"/>
7.617 + <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
7.618 + <classpath>
7.619 + <path path="${javac.classpath}"/>
7.620 + </classpath>
7.621 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
7.622 + <filename name="**/*.java"/>
7.623 + </fileset>
7.624 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
7.625 + <include name="**/*.java"/>
7.626 + </fileset>
7.627 + </javadoc>
7.628 + </target>
7.629 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
7.630 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
7.631 + </target>
7.632 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
7.633 + <!--
7.634 + =========================
7.635 + JUNIT COMPILATION SECTION
7.636 + =========================
7.637 + -->
7.638 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
7.639 + <mkdir dir="${build.test.classes.dir}"/>
7.640 + </target>
7.641 + <target name="-pre-compile-test">
7.642 + <!-- Empty placeholder for easier customization. -->
7.643 + <!-- You can override this target in the ../build.xml file. -->
7.644 + </target>
7.645 + <target if="do.depend.true" name="-compile-test-depend">
7.646 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
7.647 + </target>
7.648 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
7.649 + <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
7.650 + <copy todir="${build.test.classes.dir}">
7.651 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
7.652 + </copy>
7.653 + </target>
7.654 + <target name="-post-compile-test">
7.655 + <!-- Empty placeholder for easier customization. -->
7.656 + <!-- You can override this target in the ../build.xml file. -->
7.657 + </target>
7.658 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
7.659 + <target name="-pre-compile-test-single">
7.660 + <!-- Empty placeholder for easier customization. -->
7.661 + <!-- You can override this target in the ../build.xml file. -->
7.662 + </target>
7.663 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
7.664 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
7.665 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
7.666 + <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
7.667 + <copy todir="${build.test.classes.dir}">
7.668 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
7.669 + </copy>
7.670 + </target>
7.671 + <target name="-post-compile-test-single">
7.672 + <!-- Empty placeholder for easier customization. -->
7.673 + <!-- You can override this target in the ../build.xml file. -->
7.674 + </target>
7.675 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
7.676 + <!--
7.677 + =======================
7.678 + JUNIT EXECUTION SECTION
7.679 + =======================
7.680 + -->
7.681 + <target depends="init" if="have.tests" name="-pre-test-run">
7.682 + <mkdir dir="${build.test.results.dir}"/>
7.683 + </target>
7.684 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
7.685 + <j2seproject3:junit testincludes="**/*Test.java"/>
7.686 + </target>
7.687 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
7.688 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
7.689 + </target>
7.690 + <target depends="init" if="have.tests" name="test-report"/>
7.691 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
7.692 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
7.693 + <target depends="init" if="have.tests" name="-pre-test-run-single">
7.694 + <mkdir dir="${build.test.results.dir}"/>
7.695 + </target>
7.696 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
7.697 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
7.698 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
7.699 + </target>
7.700 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
7.701 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
7.702 + </target>
7.703 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
7.704 + <!--
7.705 + =======================
7.706 + JUNIT DEBUGGING SECTION
7.707 + =======================
7.708 + -->
7.709 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
7.710 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
7.711 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
7.712 + <delete file="${test.report.file}"/>
7.713 + <mkdir dir="${build.test.results.dir}"/>
7.714 + <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
7.715 + <customize>
7.716 + <syspropertyset>
7.717 + <propertyref prefix="test-sys-prop."/>
7.718 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.719 + </syspropertyset>
7.720 + <arg value="${test.class}"/>
7.721 + <arg value="showoutput=true"/>
7.722 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
7.723 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
7.724 + </customize>
7.725 + </j2seproject3:debug>
7.726 + </target>
7.727 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
7.728 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
7.729 + </target>
7.730 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
7.731 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
7.732 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
7.733 + </target>
7.734 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
7.735 + <!--
7.736 + =========================
7.737 + APPLET EXECUTION SECTION
7.738 + =========================
7.739 + -->
7.740 + <target depends="init,compile-single" name="run-applet">
7.741 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
7.742 + <j2seproject1:java classname="sun.applet.AppletViewer">
7.743 + <customize>
7.744 + <arg value="${applet.url}"/>
7.745 + </customize>
7.746 + </j2seproject1:java>
7.747 + </target>
7.748 + <!--
7.749 + =========================
7.750 + APPLET DEBUGGING SECTION
7.751 + =========================
7.752 + -->
7.753 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
7.754 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
7.755 + <j2seproject3:debug classname="sun.applet.AppletViewer">
7.756 + <customize>
7.757 + <arg value="${applet.url}"/>
7.758 + </customize>
7.759 + </j2seproject3:debug>
7.760 + </target>
7.761 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
7.762 + <!--
7.763 + ===============
7.764 + CLEANUP SECTION
7.765 + ===============
7.766 + -->
7.767 + <target name="-deps-clean-init" unless="built-clean.properties">
7.768 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
7.769 + <delete file="${built-clean.properties}" quiet="true"/>
7.770 + </target>
7.771 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
7.772 + <echo level="warn" message="Cycle detected: singletons was already built"/>
7.773 + </target>
7.774 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
7.775 + <mkdir dir="${build.dir}"/>
7.776 + <touch file="${built-clean.properties}" verbose="false"/>
7.777 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
7.778 + <antcall target="-warn-already-built-clean"/>
7.779 + <propertyfile file="${built-clean.properties}">
7.780 + <entry key="${basedir}" value=""/>
7.781 + </propertyfile>
7.782 + </target>
7.783 + <target depends="init" name="-do-clean">
7.784 + <delete dir="${build.dir}"/>
7.785 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
7.786 + </target>
7.787 + <target name="-post-clean">
7.788 + <!-- Empty placeholder for easier customization. -->
7.789 + <!-- You can override this target in the ../build.xml file. -->
7.790 + </target>
7.791 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
7.792 + <target name="-check-call-dep">
7.793 + <property file="${call.built.properties}" prefix="already.built."/>
7.794 + <condition property="should.call.dep">
7.795 + <not>
7.796 + <isset property="already.built.${call.subproject}"/>
7.797 + </not>
7.798 + </condition>
7.799 + </target>
7.800 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
7.801 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
7.802 + <propertyset>
7.803 + <propertyref prefix="transfer."/>
7.804 + <mapper from="transfer.*" to="*" type="glob"/>
7.805 + </propertyset>
7.806 + </ant>
7.807 + </target>
7.808 +</project>
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/samples/singletons/nbproject/genfiles.properties Wed Jan 27 18:30:57 2010 +0100
8.3 @@ -0,0 +1,8 @@
8.4 +build.xml.data.CRC32=5a9b3034
8.5 +build.xml.script.CRC32=28fad8e6
8.6 +build.xml.stylesheet.CRC32=958a1d3e@1.34.0.45
8.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
8.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
8.9 +nbproject/build-impl.xml.data.CRC32=5a9b3034
8.10 +nbproject/build-impl.xml.script.CRC32=a0976efa
8.11 +nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.34.0.45
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/samples/singletons/nbproject/project.properties Wed Jan 27 18:30:57 2010 +0100
9.3 @@ -0,0 +1,66 @@
9.4 +build.classes.dir=${build.dir}/classes
9.5 +build.classes.excludes=**/*.java,**/*.form
9.6 +# This directory is removed when the project is cleaned:
9.7 +build.dir=build
9.8 +build.generated.dir=${build.dir}/generated
9.9 +build.generated.sources.dir=${build.dir}/generated-sources
9.10 +# Only compile against the classpath explicitly listed here:
9.11 +build.sysclasspath=ignore
9.12 +build.test.classes.dir=${build.dir}/test/classes
9.13 +build.test.results.dir=${build.dir}/test/results
9.14 +# Uncomment to specify the preferred debugger connection transport:
9.15 +#debug.transport=dt_socket
9.16 +debug.classpath=\
9.17 + ${run.classpath}
9.18 +debug.test.classpath=\
9.19 + ${run.test.classpath}
9.20 +# This directory is removed when the project is cleaned:
9.21 +dist.dir=dist
9.22 +dist.jar=${dist.dir}/singletons.jar
9.23 +dist.javadoc.dir=${dist.dir}/javadoc
9.24 +excludes=
9.25 +file.reference.org-netbeans-insane.jar=../libs/dist/org-netbeans-insane.jar
9.26 +file.reference.org-netbeans-modules-nbjunit.jar=../libs/dist/org-netbeans-modules-nbjunit.jar
9.27 +file.reference.org-openide-util-lookup.jar=../libs/dist/org-openide-util-lookup.jar
9.28 +includes=**
9.29 +jar.compress=false
9.30 +javac.classpath=\
9.31 + ${file.reference.org-openide-util-lookup.jar}
9.32 +# Space-separated list of extra javac options
9.33 +javac.compilerargs=
9.34 +javac.deprecation=false
9.35 +javac.source=1.5
9.36 +javac.target=1.5
9.37 +javac.test.classpath=\
9.38 + ${javac.classpath}:\
9.39 + ${build.classes.dir}:\
9.40 + ${libs.junit_4.classpath}:\
9.41 + ${file.reference.org-netbeans-insane.jar}:\
9.42 + ${file.reference.org-netbeans-modules-nbjunit.jar}
9.43 +javadoc.additionalparam=
9.44 +javadoc.author=false
9.45 +javadoc.encoding=${source.encoding}
9.46 +javadoc.noindex=false
9.47 +javadoc.nonavbar=false
9.48 +javadoc.notree=false
9.49 +javadoc.private=false
9.50 +javadoc.splitindex=true
9.51 +javadoc.use=true
9.52 +javadoc.version=false
9.53 +javadoc.windowtitle=
9.54 +main.class=org.apidesign.singletons.usage.Main
9.55 +meta.inf.dir=${src.dir}/META-INF
9.56 +platform.active=default_platform
9.57 +run.classpath=\
9.58 + ${javac.classpath}:\
9.59 + ${build.classes.dir}
9.60 +# Space-separated list of JVM arguments used when running the project
9.61 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
9.62 +# or test-sys-prop.name=value to set system properties for unit tests):
9.63 +run.jvmargs=
9.64 +run.test.classpath=\
9.65 + ${javac.test.classpath}:\
9.66 + ${build.test.classes.dir}
9.67 +source.encoding=UTF-8
9.68 +src.dir=src
9.69 +test.src.dir=test
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/samples/singletons/nbproject/project.xml Wed Jan 27 18:30:57 2010 +0100
10.3 @@ -0,0 +1,15 @@
10.4 +<?xml version="1.0" encoding="UTF-8"?>
10.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
10.6 + <type>org.netbeans.modules.java.j2seproject</type>
10.7 + <configuration>
10.8 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
10.9 + <name>singletons</name>
10.10 + <source-roots>
10.11 + <root id="src.dir"/>
10.12 + </source-roots>
10.13 + <test-roots>
10.14 + <root id="test.src.dir"/>
10.15 + </test-roots>
10.16 + </data>
10.17 + </configuration>
10.18 +</project>
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/samples/singletons/src/org/apidesign/singletons/api/DialogDisplayer.java Wed Jan 27 18:30:57 2010 +0100
11.3 @@ -0,0 +1,60 @@
11.4 +package org.apidesign.singletons.api;
11.5 +
11.6 +import java.util.Iterator;
11.7 +import java.util.ServiceLoader;
11.8 +import org.openide.util.Lookup;
11.9 +
11.10 +// BEGIN: singletons.injectable.api
11.11 +public abstract class DialogDisplayer {
11.12 + protected DialogDisplayer() {
11.13 + }
11.14 +
11.15 + /** Ask user a question.
11.16 + *
11.17 + * @param query the text of the question
11.18 + * @return true if user confirmed or false if declined
11.19 + */
11.20 + public abstract boolean yesOrNo(String query);
11.21 +
11.22 + public static DialogDisplayer getDefault() {
11.23 + return Impl.DEFAULT;
11.24 + }
11.25 + // FINISH: singletons.injectable.api
11.26 +
11.27 +
11.28 + // BEGIN: singletons.injectable.dummyimpl
11.29 + private static final class Impl extends DialogDisplayer {
11.30 + private static final DialogDisplayer DEFAULT = initialize();
11.31 +
11.32 + @Override
11.33 + public boolean yesOrNo(String query) {
11.34 + System.err.printf("Saying no to '%s'\n", query);
11.35 + return false;
11.36 + }
11.37 + // FINISH: singletons.injectable.dummyimpl
11.38 +
11.39 + private static DialogDisplayer initialize() {
11.40 + if (Boolean.getBoolean("singleton.jdk6")) {
11.41 + return initializeServiceLoader();
11.42 + } else {
11.43 + return initializeLookup();
11.44 + }
11.45 + }
11.46 +
11.47 + // BEGIN: singletons.injectable.serviceloader
11.48 + private static DialogDisplayer initializeServiceLoader() {
11.49 + // see http://singletons.apidesign.org
11.50 + Iterator<DialogDisplayer> it = null;
11.51 + it = ServiceLoader.load(DialogDisplayer.class).iterator();
11.52 + return it != null && it.hasNext() ? it.next() : new Impl();
11.53 + }
11.54 + // END: singletons.injectable.serviceloader
11.55 +
11.56 + // BEGIN: singletons.injectable.lookup
11.57 + private static DialogDisplayer initializeLookup() {
11.58 + DialogDisplayer def = Lookup.getDefault().lookup(DialogDisplayer.class);
11.59 + return def != null ? def : new Impl();
11.60 + }
11.61 + // END: singletons.injectable.lookup
11.62 + }
11.63 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/samples/singletons/src/org/apidesign/singletons/impl/DefaultDialogDisplayer.java Wed Jan 27 18:30:57 2010 +0100
12.3 @@ -0,0 +1,14 @@
12.4 +package org.apidesign.singletons.impl;
12.5 +
12.6 +import javax.swing.JOptionPane;
12.7 +import org.apidesign.singletons.api.DialogDisplayer;
12.8 +import org.openide.util.lookup.ServiceProvider;
12.9 +
12.10 +@ServiceProvider(service=DialogDisplayer.class)
12.11 +public final class DefaultDialogDisplayer extends DialogDisplayer {
12.12 + @Override
12.13 + public boolean yesOrNo(String query) {
12.14 + final int res = JOptionPane.showConfirmDialog(null, query);
12.15 + return res == JOptionPane.OK_OPTION;
12.16 + }
12.17 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/samples/singletons/src/org/apidesign/singletons/usage/Main.java Wed Jan 27 18:30:57 2010 +0100
13.3 @@ -0,0 +1,15 @@
13.4 +package org.apidesign.singletons.usage;
13.5 +
13.6 +import org.apidesign.singletons.api.DialogDisplayer;
13.7 +
13.8 +public class Main {
13.9 + public static void main(String[] args) {
13.10 + if (DialogDisplayer.getDefault().yesOrNo("Do you like singletons?")) {
13.11 + System.err.println("OK, thank you!");
13.12 + } else {
13.13 + System.err.println(
13.14 + "Visit http://singletons.apidesign.org to change your mind!"
13.15 + );
13.16 + }
13.17 + }
13.18 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/samples/singletons/test/org/apidesign/singletons/usage/MainTest.java Wed Jan 27 18:30:57 2010 +0100
14.3 @@ -0,0 +1,37 @@
14.4 +package org.apidesign.singletons.usage;
14.5 +
14.6 +import org.apidesign.singletons.api.DialogDisplayer;
14.7 +import org.junit.AfterClass;
14.8 +import org.junit.BeforeClass;
14.9 +import org.junit.Test;
14.10 +import org.netbeans.junit.MockServices;
14.11 +import static org.junit.Assert.*;
14.12 +
14.13 +public class MainTest {
14.14 +
14.15 + public MainTest() {
14.16 + }
14.17 +
14.18 + @BeforeClass
14.19 + public static void setUpClass() throws Exception {
14.20 + MockServices.setServices(MockDialogDisplayer.class);
14.21 + }
14.22 +
14.23 + @Test
14.24 + public void testMainAsksAQuestion() {
14.25 + assertNull("No question asked yet", MockDialogDisplayer.askedQuery);
14.26 + Main.main(new String[0]);
14.27 + assertNotNull("main code asked our Mock displayer", MockDialogDisplayer.askedQuery);
14.28 + }
14.29 +
14.30 + public static final class MockDialogDisplayer extends DialogDisplayer {
14.31 + static String askedQuery;
14.32 +
14.33 + @Override
14.34 + public boolean yesOrNo(String query) {
14.35 + askedQuery = query;
14.36 + return false;
14.37 + }
14.38 +
14.39 + }
14.40 +}
14.41 \ No newline at end of file