1.1 --- a/other/signatures/build.xml Thu Jul 21 11:16:26 2011 -0400
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,74 +0,0 @@
1.4 -<?xml version="1.0" encoding="UTF-8"?>
1.5 -<!-- You may freely edit this file. See commented blocks below for -->
1.6 -<!-- some examples of how to customize the build. -->
1.7 -<!-- (If you delete it and reopen the project it will be recreated.) -->
1.8 -<!-- By default, only the Clean and Build commands use this build script. -->
1.9 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
1.10 -<!-- the Compile on Save feature is turned off for the project. -->
1.11 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
1.12 -<!-- in the project's Project Properties dialog box.-->
1.13 -<project name="signatures" default="default" basedir=".">
1.14 - <description>Builds, tests, and runs the project signatures.</description>
1.15 - <import file="nbproject/build-impl.xml"/>
1.16 - <!--
1.17 -
1.18 - There exist several targets which are by default empty and which can be
1.19 - used for execution of your tasks. These targets are usually executed
1.20 - before and after some main targets. They are:
1.21 -
1.22 - -pre-init: called before initialization of project properties
1.23 - -post-init: called after initialization of project properties
1.24 - -pre-compile: called before javac compilation
1.25 - -post-compile: called after javac compilation
1.26 - -pre-compile-single: called before javac compilation of single file
1.27 - -post-compile-single: called after javac compilation of single file
1.28 - -pre-compile-test: called before javac compilation of JUnit tests
1.29 - -post-compile-test: called after javac compilation of JUnit tests
1.30 - -pre-compile-test-single: called before javac compilation of single JUnit test
1.31 - -post-compile-test-single: called after javac compilation of single JUunit test
1.32 - -pre-jar: called before JAR building
1.33 - -post-jar: called after JAR building
1.34 - -post-clean: called after cleaning build products
1.35 -
1.36 - (Targets beginning with '-' are not intended to be called on their own.)
1.37 -
1.38 - Example of inserting an obfuscator after compilation could look like this:
1.39 -
1.40 - <target name="-post-compile">
1.41 - <obfuscate>
1.42 - <fileset dir="${build.classes.dir}"/>
1.43 - </obfuscate>
1.44 - </target>
1.45 -
1.46 - For list of available properties check the imported
1.47 - nbproject/build-impl.xml file.
1.48 -
1.49 -
1.50 - Another way to customize the build is by overriding existing main targets.
1.51 - The targets of interest are:
1.52 -
1.53 - -init-macrodef-javac: defines macro for javac compilation
1.54 - -init-macrodef-junit: defines macro for junit execution
1.55 - -init-macrodef-debug: defines macro for class debugging
1.56 - -init-macrodef-java: defines macro for class execution
1.57 - -do-jar-with-manifest: JAR building (if you are using a manifest)
1.58 - -do-jar-without-manifest: JAR building (if you are not using a manifest)
1.59 - run: execution of project
1.60 - -javadoc-build: Javadoc generation
1.61 - test-report: JUnit report generation
1.62 -
1.63 - An example of overriding the target for project execution could look like this:
1.64 -
1.65 - <target name="run" depends="signatures-impl.jar">
1.66 - <exec dir="bin" executable="launcher.exe">
1.67 - <arg file="${dist.jar}"/>
1.68 - </exec>
1.69 - </target>
1.70 -
1.71 - Notice that the overridden target depends on the jar target and not only on
1.72 - the compile target as the regular run target does. Again, for a list of available
1.73 - properties which you can use, check the target you are overriding in the
1.74 - nbproject/build-impl.xml file.
1.75 -
1.76 - -->
1.77 -</project>
2.1 --- a/other/signatures/nbproject/build-impl.xml Thu Jul 21 11:16:26 2011 -0400
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,1043 +0,0 @@
2.4 -<?xml version="1.0" encoding="UTF-8"?>
2.5 -<!--
2.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
2.7 -*** EDIT ../build.xml INSTEAD ***
2.8 -
2.9 -For the purpose of easier reading the script
2.10 -is divided into following sections:
2.11 -
2.12 - - initialization
2.13 - - compilation
2.14 - - jar
2.15 - - execution
2.16 - - debugging
2.17 - - javadoc
2.18 - - junit compilation
2.19 - - junit execution
2.20 - - junit debugging
2.21 - - applet
2.22 - - cleanup
2.23 -
2.24 - -->
2.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="signatures-impl">
2.26 - <fail message="Please build using Ant 1.8.0 or higher.">
2.27 - <condition>
2.28 - <not>
2.29 - <antversion atleast="1.8.0"/>
2.30 - </not>
2.31 - </condition>
2.32 - </fail>
2.33 - <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
2.34 - <!--
2.35 - ======================
2.36 - INITIALIZATION SECTION
2.37 - ======================
2.38 - -->
2.39 - <target name="-pre-init">
2.40 - <!-- Empty placeholder for easier customization. -->
2.41 - <!-- You can override this target in the ../build.xml file. -->
2.42 - </target>
2.43 - <target depends="-pre-init" name="-init-private">
2.44 - <property file="nbproject/private/config.properties"/>
2.45 - <property file="nbproject/private/configs/${config}.properties"/>
2.46 - <property file="nbproject/private/private.properties"/>
2.47 - </target>
2.48 - <target depends="-pre-init,-init-private" name="-init-user">
2.49 - <property file="${user.properties.file}"/>
2.50 - <!-- The two properties below are usually overridden -->
2.51 - <!-- by the active platform. Just a fallback. -->
2.52 - <property name="default.javac.source" value="1.4"/>
2.53 - <property name="default.javac.target" value="1.4"/>
2.54 - </target>
2.55 - <target depends="-pre-init,-init-private,-init-user" name="-init-project">
2.56 - <property file="nbproject/configs/${config}.properties"/>
2.57 - <property file="nbproject/project.properties"/>
2.58 - </target>
2.59 - <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
2.60 - <available file="${manifest.file}" property="manifest.available"/>
2.61 - <condition property="splashscreen.available">
2.62 - <and>
2.63 - <not>
2.64 - <equals arg1="${application.splash}" arg2="" trim="true"/>
2.65 - </not>
2.66 - <available file="${application.splash}"/>
2.67 - </and>
2.68 - </condition>
2.69 - <condition property="main.class.available">
2.70 - <and>
2.71 - <isset property="main.class"/>
2.72 - <not>
2.73 - <equals arg1="${main.class}" arg2="" trim="true"/>
2.74 - </not>
2.75 - </and>
2.76 - </condition>
2.77 - <condition property="manifest.available+main.class">
2.78 - <and>
2.79 - <isset property="manifest.available"/>
2.80 - <isset property="main.class.available"/>
2.81 - </and>
2.82 - </condition>
2.83 - <condition property="do.archive">
2.84 - <not>
2.85 - <istrue value="${jar.archive.disabled}"/>
2.86 - </not>
2.87 - </condition>
2.88 - <condition property="do.mkdist">
2.89 - <and>
2.90 - <isset property="do.archive"/>
2.91 - <isset property="libs.CopyLibs.classpath"/>
2.92 - <not>
2.93 - <istrue value="${mkdist.disabled}"/>
2.94 - </not>
2.95 - </and>
2.96 - </condition>
2.97 - <condition property="manifest.available+main.class+mkdist.available">
2.98 - <and>
2.99 - <istrue value="${manifest.available+main.class}"/>
2.100 - <isset property="do.mkdist"/>
2.101 - </and>
2.102 - </condition>
2.103 - <condition property="do.archive+manifest.available">
2.104 - <and>
2.105 - <isset property="manifest.available"/>
2.106 - <istrue value="${do.archive}"/>
2.107 - </and>
2.108 - </condition>
2.109 - <condition property="do.archive+main.class.available">
2.110 - <and>
2.111 - <isset property="main.class.available"/>
2.112 - <istrue value="${do.archive}"/>
2.113 - </and>
2.114 - </condition>
2.115 - <condition property="do.archive+splashscreen.available">
2.116 - <and>
2.117 - <isset property="splashscreen.available"/>
2.118 - <istrue value="${do.archive}"/>
2.119 - </and>
2.120 - </condition>
2.121 - <condition property="do.archive+manifest.available+main.class">
2.122 - <and>
2.123 - <istrue value="${manifest.available+main.class}"/>
2.124 - <istrue value="${do.archive}"/>
2.125 - </and>
2.126 - </condition>
2.127 - <condition property="manifest.available-mkdist.available">
2.128 - <or>
2.129 - <istrue value="${manifest.available}"/>
2.130 - <isset property="do.mkdist"/>
2.131 - </or>
2.132 - </condition>
2.133 - <condition property="manifest.available+main.class-mkdist.available">
2.134 - <or>
2.135 - <istrue value="${manifest.available+main.class}"/>
2.136 - <isset property="do.mkdist"/>
2.137 - </or>
2.138 - </condition>
2.139 - <condition property="have.tests">
2.140 - <or>
2.141 - <available file="${test.src.dir}"/>
2.142 - </or>
2.143 - </condition>
2.144 - <condition property="have.sources">
2.145 - <or>
2.146 - <available file="${src.dir}"/>
2.147 - </or>
2.148 - </condition>
2.149 - <condition property="netbeans.home+have.tests">
2.150 - <and>
2.151 - <isset property="netbeans.home"/>
2.152 - <isset property="have.tests"/>
2.153 - </and>
2.154 - </condition>
2.155 - <condition property="no.javadoc.preview">
2.156 - <and>
2.157 - <isset property="javadoc.preview"/>
2.158 - <isfalse value="${javadoc.preview}"/>
2.159 - </and>
2.160 - </condition>
2.161 - <property name="run.jvmargs" value=""/>
2.162 - <property name="javac.compilerargs" value=""/>
2.163 - <property name="work.dir" value="${basedir}"/>
2.164 - <condition property="no.deps">
2.165 - <and>
2.166 - <istrue value="${no.dependencies}"/>
2.167 - </and>
2.168 - </condition>
2.169 - <property name="javac.debug" value="true"/>
2.170 - <property name="javadoc.preview" value="true"/>
2.171 - <property name="application.args" value=""/>
2.172 - <property name="source.encoding" value="${file.encoding}"/>
2.173 - <property name="runtime.encoding" value="${source.encoding}"/>
2.174 - <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
2.175 - <and>
2.176 - <isset property="javadoc.encoding"/>
2.177 - <not>
2.178 - <equals arg1="${javadoc.encoding}" arg2=""/>
2.179 - </not>
2.180 - </and>
2.181 - </condition>
2.182 - <property name="javadoc.encoding.used" value="${source.encoding}"/>
2.183 - <property name="includes" value="**"/>
2.184 - <property name="excludes" value=""/>
2.185 - <property name="do.depend" value="false"/>
2.186 - <condition property="do.depend.true">
2.187 - <istrue value="${do.depend}"/>
2.188 - </condition>
2.189 - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
2.190 - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
2.191 - <length length="0" string="${endorsed.classpath}" when="greater"/>
2.192 - </condition>
2.193 - <condition else="false" property="jdkBug6558476">
2.194 - <and>
2.195 - <matches pattern="1\.[56]" string="${java.specification.version}"/>
2.196 - <not>
2.197 - <os family="unix"/>
2.198 - </not>
2.199 - </and>
2.200 - </condition>
2.201 - <property name="javac.fork" value="${jdkBug6558476}"/>
2.202 - <property name="jar.index" value="false"/>
2.203 - <property name="jar.index.metainf" value="${jar.index}"/>
2.204 - <property name="copylibs.rebase" value="true"/>
2.205 - <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
2.206 - </target>
2.207 - <target name="-post-init">
2.208 - <!-- Empty placeholder for easier customization. -->
2.209 - <!-- You can override this target in the ../build.xml file. -->
2.210 - </target>
2.211 - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
2.212 - <fail unless="src.dir">Must set src.dir</fail>
2.213 - <fail unless="test.src.dir">Must set test.src.dir</fail>
2.214 - <fail unless="build.dir">Must set build.dir</fail>
2.215 - <fail unless="dist.dir">Must set dist.dir</fail>
2.216 - <fail unless="build.classes.dir">Must set build.classes.dir</fail>
2.217 - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
2.218 - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
2.219 - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
2.220 - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
2.221 - <fail unless="dist.jar">Must set dist.jar</fail>
2.222 - </target>
2.223 - <target name="-init-macrodef-property">
2.224 - <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
2.225 - <attribute name="name"/>
2.226 - <attribute name="value"/>
2.227 - <sequential>
2.228 - <property name="@{name}" value="${@{value}}"/>
2.229 - </sequential>
2.230 - </macrodef>
2.231 - </target>
2.232 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
2.233 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
2.234 - <attribute default="${src.dir}" name="srcdir"/>
2.235 - <attribute default="${build.classes.dir}" name="destdir"/>
2.236 - <attribute default="${javac.classpath}" name="classpath"/>
2.237 - <attribute default="${javac.processorpath}" name="processorpath"/>
2.238 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
2.239 - <attribute default="${includes}" name="includes"/>
2.240 - <attribute default="${excludes}" name="excludes"/>
2.241 - <attribute default="${javac.debug}" name="debug"/>
2.242 - <attribute default="${empty.dir}" name="sourcepath"/>
2.243 - <attribute default="${empty.dir}" name="gensrcdir"/>
2.244 - <element name="customize" optional="true"/>
2.245 - <sequential>
2.246 - <property location="${build.dir}/empty" name="empty.dir"/>
2.247 - <mkdir dir="${empty.dir}"/>
2.248 - <mkdir dir="@{apgeneratedsrcdir}"/>
2.249 - <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}">
2.250 - <src>
2.251 - <dirset dir="@{gensrcdir}" erroronmissingdir="false">
2.252 - <include name="*"/>
2.253 - </dirset>
2.254 - </src>
2.255 - <classpath>
2.256 - <path path="@{classpath}"/>
2.257 - </classpath>
2.258 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
2.259 - <compilerarg line="${javac.compilerargs}"/>
2.260 - <compilerarg value="-processorpath"/>
2.261 - <compilerarg path="@{processorpath}:${empty.dir}"/>
2.262 - <compilerarg line="${ap.processors.internal}"/>
2.263 - <compilerarg line="${annotation.processing.processor.options}"/>
2.264 - <compilerarg value="-s"/>
2.265 - <compilerarg path="@{apgeneratedsrcdir}"/>
2.266 - <compilerarg line="${ap.proc.none.internal}"/>
2.267 - <customize/>
2.268 - </javac>
2.269 - </sequential>
2.270 - </macrodef>
2.271 - </target>
2.272 - <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
2.273 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
2.274 - <attribute default="${src.dir}" name="srcdir"/>
2.275 - <attribute default="${build.classes.dir}" name="destdir"/>
2.276 - <attribute default="${javac.classpath}" name="classpath"/>
2.277 - <attribute default="${javac.processorpath}" name="processorpath"/>
2.278 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
2.279 - <attribute default="${includes}" name="includes"/>
2.280 - <attribute default="${excludes}" name="excludes"/>
2.281 - <attribute default="${javac.debug}" name="debug"/>
2.282 - <attribute default="${empty.dir}" name="sourcepath"/>
2.283 - <attribute default="${empty.dir}" name="gensrcdir"/>
2.284 - <element name="customize" optional="true"/>
2.285 - <sequential>
2.286 - <property location="${build.dir}/empty" name="empty.dir"/>
2.287 - <mkdir dir="${empty.dir}"/>
2.288 - <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}">
2.289 - <src>
2.290 - <dirset dir="@{gensrcdir}" erroronmissingdir="false">
2.291 - <include name="*"/>
2.292 - </dirset>
2.293 - </src>
2.294 - <classpath>
2.295 - <path path="@{classpath}"/>
2.296 - </classpath>
2.297 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
2.298 - <compilerarg line="${javac.compilerargs}"/>
2.299 - <customize/>
2.300 - </javac>
2.301 - </sequential>
2.302 - </macrodef>
2.303 - </target>
2.304 - <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
2.305 - <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
2.306 - <attribute default="${src.dir}" name="srcdir"/>
2.307 - <attribute default="${build.classes.dir}" name="destdir"/>
2.308 - <attribute default="${javac.classpath}" name="classpath"/>
2.309 - <sequential>
2.310 - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
2.311 - <classpath>
2.312 - <path path="@{classpath}"/>
2.313 - </classpath>
2.314 - </depend>
2.315 - </sequential>
2.316 - </macrodef>
2.317 - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
2.318 - <attribute default="${build.classes.dir}" name="destdir"/>
2.319 - <sequential>
2.320 - <fail unless="javac.includes">Must set javac.includes</fail>
2.321 - <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
2.322 - <path>
2.323 - <filelist dir="@{destdir}" files="${javac.includes}"/>
2.324 - </path>
2.325 - <globmapper from="*.java" to="*.class"/>
2.326 - </pathconvert>
2.327 - <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
2.328 - <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
2.329 - <delete>
2.330 - <files includesfile="${javac.includesfile.binary}"/>
2.331 - </delete>
2.332 - <delete>
2.333 - <fileset file="${javac.includesfile.binary}"/>
2.334 - </delete>
2.335 - </sequential>
2.336 - </macrodef>
2.337 - </target>
2.338 - <target name="-init-macrodef-junit">
2.339 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
2.340 - <attribute default="${includes}" name="includes"/>
2.341 - <attribute default="${excludes}" name="excludes"/>
2.342 - <attribute default="**" name="testincludes"/>
2.343 - <sequential>
2.344 - <property name="junit.forkmode" value="perTest"/>
2.345 - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
2.346 - <batchtest todir="${build.test.results.dir}">
2.347 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
2.348 - <filename name="@{testincludes}"/>
2.349 - </fileset>
2.350 - </batchtest>
2.351 - <classpath>
2.352 - <path path="${run.test.classpath}"/>
2.353 - </classpath>
2.354 - <syspropertyset>
2.355 - <propertyref prefix="test-sys-prop."/>
2.356 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
2.357 - </syspropertyset>
2.358 - <formatter type="brief" usefile="false"/>
2.359 - <formatter type="xml"/>
2.360 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
2.361 - <jvmarg value="-ea"/>
2.362 - <jvmarg line="${run.jvmargs}"/>
2.363 - </junit>
2.364 - </sequential>
2.365 - </macrodef>
2.366 - </target>
2.367 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
2.368 - <target name="-profile-pre-init">
2.369 - <!-- Empty placeholder for easier customization. -->
2.370 - <!-- You can override this target in the ../build.xml file. -->
2.371 - </target>
2.372 - <target name="-profile-post-init">
2.373 - <!-- Empty placeholder for easier customization. -->
2.374 - <!-- You can override this target in the ../build.xml file. -->
2.375 - </target>
2.376 - <target name="-profile-init-macrodef-profile">
2.377 - <macrodef name="resolve">
2.378 - <attribute name="name"/>
2.379 - <attribute name="value"/>
2.380 - <sequential>
2.381 - <property name="@{name}" value="${env.@{value}}"/>
2.382 - </sequential>
2.383 - </macrodef>
2.384 - <macrodef name="profile">
2.385 - <attribute default="${main.class}" name="classname"/>
2.386 - <element name="customize" optional="true"/>
2.387 - <sequential>
2.388 - <property environment="env"/>
2.389 - <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
2.390 - <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
2.391 - <jvmarg value="${profiler.info.jvmargs.agent}"/>
2.392 - <jvmarg line="${profiler.info.jvmargs}"/>
2.393 - <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
2.394 - <arg line="${application.args}"/>
2.395 - <classpath>
2.396 - <path path="${run.classpath}"/>
2.397 - </classpath>
2.398 - <syspropertyset>
2.399 - <propertyref prefix="run-sys-prop."/>
2.400 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
2.401 - </syspropertyset>
2.402 - <customize/>
2.403 - </java>
2.404 - </sequential>
2.405 - </macrodef>
2.406 - </target>
2.407 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
2.408 - <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
2.409 - <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
2.410 - </target>
2.411 - <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
2.412 - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
2.413 - <attribute default="${main.class}" name="name"/>
2.414 - <attribute default="${debug.classpath}" name="classpath"/>
2.415 - <attribute default="" name="stopclassname"/>
2.416 - <sequential>
2.417 - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
2.418 - <classpath>
2.419 - <path path="@{classpath}"/>
2.420 - </classpath>
2.421 - </nbjpdastart>
2.422 - </sequential>
2.423 - </macrodef>
2.424 - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
2.425 - <attribute default="${build.classes.dir}" name="dir"/>
2.426 - <sequential>
2.427 - <nbjpdareload>
2.428 - <fileset dir="@{dir}" includes="${fix.classes}">
2.429 - <include name="${fix.includes}*.class"/>
2.430 - </fileset>
2.431 - </nbjpdareload>
2.432 - </sequential>
2.433 - </macrodef>
2.434 - </target>
2.435 - <target name="-init-debug-args">
2.436 - <property name="version-output" value="java version "${ant.java.version}"/>
2.437 - <condition property="have-jdk-older-than-1.4">
2.438 - <or>
2.439 - <contains string="${version-output}" substring="java version "1.0"/>
2.440 - <contains string="${version-output}" substring="java version "1.1"/>
2.441 - <contains string="${version-output}" substring="java version "1.2"/>
2.442 - <contains string="${version-output}" substring="java version "1.3"/>
2.443 - </or>
2.444 - </condition>
2.445 - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
2.446 - <istrue value="${have-jdk-older-than-1.4}"/>
2.447 - </condition>
2.448 - <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
2.449 - <os family="windows"/>
2.450 - </condition>
2.451 - <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
2.452 - <isset property="debug.transport"/>
2.453 - </condition>
2.454 - </target>
2.455 - <target depends="-init-debug-args" name="-init-macrodef-debug">
2.456 - <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
2.457 - <attribute default="${main.class}" name="classname"/>
2.458 - <attribute default="${debug.classpath}" name="classpath"/>
2.459 - <element name="customize" optional="true"/>
2.460 - <sequential>
2.461 - <java classname="@{classname}" dir="${work.dir}" fork="true">
2.462 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
2.463 - <jvmarg line="${debug-args-line}"/>
2.464 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
2.465 - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
2.466 - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
2.467 - <jvmarg line="${run.jvmargs}"/>
2.468 - <classpath>
2.469 - <path path="@{classpath}"/>
2.470 - </classpath>
2.471 - <syspropertyset>
2.472 - <propertyref prefix="run-sys-prop."/>
2.473 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
2.474 - </syspropertyset>
2.475 - <customize/>
2.476 - </java>
2.477 - </sequential>
2.478 - </macrodef>
2.479 - </target>
2.480 - <target name="-init-macrodef-java">
2.481 - <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
2.482 - <attribute default="${main.class}" name="classname"/>
2.483 - <attribute default="${run.classpath}" name="classpath"/>
2.484 - <element name="customize" optional="true"/>
2.485 - <sequential>
2.486 - <java classname="@{classname}" dir="${work.dir}" fork="true">
2.487 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
2.488 - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
2.489 - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
2.490 - <jvmarg line="${run.jvmargs}"/>
2.491 - <classpath>
2.492 - <path path="@{classpath}"/>
2.493 - </classpath>
2.494 - <syspropertyset>
2.495 - <propertyref prefix="run-sys-prop."/>
2.496 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
2.497 - </syspropertyset>
2.498 - <customize/>
2.499 - </java>
2.500 - </sequential>
2.501 - </macrodef>
2.502 - </target>
2.503 - <target name="-init-macrodef-copylibs">
2.504 - <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
2.505 - <attribute default="${manifest.file}" name="manifest"/>
2.506 - <element name="customize" optional="true"/>
2.507 - <sequential>
2.508 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
2.509 - <pathconvert property="run.classpath.without.build.classes.dir">
2.510 - <path path="${run.classpath}"/>
2.511 - <map from="${build.classes.dir.resolved}" to=""/>
2.512 - </pathconvert>
2.513 - <pathconvert pathsep=" " property="jar.classpath">
2.514 - <path path="${run.classpath.without.build.classes.dir}"/>
2.515 - <chainedmapper>
2.516 - <flattenmapper/>
2.517 - <globmapper from="*" to="lib/*"/>
2.518 - </chainedmapper>
2.519 - </pathconvert>
2.520 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
2.521 - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
2.522 - <fileset dir="${build.classes.dir}"/>
2.523 - <manifest>
2.524 - <attribute name="Class-Path" value="${jar.classpath}"/>
2.525 - <customize/>
2.526 - </manifest>
2.527 - </copylibs>
2.528 - </sequential>
2.529 - </macrodef>
2.530 - </target>
2.531 - <target name="-init-presetdef-jar">
2.532 - <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
2.533 - <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
2.534 - <j2seproject1:fileset dir="${build.classes.dir}"/>
2.535 - </jar>
2.536 - </presetdef>
2.537 - </target>
2.538 - <target name="-init-ap-cmdline-properties">
2.539 - <property name="annotation.processing.enabled" value="true"/>
2.540 - <property name="annotation.processing.processors.list" value=""/>
2.541 - <property name="annotation.processing.processor.options" value=""/>
2.542 - <property name="annotation.processing.run.all.processors" value="true"/>
2.543 - <property name="javac.processorpath" value="${javac.classpath}"/>
2.544 - <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
2.545 - <condition property="ap.supported.internal" value="true">
2.546 - <not>
2.547 - <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
2.548 - </not>
2.549 - </condition>
2.550 - </target>
2.551 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
2.552 - <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
2.553 - <isfalse value="${annotation.processing.run.all.processors}"/>
2.554 - </condition>
2.555 - <condition else="" property="ap.proc.none.internal" value="-proc:none">
2.556 - <isfalse value="${annotation.processing.enabled}"/>
2.557 - </condition>
2.558 - </target>
2.559 - <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
2.560 - <property name="ap.cmd.line.internal" value=""/>
2.561 - </target>
2.562 - <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,-init-ap-cmdline" name="init"/>
2.563 - <!--
2.564 - ===================
2.565 - COMPILATION SECTION
2.566 - ===================
2.567 - -->
2.568 - <target name="-deps-jar-init" unless="built-jar.properties">
2.569 - <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
2.570 - <delete file="${built-jar.properties}" quiet="true"/>
2.571 - </target>
2.572 - <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
2.573 - <echo level="warn" message="Cycle detected: signatures was already built"/>
2.574 - </target>
2.575 - <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
2.576 - <mkdir dir="${build.dir}"/>
2.577 - <touch file="${built-jar.properties}" verbose="false"/>
2.578 - <property file="${built-jar.properties}" prefix="already.built.jar."/>
2.579 - <antcall target="-warn-already-built-jar"/>
2.580 - <propertyfile file="${built-jar.properties}">
2.581 - <entry key="${basedir}" value=""/>
2.582 - </propertyfile>
2.583 - </target>
2.584 - <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
2.585 - <target depends="init" name="-check-automatic-build">
2.586 - <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
2.587 - </target>
2.588 - <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
2.589 - <antcall target="clean"/>
2.590 - </target>
2.591 - <target depends="init,deps-jar" name="-pre-pre-compile">
2.592 - <mkdir dir="${build.classes.dir}"/>
2.593 - </target>
2.594 - <target name="-pre-compile">
2.595 - <!-- Empty placeholder for easier customization. -->
2.596 - <!-- You can override this target in the ../build.xml file. -->
2.597 - </target>
2.598 - <target if="do.depend.true" name="-compile-depend">
2.599 - <pathconvert property="build.generated.subdirs">
2.600 - <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
2.601 - <include name="*"/>
2.602 - </dirset>
2.603 - </pathconvert>
2.604 - <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
2.605 - </target>
2.606 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
2.607 - <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
2.608 - <copy todir="${build.classes.dir}">
2.609 - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
2.610 - </copy>
2.611 - </target>
2.612 - <target if="has.persistence.xml" name="-copy-persistence-xml">
2.613 - <mkdir dir="${build.classes.dir}/META-INF"/>
2.614 - <copy todir="${build.classes.dir}/META-INF">
2.615 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
2.616 - </copy>
2.617 - </target>
2.618 - <target name="-post-compile">
2.619 - <!-- Empty placeholder for easier customization. -->
2.620 - <!-- You can override this target in the ../build.xml file. -->
2.621 - </target>
2.622 - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
2.623 - <target name="-pre-compile-single">
2.624 - <!-- Empty placeholder for easier customization. -->
2.625 - <!-- You can override this target in the ../build.xml file. -->
2.626 - </target>
2.627 - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
2.628 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
2.629 - <j2seproject3:force-recompile/>
2.630 - <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
2.631 - </target>
2.632 - <target name="-post-compile-single">
2.633 - <!-- Empty placeholder for easier customization. -->
2.634 - <!-- You can override this target in the ../build.xml file. -->
2.635 - </target>
2.636 - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
2.637 - <!--
2.638 - ====================
2.639 - JAR BUILDING SECTION
2.640 - ====================
2.641 - -->
2.642 - <target depends="init" name="-pre-pre-jar">
2.643 - <dirname file="${dist.jar}" property="dist.jar.dir"/>
2.644 - <mkdir dir="${dist.jar.dir}"/>
2.645 - </target>
2.646 - <target name="-pre-jar">
2.647 - <!-- Empty placeholder for easier customization. -->
2.648 - <!-- You can override this target in the ../build.xml file. -->
2.649 - </target>
2.650 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
2.651 - <j2seproject1:jar/>
2.652 - </target>
2.653 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
2.654 - <j2seproject1:jar manifest="${manifest.file}"/>
2.655 - </target>
2.656 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
2.657 - <j2seproject1:jar manifest="${manifest.file}">
2.658 - <j2seproject1:manifest>
2.659 - <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
2.660 - </j2seproject1:manifest>
2.661 - </j2seproject1:jar>
2.662 - <echo level="info">To run this application from the command line without Ant, try:</echo>
2.663 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
2.664 - <property location="${dist.jar}" name="dist.jar.resolved"/>
2.665 - <pathconvert property="run.classpath.with.dist.jar">
2.666 - <path path="${run.classpath}"/>
2.667 - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
2.668 - </pathconvert>
2.669 - <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
2.670 - </target>
2.671 - <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
2.672 - <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
2.673 - <touch file="${tmp.manifest.file}" verbose="false"/>
2.674 - </target>
2.675 - <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
2.676 - <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
2.677 - <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
2.678 - </target>
2.679 - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
2.680 - <manifest file="${tmp.manifest.file}" mode="update">
2.681 - <attribute name="Main-Class" value="${main.class}"/>
2.682 - </manifest>
2.683 - </target>
2.684 - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
2.685 - <basename file="${application.splash}" property="splashscreen.basename"/>
2.686 - <mkdir dir="${build.classes.dir}/META-INF"/>
2.687 - <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
2.688 - <manifest file="${tmp.manifest.file}" mode="update">
2.689 - <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
2.690 - </manifest>
2.691 - </target>
2.692 - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
2.693 - <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
2.694 - <echo level="info">To run this application from the command line without Ant, try:</echo>
2.695 - <property location="${dist.jar}" name="dist.jar.resolved"/>
2.696 - <echo level="info">java -jar "${dist.jar.resolved}"</echo>
2.697 - </target>
2.698 - <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
2.699 - <delete>
2.700 - <fileset file="${tmp.manifest.file}"/>
2.701 - </delete>
2.702 - </target>
2.703 - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
2.704 - <target name="-post-jar">
2.705 - <!-- Empty placeholder for easier customization. -->
2.706 - <!-- You can override this target in the ../build.xml file. -->
2.707 - </target>
2.708 - <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"/>
2.709 - <!--
2.710 - =================
2.711 - EXECUTION SECTION
2.712 - =================
2.713 - -->
2.714 - <target depends="init,compile" description="Run a main class." name="run">
2.715 - <j2seproject1:java>
2.716 - <customize>
2.717 - <arg line="${application.args}"/>
2.718 - </customize>
2.719 - </j2seproject1:java>
2.720 - </target>
2.721 - <target name="-do-not-recompile">
2.722 - <property name="javac.includes.binary" value=""/>
2.723 - </target>
2.724 - <target depends="init,compile-single" name="run-single">
2.725 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
2.726 - <j2seproject1:java classname="${run.class}"/>
2.727 - </target>
2.728 - <target depends="init,compile-test-single" name="run-test-with-main">
2.729 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
2.730 - <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
2.731 - </target>
2.732 - <!--
2.733 - =================
2.734 - DEBUGGING SECTION
2.735 - =================
2.736 - -->
2.737 - <target depends="init" if="netbeans.home" name="-debug-start-debugger">
2.738 - <j2seproject1:nbjpdastart name="${debug.class}"/>
2.739 - </target>
2.740 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
2.741 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
2.742 - </target>
2.743 - <target depends="init,compile" name="-debug-start-debuggee">
2.744 - <j2seproject3:debug>
2.745 - <customize>
2.746 - <arg line="${application.args}"/>
2.747 - </customize>
2.748 - </j2seproject3:debug>
2.749 - </target>
2.750 - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
2.751 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
2.752 - <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
2.753 - </target>
2.754 - <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
2.755 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
2.756 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
2.757 - <j2seproject3:debug classname="${debug.class}"/>
2.758 - </target>
2.759 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
2.760 - <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
2.761 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
2.762 - <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
2.763 - </target>
2.764 - <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
2.765 - <target depends="init" name="-pre-debug-fix">
2.766 - <fail unless="fix.includes">Must set fix.includes</fail>
2.767 - <property name="javac.includes" value="${fix.includes}.java"/>
2.768 - </target>
2.769 - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
2.770 - <j2seproject1:nbjpdareload/>
2.771 - </target>
2.772 - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
2.773 - <!--
2.774 - =================
2.775 - PROFILING SECTION
2.776 - =================
2.777 - -->
2.778 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
2.779 - <nbprofiledirect>
2.780 - <classpath>
2.781 - <path path="${run.classpath}"/>
2.782 - </classpath>
2.783 - </nbprofiledirect>
2.784 - <profile/>
2.785 - </target>
2.786 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
2.787 - <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
2.788 - <nbprofiledirect>
2.789 - <classpath>
2.790 - <path path="${run.classpath}"/>
2.791 - </classpath>
2.792 - </nbprofiledirect>
2.793 - <profile classname="${profile.class}"/>
2.794 - </target>
2.795 - <!--
2.796 - =========================
2.797 - APPLET PROFILING SECTION
2.798 - =========================
2.799 - -->
2.800 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
2.801 - <nbprofiledirect>
2.802 - <classpath>
2.803 - <path path="${run.classpath}"/>
2.804 - </classpath>
2.805 - </nbprofiledirect>
2.806 - <profile classname="sun.applet.AppletViewer">
2.807 - <customize>
2.808 - <arg value="${applet.url}"/>
2.809 - </customize>
2.810 - </profile>
2.811 - </target>
2.812 - <!--
2.813 - =========================
2.814 - TESTS PROFILING SECTION
2.815 - =========================
2.816 - -->
2.817 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
2.818 - <nbprofiledirect>
2.819 - <classpath>
2.820 - <path path="${run.test.classpath}"/>
2.821 - </classpath>
2.822 - </nbprofiledirect>
2.823 - <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
2.824 - <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
2.825 - <jvmarg value="${profiler.info.jvmargs.agent}"/>
2.826 - <jvmarg line="${profiler.info.jvmargs}"/>
2.827 - <test name="${profile.class}"/>
2.828 - <classpath>
2.829 - <path path="${run.test.classpath}"/>
2.830 - </classpath>
2.831 - <syspropertyset>
2.832 - <propertyref prefix="test-sys-prop."/>
2.833 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
2.834 - </syspropertyset>
2.835 - <formatter type="brief" usefile="false"/>
2.836 - <formatter type="xml"/>
2.837 - </junit>
2.838 - </target>
2.839 - <!--
2.840 - ===============
2.841 - JAVADOC SECTION
2.842 - ===============
2.843 - -->
2.844 - <target depends="init" if="have.sources" name="-javadoc-build">
2.845 - <mkdir dir="${dist.javadoc.dir}"/>
2.846 - <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}">
2.847 - <classpath>
2.848 - <path path="${javac.classpath}"/>
2.849 - </classpath>
2.850 - <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
2.851 - <filename name="**/*.java"/>
2.852 - </fileset>
2.853 - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
2.854 - <include name="**/*.java"/>
2.855 - <exclude name="*.java"/>
2.856 - </fileset>
2.857 - </javadoc>
2.858 - <copy todir="${dist.javadoc.dir}">
2.859 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
2.860 - <filename name="**/doc-files/**"/>
2.861 - </fileset>
2.862 - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
2.863 - <include name="**/doc-files/**"/>
2.864 - </fileset>
2.865 - </copy>
2.866 - </target>
2.867 - <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
2.868 - <nbbrowse file="${dist.javadoc.dir}/index.html"/>
2.869 - </target>
2.870 - <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
2.871 - <!--
2.872 - =========================
2.873 - JUNIT COMPILATION SECTION
2.874 - =========================
2.875 - -->
2.876 - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
2.877 - <mkdir dir="${build.test.classes.dir}"/>
2.878 - </target>
2.879 - <target name="-pre-compile-test">
2.880 - <!-- Empty placeholder for easier customization. -->
2.881 - <!-- You can override this target in the ../build.xml file. -->
2.882 - </target>
2.883 - <target if="do.depend.true" name="-compile-test-depend">
2.884 - <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
2.885 - </target>
2.886 - <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
2.887 - <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
2.888 - <copy todir="${build.test.classes.dir}">
2.889 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
2.890 - </copy>
2.891 - </target>
2.892 - <target name="-post-compile-test">
2.893 - <!-- Empty placeholder for easier customization. -->
2.894 - <!-- You can override this target in the ../build.xml file. -->
2.895 - </target>
2.896 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
2.897 - <target name="-pre-compile-test-single">
2.898 - <!-- Empty placeholder for easier customization. -->
2.899 - <!-- You can override this target in the ../build.xml file. -->
2.900 - </target>
2.901 - <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
2.902 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
2.903 - <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
2.904 - <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
2.905 - <copy todir="${build.test.classes.dir}">
2.906 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
2.907 - </copy>
2.908 - </target>
2.909 - <target name="-post-compile-test-single">
2.910 - <!-- Empty placeholder for easier customization. -->
2.911 - <!-- You can override this target in the ../build.xml file. -->
2.912 - </target>
2.913 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
2.914 - <!--
2.915 - =======================
2.916 - JUNIT EXECUTION SECTION
2.917 - =======================
2.918 - -->
2.919 - <target depends="init" if="have.tests" name="-pre-test-run">
2.920 - <mkdir dir="${build.test.results.dir}"/>
2.921 - </target>
2.922 - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
2.923 - <j2seproject3:junit testincludes="**/*Test.java"/>
2.924 - </target>
2.925 - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
2.926 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
2.927 - </target>
2.928 - <target depends="init" if="have.tests" name="test-report"/>
2.929 - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
2.930 - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
2.931 - <target depends="init" if="have.tests" name="-pre-test-run-single">
2.932 - <mkdir dir="${build.test.results.dir}"/>
2.933 - </target>
2.934 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
2.935 - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
2.936 - <j2seproject3:junit excludes="" includes="${test.includes}"/>
2.937 - </target>
2.938 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
2.939 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
2.940 - </target>
2.941 - <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"/>
2.942 - <!--
2.943 - =======================
2.944 - JUNIT DEBUGGING SECTION
2.945 - =======================
2.946 - -->
2.947 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
2.948 - <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
2.949 - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
2.950 - <delete file="${test.report.file}"/>
2.951 - <mkdir dir="${build.test.results.dir}"/>
2.952 - <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}">
2.953 - <customize>
2.954 - <syspropertyset>
2.955 - <propertyref prefix="test-sys-prop."/>
2.956 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
2.957 - </syspropertyset>
2.958 - <arg value="${test.class}"/>
2.959 - <arg value="showoutput=true"/>
2.960 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
2.961 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
2.962 - </customize>
2.963 - </j2seproject3:debug>
2.964 - </target>
2.965 - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
2.966 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
2.967 - </target>
2.968 - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
2.969 - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
2.970 - <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
2.971 - </target>
2.972 - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
2.973 - <!--
2.974 - =========================
2.975 - APPLET EXECUTION SECTION
2.976 - =========================
2.977 - -->
2.978 - <target depends="init,compile-single" name="run-applet">
2.979 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
2.980 - <j2seproject1:java classname="sun.applet.AppletViewer">
2.981 - <customize>
2.982 - <arg value="${applet.url}"/>
2.983 - </customize>
2.984 - </j2seproject1:java>
2.985 - </target>
2.986 - <!--
2.987 - =========================
2.988 - APPLET DEBUGGING SECTION
2.989 - =========================
2.990 - -->
2.991 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
2.992 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
2.993 - <j2seproject3:debug classname="sun.applet.AppletViewer">
2.994 - <customize>
2.995 - <arg value="${applet.url}"/>
2.996 - </customize>
2.997 - </j2seproject3:debug>
2.998 - </target>
2.999 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
2.1000 - <!--
2.1001 - ===============
2.1002 - CLEANUP SECTION
2.1003 - ===============
2.1004 - -->
2.1005 - <target name="-deps-clean-init" unless="built-clean.properties">
2.1006 - <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
2.1007 - <delete file="${built-clean.properties}" quiet="true"/>
2.1008 - </target>
2.1009 - <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
2.1010 - <echo level="warn" message="Cycle detected: signatures was already built"/>
2.1011 - </target>
2.1012 - <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
2.1013 - <mkdir dir="${build.dir}"/>
2.1014 - <touch file="${built-clean.properties}" verbose="false"/>
2.1015 - <property file="${built-clean.properties}" prefix="already.built.clean."/>
2.1016 - <antcall target="-warn-already-built-clean"/>
2.1017 - <propertyfile file="${built-clean.properties}">
2.1018 - <entry key="${basedir}" value=""/>
2.1019 - </propertyfile>
2.1020 - </target>
2.1021 - <target depends="init" name="-do-clean">
2.1022 - <delete dir="${build.dir}"/>
2.1023 - <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
2.1024 - </target>
2.1025 - <target name="-post-clean">
2.1026 - <!-- Empty placeholder for easier customization. -->
2.1027 - <!-- You can override this target in the ../build.xml file. -->
2.1028 - </target>
2.1029 - <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
2.1030 - <target name="-check-call-dep">
2.1031 - <property file="${call.built.properties}" prefix="already.built."/>
2.1032 - <condition property="should.call.dep">
2.1033 - <not>
2.1034 - <isset property="already.built.${call.subproject}"/>
2.1035 - </not>
2.1036 - </condition>
2.1037 - </target>
2.1038 - <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
2.1039 - <ant antfile="${call.script}" inheritall="false" target="${call.target}">
2.1040 - <propertyset>
2.1041 - <propertyref prefix="transfer."/>
2.1042 - <mapper from="transfer.*" to="*" type="glob"/>
2.1043 - </propertyset>
2.1044 - </ant>
2.1045 - </target>
2.1046 -</project>
3.1 --- a/other/signatures/nbproject/genfiles.properties Thu Jul 21 11:16:26 2011 -0400
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,8 +0,0 @@
3.4 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
3.5 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
3.6 -build.xml.data.CRC32=ee7e9246
3.7 -build.xml.script.CRC32=5ad3d30a
3.8 -build.xml.stylesheet.CRC32=28e38971@1.45.0.45
3.9 -nbproject/build-impl.xml.data.CRC32=ee7e9246
3.10 -nbproject/build-impl.xml.script.CRC32=c40a4c5e
3.11 -nbproject/build-impl.xml.stylesheet.CRC32=cfcde7f8@1.45.0.45
4.1 --- a/other/signatures/nbproject/project.properties Thu Jul 21 11:16:26 2011 -0400
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,58 +0,0 @@
4.4 -build.classes.dir=${build.dir}/classes
4.5 -build.classes.excludes=**/*.java,**/*.form
4.6 -# This directory is removed when the project is cleaned:
4.7 -build.dir=build
4.8 -build.generated.dir=${build.dir}/generated
4.9 -build.generated.sources.dir=${build.dir}/generated-sources
4.10 -# Only compile against the classpath explicitly listed here:
4.11 -build.sysclasspath=ignore
4.12 -build.test.classes.dir=${build.dir}/test/classes
4.13 -build.test.results.dir=${build.dir}/test/results
4.14 -debug.classpath=\
4.15 - ${run.classpath}
4.16 -debug.test.classpath=\
4.17 - ${run.test.classpath}
4.18 -# This directory is removed when the project is cleaned:
4.19 -dist.dir=dist
4.20 -dist.jar=${dist.dir}/signatures.jar
4.21 -dist.javadoc.dir=${dist.dir}/javadoc
4.22 -excludes=
4.23 -file.reference.ant.jar=${ant.home}/lib/ant.jar
4.24 -includes=**
4.25 -jar.compress=false
4.26 -javac.classpath=\
4.27 - ${file.reference.ant.jar}
4.28 -# Space-separated list of extra javac options
4.29 -javac.compilerargs=-Xlint
4.30 -javac.deprecation=false
4.31 -javac.source=1.6
4.32 -javac.target=1.6
4.33 -javac.test.classpath=\
4.34 - ${javac.classpath}:\
4.35 - ${build.classes.dir}:\
4.36 - ${libs.junit.classpath}
4.37 -javadoc.additionalparam=
4.38 -javadoc.author=false
4.39 -javadoc.encoding=
4.40 -javadoc.noindex=false
4.41 -javadoc.nonavbar=false
4.42 -javadoc.notree=false
4.43 -javadoc.private=false
4.44 -javadoc.splitindex=true
4.45 -javadoc.use=true
4.46 -javadoc.version=false
4.47 -javadoc.windowtitle=
4.48 -meta.inf.dir=${src.dir}/META-INF
4.49 -platform.active=default_platform
4.50 -run.classpath=\
4.51 - ${javac.classpath}:\
4.52 - ${build.classes.dir}
4.53 -# Space-separated list of JVM arguments used when running the project
4.54 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
4.55 -# or test-sys-prop.name=value to set system properties for unit tests):
4.56 -run.jvmargs=-ea -Xmx128m
4.57 -run.test.classpath=\
4.58 - ${javac.test.classpath}:\
4.59 - ${build.test.classes.dir}
4.60 -src.dir=src
4.61 -test.src.dir=test
5.1 --- a/other/signatures/nbproject/project.xml Thu Jul 21 11:16:26 2011 -0400
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,16 +0,0 @@
5.4 -<?xml version="1.0" encoding="UTF-8"?>
5.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
5.6 - <type>org.netbeans.modules.java.j2seproject</type>
5.7 - <configuration>
5.8 - <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
5.9 - <name>signatures</name>
5.10 - <minimum-ant-version>1.6.5</minimum-ant-version>
5.11 - <source-roots>
5.12 - <root id="src.dir"/>
5.13 - </source-roots>
5.14 - <test-roots>
5.15 - <root id="test.src.dir"/>
5.16 - </test-roots>
5.17 - </data>
5.18 - </configuration>
5.19 -</project>
6.1 --- a/other/signatures/src/org/netbeans/signatures/ClassScanner.java Thu Jul 21 11:16:26 2011 -0400
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,149 +0,0 @@
6.4 -/*
6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 - *
6.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6.8 - *
6.9 - * The contents of this file are subject to the terms of either the GNU
6.10 - * General Public License Version 2 only ("GPL") or the Common
6.11 - * Development and Distribution License("CDDL") (collectively, the
6.12 - * "License"). You may not use this file except in compliance with the
6.13 - * License. You can obtain a copy of the License at
6.14 - * http://www.netbeans.org/cddl-gplv2.html
6.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.16 - * specific language governing permissions and limitations under the
6.17 - * License. When distributing the software, include this License Header
6.18 - * Notice in each file and include the License file at
6.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
6.20 - * particular file as subject to the "Classpath" exception as provided
6.21 - * by Sun in the GPL Version 2 section of the License file that
6.22 - * accompanied this code. If applicable, add the following below the
6.23 - * License Header, with the fields enclosed by brackets [] replaced by
6.24 - * your own identifying information:
6.25 - * "Portions Copyrighted [year] [name of copyright owner]"
6.26 - *
6.27 - * Contributor(s):
6.28 - *
6.29 - * The Original Software is NetBeans. The Initial Developer of the Original
6.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
6.31 - * Microsystems, Inc. All Rights Reserved.
6.32 - *
6.33 - * If you wish your version of this file to be governed by only the CDDL
6.34 - * or only the GPL Version 2, indicate your decision by adding
6.35 - * "[Contributor] elects to include this software in this distribution
6.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.37 - * single choice of license, a recipient has the option to distribute
6.38 - * your version of this file under either the CDDL, the GPL Version 2 or
6.39 - * to extend the choice of license to its licensees as provided above.
6.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
6.41 - * Version 2 license, then the option applies only if the new code is
6.42 - * made subject to such option by the copyright holder.
6.43 - */
6.44 -
6.45 -package org.netbeans.signatures;
6.46 -
6.47 -import java.io.File;
6.48 -import java.io.IOException;
6.49 -import java.util.ArrayList;
6.50 -import java.util.Collection;
6.51 -import java.util.Enumeration;
6.52 -import java.util.Set;
6.53 -import java.util.SortedSet;
6.54 -import java.util.TreeSet;
6.55 -import java.util.jar.JarEntry;
6.56 -import java.util.jar.JarFile;
6.57 -import java.util.jar.Manifest;
6.58 -import java.util.regex.Matcher;
6.59 -import java.util.regex.Pattern;
6.60 -
6.61 -/**
6.62 - * Finds all top-level classes detected in a classpath.
6.63 - * @author Jesse Glick
6.64 - */
6.65 -public class ClassScanner {
6.66 -
6.67 - private ClassScanner() {}
6.68 -
6.69 - /**
6.70 - * Looks for all classes in a classpath.
6.71 - * @param cp a set of classpath entries (currently only JARs are supported); must be modifiable if <code>classPathExtensions</code> is set
6.72 - * @param publicPackagesOnly if true, check for <code>OpenIDE-Module-Public-Packages</code> and only include classes from matching packages
6.73 - * @param classPathExtensions if true, check for <code>Class-Path</code> and traverse extension JARs automatically (additions will be made to <code>cp</code>)
6.74 - */
6.75 - public static Collection<String> findTopLevelClasses(Set<File> cp, boolean publicPackagesOnly, boolean classPathExtensions) throws IOException {
6.76 - SortedSet<String> classes = new TreeSet<String>();
6.77 - for (File jar : new ArrayList<File>(cp)) {
6.78 - traverse(jar, classes, cp, publicPackagesOnly, classPathExtensions, null);
6.79 - }
6.80 - return classes;
6.81 - }
6.82 -
6.83 - private static void traverse(File jar, Set<String> classes, Set<File> knownJars, boolean publicPackagesOnly, boolean classPathExtensions, String[] pubpkgs) throws IOException {
6.84 - if (!jar.isFile()) {
6.85 - throw new IllegalArgumentException("XXX directory CP entries not yet supported: " + jar);
6.86 - }
6.87 - JarFile jf = new JarFile(jar);
6.88 - try {
6.89 - if (pubpkgs == null && publicPackagesOnly) {
6.90 - Manifest mf = jf.getManifest();
6.91 - if (mf != null) {
6.92 - String pp = mf.getMainAttributes().getValue("OpenIDE-Module-Public-Packages");
6.93 - if (pp != null) {
6.94 - pp = pp.trim();
6.95 - if (pp.equals("-")) {
6.96 - return;
6.97 - }
6.98 - pubpkgs = pp.split(" *[, ] *");
6.99 - }
6.100 - }
6.101 - }
6.102 - if (classPathExtensions) {
6.103 - Manifest mf = jf.getManifest();
6.104 - if (mf != null) {
6.105 - String ext = mf.getMainAttributes().getValue("Class-Path");
6.106 - if (ext != null) {
6.107 - for (String reluri : ext.trim().split("[ ,]+")) {
6.108 - File extjar = new File(jar.toURI().resolve(reluri));
6.109 - if (extjar.exists() && knownJars.add(extjar)) {
6.110 - traverse(extjar, classes, knownJars, publicPackagesOnly, classPathExtensions, pubpkgs);
6.111 - }
6.112 - }
6.113 - }
6.114 - }
6.115 - }
6.116 - Enumeration<JarEntry> entries = jf.entries();
6.117 - while (entries.hasMoreElements()) {
6.118 - JarEntry entry = entries.nextElement();
6.119 - String path = entry.getName();
6.120 - if (!path.endsWith(".class")/* || path.contains("$")*/) {
6.121 - continue;
6.122 - }
6.123 - String pkg = path.contains("/") ? path.replaceFirst("/[^/]+$", "").replace('/', '.') : "";
6.124 - if (pubpkgs != null) {
6.125 - boolean included = false;
6.126 - for (String pubpkg : pubpkgs) {
6.127 - Matcher m = Pattern.compile("(.+)\\.(\\*\\*?)").matcher(pubpkg);
6.128 - if (!m.matches()) {
6.129 - throw new IOException("Bad OpenIDE-Module-Public-Packages entry '" + pubpkg + "' in " + jar);
6.130 - }
6.131 - String prefix = m.group(1);
6.132 - if (m.group(2).length() == 1) {
6.133 - included = prefix.equals(pkg);
6.134 - } else {
6.135 - included = prefix.equals(pkg) || pkg.startsWith(prefix + ".");
6.136 - }
6.137 - if (included) {
6.138 - break;
6.139 - }
6.140 - }
6.141 - if (!included) {
6.142 - continue;
6.143 - }
6.144 - }
6.145 - classes.add(path.replaceAll("\\.class$", "").replace('/', '.'));
6.146 - }
6.147 - } finally {
6.148 - jf.close();
6.149 - }
6.150 - }
6.151 -
6.152 -}
7.1 --- a/other/signatures/src/org/netbeans/signatures/Loader.java Thu Jul 21 11:16:26 2011 -0400
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,186 +0,0 @@
7.4 -/*
7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.6 - *
7.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7.8 - *
7.9 - * The contents of this file are subject to the terms of either the GNU
7.10 - * General Public License Version 2 only ("GPL") or the Common
7.11 - * Development and Distribution License("CDDL") (collectively, the
7.12 - * "License"). You may not use this file except in compliance with the
7.13 - * License. You can obtain a copy of the License at
7.14 - * http://www.netbeans.org/cddl-gplv2.html
7.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.16 - * specific language governing permissions and limitations under the
7.17 - * License. When distributing the software, include this License Header
7.18 - * Notice in each file and include the License file at
7.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
7.20 - * particular file as subject to the "Classpath" exception as provided
7.21 - * by Sun in the GPL Version 2 section of the License file that
7.22 - * accompanied this code. If applicable, add the following below the
7.23 - * License Header, with the fields enclosed by brackets [] replaced by
7.24 - * your own identifying information:
7.25 - * "Portions Copyrighted [year] [name of copyright owner]"
7.26 - *
7.27 - * Contributor(s):
7.28 - *
7.29 - * The Original Software is NetBeans. The Initial Developer of the Original
7.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
7.31 - * Microsystems, Inc. All Rights Reserved.
7.32 - *
7.33 - * If you wish your version of this file to be governed by only the CDDL
7.34 - * or only the GPL Version 2, indicate your decision by adding
7.35 - * "[Contributor] elects to include this software in this distribution
7.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
7.37 - * single choice of license, a recipient has the option to distribute
7.38 - * your version of this file under either the CDDL, the GPL Version 2 or
7.39 - * to extend the choice of license to its licensees as provided above.
7.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
7.41 - * Version 2 license, then the option applies only if the new code is
7.42 - * made subject to such option by the copyright holder.
7.43 - */
7.44 -
7.45 -package org.netbeans.signatures;
7.46 -
7.47 -import java.io.ByteArrayOutputStream;
7.48 -import java.io.File;
7.49 -import java.io.IOException;
7.50 -import java.io.OutputStream;
7.51 -import java.io.StringWriter;
7.52 -import java.io.Writer;
7.53 -import java.net.URI;
7.54 -import java.util.Arrays;
7.55 -import java.util.Collection;
7.56 -import java.util.Collections;
7.57 -import java.util.Set;
7.58 -import javax.annotation.processing.AbstractProcessor;
7.59 -import javax.annotation.processing.RoundEnvironment;
7.60 -import javax.annotation.processing.SupportedAnnotationTypes;
7.61 -import javax.annotation.processing.SupportedSourceVersion;
7.62 -import javax.lang.model.SourceVersion;
7.63 -import javax.lang.model.element.TypeElement;
7.64 -import javax.lang.model.util.Elements;
7.65 -import javax.lang.model.util.Types;
7.66 -import javax.tools.FileObject;
7.67 -import javax.tools.ForwardingJavaFileManager;
7.68 -import javax.tools.JavaCompiler;
7.69 -import javax.tools.JavaFileManager;
7.70 -import javax.tools.JavaFileManager.Location;
7.71 -import javax.tools.JavaFileObject;
7.72 -import javax.tools.JavaFileObject.Kind;
7.73 -import javax.tools.SimpleJavaFileObject;
7.74 -import javax.tools.ToolProvider;
7.75 -
7.76 -/**
7.77 - * Loads structural information from bytecode.
7.78 - * @author Jesse Glick
7.79 - */
7.80 -public abstract class Loader {
7.81 -
7.82 - private Elements elements;
7.83 - private Types types;
7.84 - private RuntimeException exception;
7.85 - private Error error;
7.86 -
7.87 - protected Loader(Collection<File> cp) {
7.88 - StringBuilder cps = new StringBuilder();
7.89 - for (File p : cp) {
7.90 - if (!p.exists()) {
7.91 - throw new IllegalArgumentException("No such classpath element " + p);
7.92 - }
7.93 - if (cps.length() > 0) {
7.94 - cps.append(File.pathSeparatorChar);
7.95 - }
7.96 - cps.append(p);
7.97 - }
7.98 - StringWriter err = new StringWriter();
7.99 - JavaCompiler.CompilationTask task = ToolProvider.getSystemJavaCompiler().getTask(
7.100 - err,
7.101 - nullOutputFileManager(),
7.102 - null,
7.103 - Arrays.asList("-source", "1.6", "-classpath", cps.toString()),
7.104 - null,
7.105 - Collections.singleton(dummyCompilationUnit()));
7.106 - task.setProcessors(Collections.singleton(new LoaderProcessor()));
7.107 - boolean ok = task.call();
7.108 - String errors = err.toString();
7.109 - assert ok : errors;
7.110 - assert errors.length() == 0 : errors;
7.111 - if (exception != null) {
7.112 - throw exception;
7.113 - } else if (error != null) {
7.114 - throw error;
7.115 - }
7.116 - }
7.117 -
7.118 - protected abstract void run();
7.119 -
7.120 - protected final Elements elements() {
7.121 - return elements;
7.122 - }
7.123 -
7.124 - protected final Types types() {
7.125 - return types;
7.126 - }
7.127 -
7.128 - @SupportedAnnotationTypes("*")
7.129 - @SupportedSourceVersion(SourceVersion.RELEASE_6)
7.130 - private final class LoaderProcessor extends AbstractProcessor {
7.131 -
7.132 - private boolean ran = false;
7.133 -
7.134 - LoaderProcessor() {}
7.135 -
7.136 - public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
7.137 - if (!ran) {
7.138 - ran = true;
7.139 - } else {
7.140 - return true;
7.141 - }
7.142 - elements = processingEnv.getElementUtils();
7.143 - assert elements != null;
7.144 - types = processingEnv.getTypeUtils();
7.145 - assert types != null;
7.146 - try {
7.147 - run();
7.148 - } catch (ThreadDeath t) {
7.149 - throw t;
7.150 - } catch (RuntimeException t) {
7.151 - exception = t;
7.152 - } catch (Error t) {
7.153 - error = t;
7.154 - }
7.155 - elements = null;
7.156 - types = null;
7.157 - return true;
7.158 - }
7.159 -
7.160 - }
7.161 -
7.162 - public static JavaFileObject dummyCompilationUnit() {
7.163 - return new SimpleJavaFileObject(URI.create("nowhere:/Dummy.java"), JavaFileObject.Kind.SOURCE) {
7.164 - public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
7.165 - return "public class Dummy {}";
7.166 - }
7.167 - };
7.168 - }
7.169 -
7.170 - public static JavaFileManager nullOutputFileManager() {
7.171 - return new ForwardingJavaFileManager<JavaFileManager>(ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
7.172 - JavaFileObject devNull = new SimpleJavaFileObject(URI.create("no:/where"), JavaFileObject.Kind.OTHER) {
7.173 - public OutputStream openOutputStream() throws IOException {
7.174 - return new ByteArrayOutputStream();
7.175 - }
7.176 - public Writer openWriter() throws IOException {
7.177 - return new StringWriter();
7.178 - }
7.179 - };
7.180 - public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
7.181 - return devNull;
7.182 - }
7.183 - public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
7.184 - return devNull;
7.185 - }
7.186 - };
7.187 - }
7.188 -
7.189 -}
8.1 --- a/other/signatures/src/org/netbeans/signatures/SignatureTask.java Thu Jul 21 11:16:26 2011 -0400
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,189 +0,0 @@
8.4 -/*
8.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.6 - *
8.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
8.8 - *
8.9 - * The contents of this file are subject to the terms of either the GNU
8.10 - * General Public License Version 2 only ("GPL") or the Common
8.11 - * Development and Distribution License("CDDL") (collectively, the
8.12 - * "License"). You may not use this file except in compliance with the
8.13 - * License. You can obtain a copy of the License at
8.14 - * http://www.netbeans.org/cddl-gplv2.html
8.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.16 - * specific language governing permissions and limitations under the
8.17 - * License. When distributing the software, include this License Header
8.18 - * Notice in each file and include the License file at
8.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
8.20 - * particular file as subject to the "Classpath" exception as provided
8.21 - * by Sun in the GPL Version 2 section of the License file that
8.22 - * accompanied this code. If applicable, add the following below the
8.23 - * License Header, with the fields enclosed by brackets [] replaced by
8.24 - * your own identifying information:
8.25 - * "Portions Copyrighted [year] [name of copyright owner]"
8.26 - *
8.27 - * Contributor(s):
8.28 - *
8.29 - * The Original Software is NetBeans. The Initial Developer of the Original
8.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
8.31 - * Microsystems, Inc. All Rights Reserved.
8.32 - *
8.33 - * If you wish your version of this file to be governed by only the CDDL
8.34 - * or only the GPL Version 2, indicate your decision by adding
8.35 - * "[Contributor] elects to include this software in this distribution
8.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
8.37 - * single choice of license, a recipient has the option to distribute
8.38 - * your version of this file under either the CDDL, the GPL Version 2 or
8.39 - * to extend the choice of license to its licensees as provided above.
8.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
8.41 - * Version 2 license, then the option applies only if the new code is
8.42 - * made subject to such option by the copyright holder.
8.43 - */
8.44 -
8.45 -package org.netbeans.signatures;
8.46 -
8.47 -import java.io.File;
8.48 -import java.io.FileOutputStream;
8.49 -import java.io.IOException;
8.50 -import java.io.OutputStream;
8.51 -import java.io.OutputStreamWriter;
8.52 -import java.io.PrintWriter;
8.53 -import java.util.Arrays;
8.54 -import java.util.Collection;
8.55 -import java.util.LinkedList;
8.56 -import java.util.Set;
8.57 -import java.util.TreeSet;
8.58 -import java.util.regex.Matcher;
8.59 -import java.util.regex.Pattern;
8.60 -import javax.tools.JavaCompiler;
8.61 -import javax.tools.ToolProvider;
8.62 -import org.apache.tools.ant.BuildException;
8.63 -import org.apache.tools.ant.DirectoryScanner;
8.64 -import org.apache.tools.ant.Project;
8.65 -import org.apache.tools.ant.Task;
8.66 -import org.apache.tools.ant.types.FileSet;
8.67 -
8.68 -/**
8.69 - * Ant task to write out all public Java signatures for some JARs.
8.70 - * The output will be a Java source file which should be compilable
8.71 - * when those JARs are in the classpath.
8.72 - * It will attempt to exercise as much of the public API detected in those
8.73 - * JARs as possible.
8.74 - * Running the class (or classes) will not be possible; compilation is the test.
8.75 - * Order should be stable, so you may meaningfully use a diff tool to check for
8.76 - * syntactic API changes. Added lines are compatible; removed lines may be incompatible.
8.77 - * @author Jesse Glick
8.78 - */
8.79 -public class SignatureTask extends Task {
8.80 -
8.81 - private Collection<FileSet> filesets = new LinkedList<FileSet>();
8.82 - private Pattern skipRegexp = Pattern.compile("^com\\.sun\\.");
8.83 - private File out;
8.84 -
8.85 - public SignatureTask() {}
8.86 -
8.87 - /**
8.88 - * Add a set of JAR files to be processed.
8.89 - */
8.90 - public void addFileSet(FileSet fs) {
8.91 - filesets.add(fs);
8.92 - }
8.93 -
8.94 - /**
8.95 - * Set the output file to generate signatures into.
8.96 - * Must be named <code><i>something</i>.java</code>.
8.97 - */
8.98 - public void setOut(File f) {
8.99 - out = f;
8.100 - }
8.101 -
8.102 - /**
8.103 - * Configure a regular expression of class names to skip for processing.
8.104 - * By default, it is: <pre>^com\.sun\.</pre>
8.105 - * This avoids warnings of the form
8.106 - * <pre>warning: com.sun.x.y.z is Sun proprietary API and may be removed in a future release</pre>
8.107 - * which may occur if you accidentally include some such classes among your JAR(s).
8.108 - */
8.109 - public void setSkipRegexp(String s) {
8.110 - skipRegexp = Pattern.compile(s);
8.111 - }
8.112 -
8.113 - @Override
8.114 - public void execute() throws BuildException {
8.115 - if (out == null) {
8.116 - throw new BuildException("Must specify out='...'", getLocation());
8.117 - }
8.118 - Matcher m = Pattern.compile("(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*)\\.java").matcher(out.getName());
8.119 - if (!m.matches()) {
8.120 - throw new BuildException("Illegal Java source file name " + out.getName(), getLocation());
8.121 - }
8.122 - final String sigclazz = m.group(1);
8.123 - if (filesets.isEmpty()) {
8.124 - throw new BuildException("Must specify <fileset>s", getLocation());
8.125 - }
8.126 - final Set<File> cp = new TreeSet<File>();
8.127 - for (FileSet fs : filesets) {
8.128 - DirectoryScanner ds = fs.getDirectoryScanner(getProject());
8.129 - File basedir = ds.getBasedir();
8.130 - for (String file : ds.getIncludedFiles()) {
8.131 - cp.add(new File(basedir, file));
8.132 - }
8.133 - }
8.134 - try {
8.135 - final Collection<String> classes = ClassScanner.findTopLevelClasses(cp, true, true);
8.136 - OutputStream os = new FileOutputStream(out);
8.137 - try {
8.138 - final PrintWriter w = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
8.139 - w.printf("@SuppressWarnings(\"deprecation\")\nclass %s000 {\n\n", sigclazz);
8.140 - new Loader(cp) {
8.141 - protected void run() {
8.142 - SignatureWriter sigs = new SignatureWriter(w, elements(), types());
8.143 - int cnt = 0;
8.144 - int blocksize = 1000;
8.145 - for (String clazz : classes) {
8.146 - if (skipRegexp != null && skipRegexp.matcher(clazz).find()) {
8.147 - continue;
8.148 - }
8.149 - try {
8.150 - sigs.process(clazz);
8.151 - } catch (RuntimeException e) {
8.152 - log("Failed to create signature for " + clazz + " in " + cp + " due to " + e, Project.MSG_VERBOSE);
8.153 - }
8.154 - if (++cnt % blocksize == 0) {
8.155 - log("Working on " + clazz, Project.MSG_INFO);
8.156 - w.printf("}\n\n@SuppressWarnings(\"deprecation\")\nclass %s%03d {\n\n", sigclazz, cnt / blocksize);
8.157 - }
8.158 - }
8.159 - }
8.160 - };
8.161 - w.println("}");
8.162 - w.flush();
8.163 - } finally {
8.164 - os.close();
8.165 - }
8.166 - } catch (IOException x) {
8.167 - throw new BuildException(x, getLocation());
8.168 - }
8.169 - StringBuilder cps = new StringBuilder();
8.170 - for (File p : cp) {
8.171 - if (cps.length() > 0) {
8.172 - cps.append(File.pathSeparatorChar);
8.173 - }
8.174 - cps.append(p);
8.175 - }
8.176 - log("Running a test compile of " + out, Project.MSG_INFO);
8.177 - JavaCompiler.CompilationTask task = ToolProvider.getSystemJavaCompiler().getTask(
8.178 - // XXX should redirect errors to Project.log, and should perhaps fail on any messages
8.179 - null,
8.180 - Loader.nullOutputFileManager(),
8.181 - null,
8.182 - Arrays.asList("-source", "1.6", "-encoding", "UTF-8", "-classpath", cps.toString(), "-Xlint:unchecked"),
8.183 - null,
8.184 - ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null).getJavaFileObjects(out));
8.185 - boolean ok = task.call();
8.186 - if (!ok) {
8.187 - throw new BuildException("Compilation of generated signature class failed", getLocation());
8.188 - }
8.189 - log("Test compile succeeded.", Project.MSG_INFO);
8.190 - }
8.191 -
8.192 -}
9.1 --- a/other/signatures/src/org/netbeans/signatures/SignatureWriter.java Thu Jul 21 11:16:26 2011 -0400
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,311 +0,0 @@
9.4 -/*
9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 - *
9.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
9.8 - *
9.9 - * The contents of this file are subject to the terms of either the GNU
9.10 - * General Public License Version 2 only ("GPL") or the Common
9.11 - * Development and Distribution License("CDDL") (collectively, the
9.12 - * "License"). You may not use this file except in compliance with the
9.13 - * License. You can obtain a copy of the License at
9.14 - * http://www.netbeans.org/cddl-gplv2.html
9.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.16 - * specific language governing permissions and limitations under the
9.17 - * License. When distributing the software, include this License Header
9.18 - * Notice in each file and include the License file at
9.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
9.20 - * particular file as subject to the "Classpath" exception as provided
9.21 - * by Sun in the GPL Version 2 section of the License file that
9.22 - * accompanied this code. If applicable, add the following below the
9.23 - * License Header, with the fields enclosed by brackets [] replaced by
9.24 - * your own identifying information:
9.25 - * "Portions Copyrighted [year] [name of copyright owner]"
9.26 - *
9.27 - * Contributor(s):
9.28 - *
9.29 - * The Original Software is NetBeans. The Initial Developer of the Original
9.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
9.31 - * Microsystems, Inc. All Rights Reserved.
9.32 - *
9.33 - * If you wish your version of this file to be governed by only the CDDL
9.34 - * or only the GPL Version 2, indicate your decision by adding
9.35 - * "[Contributor] elects to include this software in this distribution
9.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.37 - * single choice of license, a recipient has the option to distribute
9.38 - * your version of this file under either the CDDL, the GPL Version 2 or
9.39 - * to extend the choice of license to its licensees as provided above.
9.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
9.41 - * Version 2 license, then the option applies only if the new code is
9.42 - * made subject to such option by the copyright holder.
9.43 - */
9.44 -
9.45 -package org.netbeans.signatures;
9.46 -
9.47 -import java.io.PrintWriter;
9.48 -import java.util.ArrayList;
9.49 -import java.util.LinkedHashSet;
9.50 -import java.util.List;
9.51 -import java.util.Set;
9.52 -import java.util.SortedSet;
9.53 -import java.util.TreeSet;
9.54 -import javax.lang.model.element.Element;
9.55 -import javax.lang.model.element.ElementKind;
9.56 -import javax.lang.model.element.ExecutableElement;
9.57 -import javax.lang.model.element.Modifier;
9.58 -import javax.lang.model.element.Name;
9.59 -import javax.lang.model.element.TypeElement;
9.60 -import javax.lang.model.element.TypeParameterElement;
9.61 -import javax.lang.model.type.ArrayType;
9.62 -import javax.lang.model.type.DeclaredType;
9.63 -import javax.lang.model.type.ExecutableType;
9.64 -import javax.lang.model.type.TypeMirror;
9.65 -import javax.lang.model.type.TypeVariable;
9.66 -import javax.lang.model.type.WildcardType;
9.67 -import javax.lang.model.util.Elements;
9.68 -import javax.lang.model.util.Types;
9.69 -
9.70 -/**
9.71 - * Writes out usages of a type signature.
9.72 - * @author Jesse Glick
9.73 - */
9.74 -public final class SignatureWriter {
9.75 -
9.76 - private final PrintWriter w;
9.77 - private final Elements elements;
9.78 - private final Types types;
9.79 - private final SortedSet<String> lines = new TreeSet<String>();
9.80 -
9.81 - public SignatureWriter(PrintWriter w, Elements elements, Types types) {
9.82 - this.w = w;
9.83 - this.elements = elements;
9.84 - this.types = types;
9.85 - }
9.86 -
9.87 - private void emit(String text) {
9.88 - lines.add(text);
9.89 - }
9.90 -
9.91 - public void process(String clazz) {
9.92 - TypeElement type = elements.getTypeElement(clazz);
9.93 - if (type == null) {
9.94 - // Cannot find any such.
9.95 - return;
9.96 - }
9.97 - if (!type.getModifiers().contains(Modifier.PUBLIC)) {
9.98 - // Package-private class.
9.99 - return;
9.100 - }
9.101 - Name name = type.getQualifiedName();
9.102 - if (name.toString().length() == 0) {
9.103 - // Anonymous class.
9.104 - return;
9.105 - }
9.106 - emit("Class _ = " + name + ".class;");
9.107 - processSupertypes(type);
9.108 - switch (type.getKind()) {
9.109 - case CLASS:
9.110 - if (!type.getModifiers().contains(Modifier.ABSTRACT)) {
9.111 - processPublicConstructors(type);
9.112 - }
9.113 - // XXX
9.114 - break;
9.115 - case INTERFACE:
9.116 - // XXX
9.117 - break;
9.118 - case ENUM:
9.119 - // XXX
9.120 - break;
9.121 - case ANNOTATION_TYPE:
9.122 - // XXX
9.123 - break;
9.124 - default:
9.125 - assert false : type.getKind();
9.126 - }
9.127 - for (String line : lines) {
9.128 - w.println("{" + line + "}");
9.129 - }
9.130 - lines.clear();
9.131 - w.println();
9.132 - }
9.133 -
9.134 - private String name(TypeMirror type) {
9.135 - return type.toString().replaceAll("\\bjava\\.lang\\.([A-Z])", "$1");
9.136 - }
9.137 -
9.138 - private TypeMirror instantiateTypeParametersWithUpperBound(TypeMirror type) {
9.139 - switch (type.getKind()) {
9.140 - case DECLARED:
9.141 - DeclaredType dtype = (DeclaredType) type;
9.142 - List<TypeMirror> params = new ArrayList<TypeMirror>();
9.143 - for (TypeMirror arg : dtype.getTypeArguments()) {
9.144 - params.add(instantiateTypeParametersWithUpperBound(arg));
9.145 - }
9.146 - return types.getDeclaredType((TypeElement) types.asElement(dtype), params.toArray(new TypeMirror[params.size()]));
9.147 - case ARRAY:
9.148 - return types.getArrayType(instantiateTypeParametersWithUpperBound(((ArrayType) type).getComponentType()));
9.149 - case TYPEVAR:
9.150 - return ((TypeVariable) type).getUpperBound();
9.151 - case WILDCARD:
9.152 - TypeMirror bound = ((WildcardType) type).getExtendsBound();
9.153 - return bound != null ? instantiateTypeParametersWithUpperBound(bound) : objectType();
9.154 - default:
9.155 - return type;
9.156 - }
9.157 - }
9.158 -
9.159 - private TypeMirror objectType() {
9.160 - return elements.getTypeElement("java.lang.Object").asType();
9.161 - }
9.162 -
9.163 - private TypeMirror instantiateTypeParametersWithUpperBound(TypeElement type) {
9.164 - List<TypeMirror> params = new ArrayList<TypeMirror>();
9.165 - for (TypeParameterElement p : type.getTypeParameters()) {
9.166 - List<? extends TypeMirror> bounds = p.getBounds();
9.167 - if (bounds.isEmpty()) {
9.168 - params.add(objectType());
9.169 - } else {
9.170 - params.add(bounds.get(0)); // XXX OK?
9.171 - }
9.172 - }
9.173 - return types.getDeclaredType(type, params.toArray(new TypeMirror[params.size()]));
9.174 - }
9.175 -
9.176 - private Iterable<TypeMirror> supertypes(TypeElement type, boolean includeThis, boolean includeObject) {
9.177 - Set<TypeMirror> supertypes = new LinkedHashSet<TypeMirror>();
9.178 - TypeMirror instantiated = instantiateTypeParametersWithUpperBound(type);
9.179 - collectSupertypes(instantiated, supertypes, includeObject);
9.180 - if (!includeThis) {
9.181 - supertypes.remove(instantiated);
9.182 - }
9.183 - return supertypes;
9.184 - }
9.185 - private void collectSupertypes(TypeMirror type, Set<TypeMirror> supertypes, boolean includeObject) {
9.186 - for (TypeMirror t : types.directSupertypes(type)) {
9.187 - collectSupertypes(t, supertypes, includeObject);
9.188 - }
9.189 - if (includeObject || !types.isSameType(type, objectType())) {
9.190 - supertypes.add(type);
9.191 - }
9.192 - }
9.193 -
9.194 - private void processPublicConstructors(TypeElement type) {
9.195 - for (Element e : type.getEnclosedElements()) {
9.196 - if (e.getKind() != ElementKind.CONSTRUCTOR) {
9.197 - continue;
9.198 - }
9.199 - if (!e.getModifiers().contains(Modifier.PUBLIC)) {
9.200 - continue;
9.201 - }
9.202 - String params = parameters((ExecutableElement) e);
9.203 - if (params == null) {
9.204 - // Some parameter type is inaccessible, so we cannot call it.
9.205 - // XXX this might not be strictly true in case that parameter type has a public subtype
9.206 - continue;
9.207 - }
9.208 - String fqn = name(instantiateTypeParametersWithUpperBound(type));
9.209 - List<TypeMirror> checkedExceptions = new ArrayList<TypeMirror>();
9.210 - for (TypeMirror exc : ((ExecutableElement) e).getThrownTypes()) {
9.211 - if (types.isSubtype(exc, elements.getTypeElement("java.lang.Exception").asType()) &&
9.212 - !types.isSubtype(exc, elements.getTypeElement("java.lang.RuntimeException").asType())) {
9.213 - checkedExceptions.add(exc);
9.214 - }
9.215 - }
9.216 - if (checkedExceptions.isEmpty()) {
9.217 - emit("new " + fqn + "(" + params + ");");
9.218 - } else {
9.219 - StringBuilder b = new StringBuilder();
9.220 - for (TypeMirror exc : checkedExceptions) {
9.221 - b.append(" catch (");
9.222 - b.append(name(exc));
9.223 - b.append(" _) {}");
9.224 - }
9.225 - emit("try {new " + fqn + "(" + params + ");}" + b);
9.226 - }
9.227 - }
9.228 - }
9.229 -
9.230 - private void processSupertypes(TypeElement type) {
9.231 - String fqn = name(instantiateTypeParametersWithUpperBound(type));
9.232 - for (TypeMirror t : supertypes(type, false, false)) {
9.233 - if (accessible(t)) {
9.234 - emit(name(t) + " _ = (" + fqn + ") null;");
9.235 - }
9.236 - }
9.237 - }
9.238 -
9.239 - private boolean accessible(TypeMirror type) {
9.240 - switch (type.getKind()) {
9.241 - case ERROR:
9.242 - return false;
9.243 - case DECLARED:
9.244 - return ((DeclaredType) type).asElement().getModifiers().contains(Modifier.PUBLIC);
9.245 - case WILDCARD:
9.246 - TypeMirror bound = ((WildcardType) type).getExtendsBound();
9.247 - return bound == null || accessible(bound);
9.248 - case ARRAY:
9.249 - return accessible(((ArrayType) type).getComponentType());
9.250 - case TYPEVAR:
9.251 - return accessible(((TypeVariable) type).getUpperBound());
9.252 - default:
9.253 - return true;
9.254 - }
9.255 - }
9.256 -
9.257 - private String parameters(ExecutableElement e) {
9.258 - StringBuilder b = new StringBuilder();
9.259 - // e.getParameters() does not work for classes read from -g bytecode (cf. JDK bug #6468404)
9.260 - for (TypeMirror type : ((ExecutableType) e.asType()).getParameterTypes()) {
9.261 - if (b.length() > 0) {
9.262 - b.append(", ");
9.263 - }
9.264 - if (!accessible(type)) {
9.265 - return null;
9.266 - }
9.267 - TypeMirror type2 = instantiateTypeParametersWithUpperBound(type);
9.268 - switch (type2.getKind()) {
9.269 - case BOOLEAN:
9.270 - b.append("false");
9.271 - break;
9.272 - case BYTE:
9.273 - b.append("(byte) 0");
9.274 - break;
9.275 - case CHAR:
9.276 - b.append("' '");
9.277 - break;
9.278 - case SHORT:
9.279 - b.append("(short) 0");
9.280 - break;
9.281 - case INT:
9.282 - b.append("0");
9.283 - break;
9.284 - case LONG:
9.285 - b.append("0L");
9.286 - break;
9.287 - case FLOAT:
9.288 - b.append("0.0f");
9.289 - break;
9.290 - case DOUBLE:
9.291 - b.append("0.0d");
9.292 - break;
9.293 - case TYPEVAR:
9.294 - // XXX what if it is an intersection type, e.g. Number & Runnable?
9.295 - // fallthru
9.296 - case DECLARED:
9.297 - case ARRAY:
9.298 - String n = name(type2);
9.299 - if (n.equals("String")) {
9.300 - b.append("\"\"");
9.301 - } else {
9.302 - b.append("(");
9.303 - b.append(n);
9.304 - b.append(") null");
9.305 - }
9.306 - break;
9.307 - default:
9.308 - assert false : type2;
9.309 - }
9.310 - }
9.311 - return b.toString();
9.312 - }
9.313 -
9.314 -}
10.1 --- a/other/signatures/src/org/netbeans/signatures/antlib.xml Thu Jul 21 11:16:26 2011 -0400
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,4 +0,0 @@
10.4 -<?xml version="1.0" encoding="UTF-8"?>
10.5 -<antlib>
10.6 - <taskdef name="signatures" classname="org.netbeans.signatures.SignatureTask"/>
10.7 -</antlib>
11.1 --- a/other/signatures/test/org/netbeans/signatures/ClassScannerTest.java Thu Jul 21 11:16:26 2011 -0400
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,121 +0,0 @@
11.4 -/*
11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
11.6 - *
11.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
11.8 - *
11.9 - * The contents of this file are subject to the terms of either the GNU
11.10 - * General Public License Version 2 only ("GPL") or the Common
11.11 - * Development and Distribution License("CDDL") (collectively, the
11.12 - * "License"). You may not use this file except in compliance with the
11.13 - * License. You can obtain a copy of the License at
11.14 - * http://www.netbeans.org/cddl-gplv2.html
11.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
11.16 - * specific language governing permissions and limitations under the
11.17 - * License. When distributing the software, include this License Header
11.18 - * Notice in each file and include the License file at
11.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
11.20 - * particular file as subject to the "Classpath" exception as provided
11.21 - * by Sun in the GPL Version 2 section of the License file that
11.22 - * accompanied this code. If applicable, add the following below the
11.23 - * License Header, with the fields enclosed by brackets [] replaced by
11.24 - * your own identifying information:
11.25 - * "Portions Copyrighted [year] [name of copyright owner]"
11.26 - *
11.27 - * Contributor(s):
11.28 - *
11.29 - * The Original Software is NetBeans. The Initial Developer of the Original
11.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11.31 - * Microsystems, Inc. All Rights Reserved.
11.32 - *
11.33 - * If you wish your version of this file to be governed by only the CDDL
11.34 - * or only the GPL Version 2, indicate your decision by adding
11.35 - * "[Contributor] elects to include this software in this distribution
11.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
11.37 - * single choice of license, a recipient has the option to distribute
11.38 - * your version of this file under either the CDDL, the GPL Version 2 or
11.39 - * to extend the choice of license to its licensees as provided above.
11.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
11.41 - * Version 2 license, then the option applies only if the new code is
11.42 - * made subject to such option by the copyright holder.
11.43 - */
11.44 -
11.45 -package org.netbeans.signatures;
11.46 -
11.47 -import java.io.File;
11.48 -import java.util.Collection;
11.49 -import java.util.Collections;
11.50 -import junit.framework.TestCase;
11.51 -
11.52 -/**
11.53 - * @author Jesse Glick
11.54 - */
11.55 -public class ClassScannerTest extends TestCase {
11.56 -
11.57 - public ClassScannerTest(String n) {
11.58 - super(n);
11.59 - }
11.60 -
11.61 - private File antJar;
11.62 -
11.63 - protected void setUp() throws Exception {
11.64 - super.setUp();
11.65 - antJar = new File(Class.forName("org.apache.tools.ant.Project").getProtectionDomain().getCodeSource().getLocation().toURI());
11.66 - assertTrue(antJar.getAbsolutePath(), antJar.isFile());
11.67 - }
11.68 -
11.69 - public void testFindPackages() throws Exception {
11.70 - Collection<String> antClasses = ClassScanner.findTopLevelClasses(Collections.singleton(antJar), true, true);
11.71 - //System.out.println(antClasses);
11.72 - assertTrue(antClasses.contains("org.apache.tools.ant.Project"));
11.73 - assertTrue(antClasses.contains("org.apache.tools.ant.filters.TokenFilter$Filter"));
11.74 - /* XXX
11.75 - Collection<String> antModuleClasses = ClassScanner.findTopLevelClasses(Collections.singleton(antModuleJar), true, true);
11.76 - assertFalse(antModuleClasses.contains("org.apache.tools.ant.module.run.StandardLogger"));
11.77 - //System.out.println(antModuleClasses);
11.78 - antModuleClasses = ClassScanner.findTopLevelClasses(Collections.singleton(antModuleJar), false, true);
11.79 - assertTrue(antModuleClasses.contains("org.apache.tools.ant.module.run.StandardLogger"));
11.80 - //System.out.println(antModuleClasses);
11.81 - }
11.82 -
11.83 - public void testClassPathExtensions() throws Exception {
11.84 - Set<File> cp = new HashSet<File>(Collections.singleton(javaHelpJar));
11.85 - Collection<String> c = ClassScanner.findTopLevelClasses(cp, true, true);
11.86 - assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
11.87 - assertFalse(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
11.88 - assertTrue(c.contains("javax.help.HelpSet"));
11.89 - assertTrue(c.contains("javax.help.event.HelpModelEvent"));
11.90 - assertFalse(c.contains("com.sun.java.help.impl.Tag"));
11.91 - assertEquals(2, cp.size());
11.92 - assertTrue(cp.remove(javaHelpJar));
11.93 - assertTrue(cp.iterator().next().getName().startsWith("jh"));
11.94 -
11.95 - cp = new HashSet<File>(Collections.singleton(javaHelpJar));
11.96 - c = ClassScanner.findTopLevelClasses(cp, false, true);
11.97 - assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
11.98 - assertTrue(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
11.99 - assertTrue(c.contains("javax.help.HelpSet"));
11.100 - assertTrue(c.contains("javax.help.event.HelpModelEvent"));
11.101 - assertTrue(c.contains("com.sun.java.help.impl.Tag"));
11.102 - assertEquals(2, cp.size());
11.103 -
11.104 - cp = new HashSet<File>(Collections.singleton(javaHelpJar));
11.105 - c = ClassScanner.findTopLevelClasses(cp, true, false);
11.106 - assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
11.107 - assertFalse(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
11.108 - assertFalse(c.contains("javax.help.HelpSet"));
11.109 - assertFalse(c.contains("javax.help.event.HelpModelEvent"));
11.110 - assertFalse(c.contains("com.sun.java.help.impl.Tag"));
11.111 - assertEquals(1, cp.size());
11.112 -
11.113 - cp = new HashSet<File>(Collections.singleton(javaHelpJar));
11.114 - c = ClassScanner.findTopLevelClasses(cp, false, false);
11.115 - assertTrue(c.contains("org.netbeans.api.javahelp.Help"));
11.116 - assertTrue(c.contains("org.netbeans.modules.javahelp.JavaHelp"));
11.117 - assertFalse(c.contains("javax.help.HelpSet"));
11.118 - assertFalse(c.contains("javax.help.event.HelpModelEvent"));
11.119 - assertFalse(c.contains("com.sun.java.help.impl.Tag"));
11.120 - assertEquals(1, cp.size());
11.121 - */
11.122 - }
11.123 -
11.124 -}
12.1 --- a/other/signatures/test/org/netbeans/signatures/LoaderTest.java Thu Jul 21 11:16:26 2011 -0400
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,78 +0,0 @@
12.4 -/*
12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.6 - *
12.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
12.8 - *
12.9 - * The contents of this file are subject to the terms of either the GNU
12.10 - * General Public License Version 2 only ("GPL") or the Common
12.11 - * Development and Distribution License("CDDL") (collectively, the
12.12 - * "License"). You may not use this file except in compliance with the
12.13 - * License. You can obtain a copy of the License at
12.14 - * http://www.netbeans.org/cddl-gplv2.html
12.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.16 - * specific language governing permissions and limitations under the
12.17 - * License. When distributing the software, include this License Header
12.18 - * Notice in each file and include the License file at
12.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
12.20 - * particular file as subject to the "Classpath" exception as provided
12.21 - * by Sun in the GPL Version 2 section of the License file that
12.22 - * accompanied this code. If applicable, add the following below the
12.23 - * License Header, with the fields enclosed by brackets [] replaced by
12.24 - * your own identifying information:
12.25 - * "Portions Copyrighted [year] [name of copyright owner]"
12.26 - *
12.27 - * Contributor(s):
12.28 - *
12.29 - * The Original Software is NetBeans. The Initial Developer of the Original
12.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
12.31 - * Microsystems, Inc. All Rights Reserved.
12.32 - *
12.33 - * If you wish your version of this file to be governed by only the CDDL
12.34 - * or only the GPL Version 2, indicate your decision by adding
12.35 - * "[Contributor] elects to include this software in this distribution
12.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
12.37 - * single choice of license, a recipient has the option to distribute
12.38 - * your version of this file under either the CDDL, the GPL Version 2 or
12.39 - * to extend the choice of license to its licensees as provided above.
12.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
12.41 - * Version 2 license, then the option applies only if the new code is
12.42 - * made subject to such option by the copyright holder.
12.43 - */
12.44 -
12.45 -package org.netbeans.signatures;
12.46 -
12.47 -import java.io.File;
12.48 -import java.util.Collections;
12.49 -import javax.lang.model.element.TypeElement;
12.50 -import junit.framework.TestCase;
12.51 -
12.52 -/**
12.53 - * @author Jesse Glick
12.54 - */
12.55 -public class LoaderTest extends TestCase {
12.56 -
12.57 - public LoaderTest(String n) {
12.58 - super(n);
12.59 - }
12.60 -
12.61 - private File antJar;
12.62 -
12.63 - protected void setUp() throws Exception {
12.64 - super.setUp();
12.65 - antJar = new File(Class.forName("org.apache.tools.ant.Project").getProtectionDomain().getCodeSource().getLocation().toURI());
12.66 - assertTrue(antJar.getAbsolutePath(), antJar.isFile());
12.67 - }
12.68 -
12.69 - public void testBasicUsage() throws Exception {
12.70 - new Loader(Collections.singleton(antJar)) {
12.71 - protected void run() {
12.72 - TypeElement set = elements().getTypeElement("java.util.Set");
12.73 - assertEquals("java.util.Set", set.getQualifiedName().toString());
12.74 - assertEquals(1, set.getTypeParameters().size());
12.75 - TypeElement prj = elements().getTypeElement("org.apache.tools.ant.Project");
12.76 - assertNotNull(prj);
12.77 - }
12.78 - };
12.79 - }
12.80 -
12.81 -}
13.1 --- a/other/signatures/test/org/netbeans/signatures/SignatureTaskTest.java Thu Jul 21 11:16:26 2011 -0400
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,130 +0,0 @@
13.4 -/*
13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.6 - *
13.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
13.8 - *
13.9 - * The contents of this file are subject to the terms of either the GNU
13.10 - * General Public License Version 2 only ("GPL") or the Common
13.11 - * Development and Distribution License("CDDL") (collectively, the
13.12 - * "License"). You may not use this file except in compliance with the
13.13 - * License. You can obtain a copy of the License at
13.14 - * http://www.netbeans.org/cddl-gplv2.html
13.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.16 - * specific language governing permissions and limitations under the
13.17 - * License. When distributing the software, include this License Header
13.18 - * Notice in each file and include the License file at
13.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
13.20 - * particular file as subject to the "Classpath" exception as provided
13.21 - * by Sun in the GPL Version 2 section of the License file that
13.22 - * accompanied this code. If applicable, add the following below the
13.23 - * License Header, with the fields enclosed by brackets [] replaced by
13.24 - * your own identifying information:
13.25 - * "Portions Copyrighted [year] [name of copyright owner]"
13.26 - *
13.27 - * Contributor(s):
13.28 - *
13.29 - * The Original Software is NetBeans. The Initial Developer of the Original
13.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
13.31 - * Microsystems, Inc. All Rights Reserved.
13.32 - *
13.33 - * If you wish your version of this file to be governed by only the CDDL
13.34 - * or only the GPL Version 2, indicate your decision by adding
13.35 - * "[Contributor] elects to include this software in this distribution
13.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
13.37 - * single choice of license, a recipient has the option to distribute
13.38 - * your version of this file under either the CDDL, the GPL Version 2 or
13.39 - * to extend the choice of license to its licensees as provided above.
13.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
13.41 - * Version 2 license, then the option applies only if the new code is
13.42 - * made subject to such option by the copyright holder.
13.43 - */
13.44 -
13.45 -package org.netbeans.signatures;
13.46 -
13.47 -import java.io.BufferedReader;
13.48 -import java.io.File;
13.49 -import java.io.FileReader;
13.50 -import java.io.Reader;
13.51 -import junit.framework.TestCase;
13.52 -import org.apache.tools.ant.BuildEvent;
13.53 -import org.apache.tools.ant.BuildListener;
13.54 -import org.apache.tools.ant.Project;
13.55 -import org.apache.tools.ant.types.FileSet;
13.56 -
13.57 -/**
13.58 - * @author Jesse Glick
13.59 - */
13.60 -public class SignatureTaskTest extends TestCase {
13.61 -
13.62 - public SignatureTaskTest(String n) {
13.63 - super(n);
13.64 - }
13.65 -
13.66 - private File antJar;
13.67 - private File antLauncherJar;
13.68 -
13.69 - protected void setUp() throws Exception {
13.70 - super.setUp();
13.71 - antJar = new File(Class.forName("org.apache.tools.ant.Project").getProtectionDomain().getCodeSource().getLocation().toURI());
13.72 - assertTrue(antJar.getAbsolutePath(), antJar.isFile());
13.73 - antLauncherJar = new File(antJar.getParentFile(), "ant-launcher.jar");
13.74 - assertTrue(antLauncherJar.getAbsolutePath(), antLauncherJar.isFile());
13.75 - }
13.76 -
13.77 - public void testExecuteAnt() throws Exception {
13.78 - Project p = new Project();
13.79 - p.addBuildListener(new Listener());
13.80 - SignatureTask task = new SignatureTask();
13.81 - task.setProject(p);
13.82 - File out = File.createTempFile("signatures", ".java");
13.83 - task.setOut(out);
13.84 - FileSet fs = new FileSet();
13.85 - fs.setProject(p);
13.86 - fs.setFile(antJar);
13.87 - task.addFileSet(fs);
13.88 - fs = new FileSet();
13.89 - fs.setProject(p);
13.90 - fs.setFile(antLauncherJar);
13.91 - task.addFileSet(fs);
13.92 - task.execute();
13.93 - assertTrue(out.isFile());
13.94 - Reader r = new FileReader(out);
13.95 - try {
13.96 - BufferedReader b = new BufferedReader(r);
13.97 - while (true) {
13.98 - String l = b.readLine();
13.99 - assertNotNull("found matching line in " + out, l);
13.100 - if (l.equals("{Class _ = org.apache.tools.ant.Task.class;}")) {
13.101 - break;
13.102 - }
13.103 - }
13.104 - } finally {
13.105 - r.close();
13.106 - }
13.107 - }
13.108 -
13.109 - private static final class Listener implements BuildListener {
13.110 -
13.111 - Listener() {}
13.112 -
13.113 - public void buildStarted(BuildEvent event) {}
13.114 -
13.115 - public void buildFinished(BuildEvent event) {}
13.116 -
13.117 - public void targetStarted(BuildEvent event) {}
13.118 -
13.119 - public void targetFinished(BuildEvent event) {}
13.120 -
13.121 - public void taskStarted(BuildEvent event) {}
13.122 -
13.123 - public void taskFinished(BuildEvent event) {}
13.124 -
13.125 - public void messageLogged(BuildEvent event) {
13.126 - if (event.getPriority() <= Project.MSG_INFO) {
13.127 - System.err.println(event.getMessage());
13.128 - }
13.129 - }
13.130 -
13.131 - }
13.132 -
13.133 -}
14.1 --- a/other/signatures/test/org/netbeans/signatures/SignatureWriterTest.java Thu Jul 21 11:16:26 2011 -0400
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,372 +0,0 @@
14.4 -/*
14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.6 - *
14.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
14.8 - *
14.9 - * The contents of this file are subject to the terms of either the GNU
14.10 - * General Public License Version 2 only ("GPL") or the Common
14.11 - * Development and Distribution License("CDDL") (collectively, the
14.12 - * "License"). You may not use this file except in compliance with the
14.13 - * License. You can obtain a copy of the License at
14.14 - * http://www.netbeans.org/cddl-gplv2.html
14.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.16 - * specific language governing permissions and limitations under the
14.17 - * License. When distributing the software, include this License Header
14.18 - * Notice in each file and include the License file at
14.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
14.20 - * particular file as subject to the "Classpath" exception as provided
14.21 - * by Sun in the GPL Version 2 section of the License file that
14.22 - * accompanied this code. If applicable, add the following below the
14.23 - * License Header, with the fields enclosed by brackets [] replaced by
14.24 - * your own identifying information:
14.25 - * "Portions Copyrighted [year] [name of copyright owner]"
14.26 - *
14.27 - * Contributor(s):
14.28 - *
14.29 - * The Original Software is NetBeans. The Initial Developer of the Original
14.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
14.31 - * Microsystems, Inc. All Rights Reserved.
14.32 - *
14.33 - * If you wish your version of this file to be governed by only the CDDL
14.34 - * or only the GPL Version 2, indicate your decision by adding
14.35 - * "[Contributor] elects to include this software in this distribution
14.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
14.37 - * single choice of license, a recipient has the option to distribute
14.38 - * your version of this file under either the CDDL, the GPL Version 2 or
14.39 - * to extend the choice of license to its licensees as provided above.
14.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
14.41 - * Version 2 license, then the option applies only if the new code is
14.42 - * made subject to such option by the copyright holder.
14.43 - */
14.44 -
14.45 -package org.netbeans.signatures;
14.46 -
14.47 -import java.io.File;
14.48 -import java.io.IOException;
14.49 -import java.io.PrintWriter;
14.50 -import java.io.StringWriter;
14.51 -import java.io.Writer;
14.52 -import java.net.URI;
14.53 -import java.util.ArrayList;
14.54 -import java.util.Arrays;
14.55 -import java.util.Collections;
14.56 -import java.util.List;
14.57 -import java.util.Set;
14.58 -import java.util.SortedSet;
14.59 -import java.util.TreeSet;
14.60 -import java.util.regex.Matcher;
14.61 -import java.util.regex.Pattern;
14.62 -import javax.annotation.processing.AbstractProcessor;
14.63 -import javax.annotation.processing.RoundEnvironment;
14.64 -import javax.annotation.processing.SupportedAnnotationTypes;
14.65 -import javax.annotation.processing.SupportedSourceVersion;
14.66 -import javax.lang.model.SourceVersion;
14.67 -import javax.lang.model.element.TypeElement;
14.68 -import javax.tools.JavaCompiler;
14.69 -import javax.tools.JavaFileObject;
14.70 -import javax.tools.SimpleJavaFileObject;
14.71 -import javax.tools.ToolProvider;
14.72 -import junit.framework.TestCase;
14.73 -
14.74 -/**
14.75 - * @author Jesse Glick
14.76 - */
14.77 -public class SignatureWriterTest extends TestCase {
14.78 -
14.79 - public SignatureWriterTest(String n) {
14.80 - super(n);
14.81 - }
14.82 -
14.83 - public void testBasicClass() {
14.84 - assertEmitted("package p; class X {}", "p.X", "");
14.85 - }
14.86 -
14.87 - public void testConstructors() {
14.88 - assertEmitted("package p; public final class X {private X() {}}",
14.89 - "p.X",
14.90 - "Class _ = p.X.class;");
14.91 - assertEmitted("package p; public class X {private X() {}}",
14.92 - "p.X",
14.93 - "Class _ = p.X.class;");
14.94 - assertEmitted("package p; public final class X {public X() {}}",
14.95 - "p.X",
14.96 - "Class _ = p.X.class; " +
14.97 - "new p.X();");
14.98 - assertEmitted("package p; public final class X {}",
14.99 - "p.X",
14.100 - "Class _ = p.X.class; " +
14.101 - "new p.X();");
14.102 - assertEmitted("package p; public final class X {public X() {} public X(int x, String y, int[] z, java.util.Set<String> w) {}}",
14.103 - "p.X",
14.104 - "Class _ = p.X.class; " +
14.105 - "new p.X(); " +
14.106 - "new p.X(0, \"\", (int[]) null, (java.util.Set<String>) null);");
14.107 - assertEmitted("package p; public class S {} package p; public final class X extends S {}",
14.108 - "p.X",
14.109 - "Class _ = p.X.class; " +
14.110 - "p.S _ = (p.X) null; " +
14.111 - "new p.X();");
14.112 - assertEmitted("package p; public class S<T> {} package p; public final class X<T> extends S<T> {public X() {} public X(T x) {}}",
14.113 - "p.X",
14.114 - "Class _ = p.X.class; " +
14.115 - "p.S<Object> _ = (p.X<Object>) null; " +
14.116 - "new p.X<Object>(); " +
14.117 - "new p.X<Object>((Object) null);");
14.118 - assertEmitted("package p; public class S<T> {} package p; public final class X extends S<String> {}",
14.119 - "p.X",
14.120 - "Class _ = p.X.class; " +
14.121 - "p.S<String> _ = (p.X) null; " +
14.122 - "new p.X();");
14.123 - assertEmitted("package p; public abstract class X {}",
14.124 - "p.X",
14.125 - "Class _ = p.X.class;");
14.126 - assertEmitted("package p; class S {} package p; public final class X extends S {}",
14.127 - "p.X",
14.128 - "Class _ = p.X.class; " +
14.129 - "new p.X();");
14.130 - assertEmitted("package p; public final class X {public X(char c) throws ClassNotFoundException, java.io.IOException, IllegalArgumentException {}}",
14.131 - "p.X",
14.132 - "Class _ = p.X.class; " +
14.133 - "try {new p.X(' ');} catch (ClassNotFoundException _) {} catch (java.io.IOException _) {}");
14.134 - assertEmitted("package p; public final class X {public X(java.lang.reflect.Method m) {}}",
14.135 - "p.X",
14.136 - "Class _ = p.X.class; " +
14.137 - "new p.X((java.lang.reflect.Method) null);");
14.138 - assertEmitted("package p; class Hidden {} package p; public final class X {public X(Hidden h) {}}",
14.139 - "p.X",
14.140 - "Class _ = p.X.class;");
14.141 - assertEmitted("package p; public final class X {public <T> X(T t, Class<T> c) {}}",
14.142 - "p.X",
14.143 - "Class _ = p.X.class; " +
14.144 - "new p.X((Object) null, (Class<Object>) null);");
14.145 - assertEmitted("package p; public final class X {public X(String s1, java.util.List<String> l, String s2, String s3) {}}",
14.146 - "p.X",
14.147 - "Class _ = p.X.class; " +
14.148 - "new p.X(\"\", (java.util.List<String>) null, \"\", \"\");");
14.149 - assertEmitted("package p; public final class X<T> {public X(java.util.List<? extends T> l) {}}",
14.150 - "p.X",
14.151 - "Class _ = p.X.class; " +
14.152 - "new p.X<Object>((java.util.List<Object>) null);");
14.153 - assertEmitted("package p; public final class X<T extends Number> {public X(java.util.List<? extends T> l) {}}",
14.154 - "p.X",
14.155 - "Class _ = p.X.class; " +
14.156 - "new p.X<Number>((java.util.List<Number>) null);");
14.157 - assertEmitted("package p; public final class X {public X(String s) {} public <T> X(T t) {}}",
14.158 - "p.X",
14.159 - "Class _ = p.X.class; " +
14.160 - // XXX first call is ambiguous, both constructors match!
14.161 - // Take example from javax.management.openmbean.OpenMBeanAttributeInfoSupport
14.162 - "new p.X(\"\"); " +
14.163 - "new p.X((Object) null);");
14.164 - }
14.165 -
14.166 - private static void assertEmitted(String source, String clazz, String sig) {
14.167 - // First compile the test sources.
14.168 - //MemoryOutputFileManager mgr = new MemoryOutputFileManager();
14.169 - // XXX would be better to compile to memory, but cannot get it to work.
14.170 - File dir = new File(System.getProperty("java.io.tmpdir"));
14.171 - List<JavaFileObject> compUnits = new ArrayList<JavaFileObject>();
14.172 - for (final String chunk : source.split("(?!^)(?=package [a-z.]+;)")) {
14.173 - //System.err.println("Got: " + chunk);
14.174 - Matcher m = Pattern.compile("package ([a-z.]+); [a-z ]*(class|enum|interface|@interface) ([a-zA-Z0-9_]+).*").matcher(chunk);
14.175 - assertTrue(chunk, m.matches());
14.176 - String path = m.group(1).replace('.', '/') + "/" + m.group(3) + ".java";
14.177 - //System.err.println("with path: " + path);
14.178 - //compunits.add(mgr.store(path, chunk));
14.179 - compUnits.add(new SimpleJavaFileObject(URI.create("nowhere:/" + path), JavaFileObject.Kind.SOURCE) {
14.180 - public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
14.181 - return chunk;
14.182 - }
14.183 - });
14.184 - }
14.185 - StringWriter err = new StringWriter();
14.186 - JavaCompiler.CompilationTask task = ToolProvider.getSystemJavaCompiler().getTask(
14.187 - err,
14.188 - null,
14.189 - null,
14.190 - Arrays.asList("-source", "1.6", "-d", dir.getAbsolutePath(), /* exercise JDK bug #6468404 */"-g"),
14.191 - null,
14.192 - compUnits);
14.193 - boolean ok = task.call();
14.194 - String errors = cleanup(err);
14.195 - assertTrue(errors, ok);
14.196 - assertEquals(errors, 0, errors.length());
14.197 - // Now compile a dummy class so we can run the processor.
14.198 - task = ToolProvider.getSystemJavaCompiler().getTask(
14.199 - err,
14.200 - Loader.nullOutputFileManager(),
14.201 - null,
14.202 - Arrays.asList("-source", "1.6", "-classpath", dir.getAbsolutePath()),
14.203 - null,
14.204 - Collections.singleton(Loader.dummyCompilationUnit()));
14.205 - StringWriter result = new StringWriter();
14.206 - task.setProcessors(Collections.singleton(new P(result, clazz)));
14.207 - ok = task.call();
14.208 - // XXX could now delete the .class files in dir
14.209 - errors = cleanup(err);
14.210 - assertTrue(errors, ok);
14.211 - assertEquals(errors, 0, errors.length());
14.212 - SortedSet<String> lines = new TreeSet<String>(Arrays.asList(sig.split(" ")));
14.213 - StringBuilder b = new StringBuilder();
14.214 - for (String line : lines) {
14.215 - if (b.length() > 0) {
14.216 - b.append(" ");
14.217 - }
14.218 - b.append(line);
14.219 - }
14.220 - assertEquals(source, b.toString(), result.toString().replaceAll("^\\{", "").replaceAll("\\}\n\n$", "").replaceAll("\\}\n\\{", " "));
14.221 - // XXX check that sig is compilable, too
14.222 - }
14.223 -
14.224 - private static String cleanup(StringWriter err) {
14.225 - return err.toString().replaceAll("warning: .options. bootstrap class path not set in conjunction with -source 1[.]6\r?\n?|\\d+ warnings?\r?\n?", "");
14.226 - }
14.227 -
14.228 - /* Just does not work, not obvious why. Never writes out a .class file.
14.229 - private static final class MemoryOutputFileManager extends ForwardingJavaFileManager<JavaFileManager> {
14.230 -
14.231 - final Map<String,String> data = new HashMap<String,String>();
14.232 -
14.233 - public MemoryOutputFileManager() {
14.234 - super(ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null));
14.235 - }
14.236 -
14.237 - public JavaFileObject store(String path, String contents) {
14.238 - data.put(path, contents);
14.239 - return new FO(path, null);
14.240 - }
14.241 -
14.242 - public JavaFileObject getJavaFileForInput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind) throws IOException {
14.243 - String path = className.replace('.', '/') + ".java";
14.244 - if (data.containsKey(path)) {
14.245 - return new FO(path, kind);
14.246 - } else {
14.247 - return super.getJavaFileForInput(location, className, kind);
14.248 - }
14.249 - }
14.250 -
14.251 - public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException {
14.252 - return new FO(className.replace('.', '/') + ".java", kind);
14.253 - }
14.254 -
14.255 - public FileObject getFileForInput(JavaFileManager.Location location, String packageName, String relativeName) throws IOException {
14.256 - String path = packageName.replace('.', '/') + "/" + relativeName;
14.257 - if (data.containsKey(path)) {
14.258 - return new FO(path, null);
14.259 - } else {
14.260 - return super.getFileForInput(location, packageName, relativeName);
14.261 - }
14.262 - }
14.263 -
14.264 - public FileObject getFileForOutput(JavaFileManager.Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
14.265 - return new FO(packageName.replace('.', '/') + "/" + relativeName, null);
14.266 - }
14.267 -
14.268 - public Iterable<JavaFileObject> list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException {
14.269 - List<JavaFileObject> files = new ArrayList<JavaFileObject>();
14.270 - for (JavaFileObject f : super.list(location, packageName, kinds, recurse)) {
14.271 - files.add(f);
14.272 - }
14.273 - for (Map.Entry<String,String> entry : data.entrySet()) {
14.274 - String path = entry.getKey();
14.275 - if (path.startsWith(packageName.replace('.', '/') + "/") && kinds.contains(kindFor(path))) {
14.276 - files.add(new FO(path, null));
14.277 - }
14.278 - }
14.279 - System.err.println("XXX list: " + location + " " + packageName + " " + kinds + " " + recurse + " -> " + files);
14.280 - return files;
14.281 - }
14.282 -
14.283 - public boolean hasLocation(JavaFileManager.Location location) {
14.284 - return true;
14.285 - / *
14.286 - boolean retValue;
14.287 -
14.288 - retValue = super.hasLocation(location);
14.289 - System.err.println("XXX hasLocation " + location + " -> " + retValue);
14.290 - return retValue;
14.291 - * /
14.292 - }
14.293 -
14.294 - private JavaFileObject.Kind kindFor(String path) {
14.295 - if (path.endsWith(".java")) {
14.296 - return JavaFileObject.Kind.SOURCE;
14.297 - } else if (path.endsWith(".class")) {
14.298 - return JavaFileObject.Kind.CLASS;
14.299 - } else {
14.300 - return JavaFileObject.Kind.OTHER;
14.301 - }
14.302 - }
14.303 -
14.304 - public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file) {
14.305 - if (file instanceof FO) {
14.306 - return file.getName().replaceFirst("\\.[^/.]+$", "").replace('/', '.');
14.307 - } else {
14.308 - return super.inferBinaryName(location, file);
14.309 - }
14.310 - }
14.311 -
14.312 - private class FO extends SimpleJavaFileObject {
14.313 -
14.314 - public FO(String path, JavaFileObject.Kind kind) {
14.315 - super(URI.create("mem:/" + path), kind != null ? kind : kindFor(path));
14.316 - System.err.println("XXX made FO for " + uri + " " + kind);
14.317 - }
14.318 -
14.319 - public InputStream openInputStream() throws IOException {
14.320 - return new ByteArrayInputStream(data.get(getName()).getBytes("UTF-8"));
14.321 - }
14.322 -
14.323 - public OutputStream openOutputStream() throws IOException {
14.324 - return new ByteArrayOutputStream() {
14.325 - public void close() throws IOException {
14.326 - super.close();
14.327 - data.put(getName(), toString("UTF-8"));
14.328 - }
14.329 - };
14.330 - }
14.331 -
14.332 - public Writer openWriter() throws IOException {
14.333 - return new StringWriter() {
14.334 - public void close() throws IOException {
14.335 - super.close();
14.336 - data.put(getName(), toString());
14.337 - }
14.338 - };
14.339 - }
14.340 -
14.341 - public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
14.342 - return data.get(getName());
14.343 - }
14.344 -
14.345 - }
14.346 -
14.347 - }
14.348 - */
14.349 -
14.350 - @SupportedAnnotationTypes("*")
14.351 - @SupportedSourceVersion(SourceVersion.RELEASE_6)
14.352 - private static final class P extends AbstractProcessor {
14.353 -
14.354 - private final Writer w;
14.355 - private final String clazz;
14.356 - private boolean ran = false;
14.357 -
14.358 - P(Writer w, String clazz) {
14.359 - this.w = w;
14.360 - this.clazz = clazz;
14.361 - }
14.362 -
14.363 - public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
14.364 - if (!ran) {
14.365 - ran = true;
14.366 - } else {
14.367 - return true;
14.368 - }
14.369 - new SignatureWriter(new PrintWriter(w), processingEnv.getElementUtils(), processingEnv.getTypeUtils()).process(clazz);
14.370 - return true;
14.371 - }
14.372 -
14.373 - }
14.374 -
14.375 -}