build.xml revision c084b1b18556ad5cc865212ee5005e89455b30b7
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoCDDL HEADER START
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoThe contents of this file are subject to the terms of the
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders HatlenCommon Development and Distribution License (the "License").
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoYou may not use this file except in compliance with the License.
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoSee LICENSE.txt included in this distribution for the specific
30d2f45dd260208f0fb882dde134a249318524b9Lubos Koscolanguage governing permissions and limitations under the License.
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoWhen distributing Covered Code, include this CDDL HEADER in each
30d2f45dd260208f0fb882dde134a249318524b9Lubos Koscofile and include the License file at LICENSE.txt.
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoIf applicable, add the following below this CDDL HEADER, with the
30d2f45dd260208f0fb882dde134a249318524b9Lubos Koscofields enclosed by brackets "[]" replaced with your own identifying
30d2f45dd260208f0fb882dde134a249318524b9Lubos Koscoinformation: Portions Copyright [yyyy] [name of copyright owner]
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoCDDL HEADER END
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoCopyright 2007 Sun Microsystems, Inc. All rights reserved.
30d2f45dd260208f0fb882dde134a249318524b9Lubos KoscoUse is subject to license terms.
30d2f45dd260208f0fb882dde134a249318524b9Lubos Kosco<project name="OpenGrok" default="jar" basedir=".">
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner <description>Builds, tests, and runs the project opengrok.</description>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner <import file="nbproject/profiler-build-impl.xml"/> <!--
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner There exist several targets which are by default empty and which can be
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner used for execution of your tasks. These targets are usually executed
d2b27f3d647af6fca607f14cb9296cc61c64b5b7Knut Anders Hatlen before and after some main targets. They are:
d2b27f3d647af6fca607f14cb9296cc61c64b5b7Knut Anders Hatlen -pre-init: called before initialization of project properties
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner -post-init: called after initialization of project properties
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner -pre-compile: called before javac compilation
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner -post-compile: called after javac compilation
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -pre-compile-single: called before javac compilation of single file
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner -post-compile-single: called after javac compilation of single file
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -pre-compile-test: called before javac compilation of JUnit tests
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner -post-compile-test: called after javac compilation of JUnit tests
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -pre-compile-test-single: called before javac compilation of single JUnit test
a3b788c055cf0bcc9b1d31fcd37876fe04472ebeLubos Kosco -post-compile-test-single: called after javac compilation of single JUunit test
a3b788c055cf0bcc9b1d31fcd37876fe04472ebeLubos Kosco -pre-jar: called before JAR building
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -post-jar: called after JAR building
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -post-clean: called after cleaning build products
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen (Targets beginning with '-' are not intended to be called on their own.)
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Example of inserting an obfuscator after compilation could look like this:
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <target name="-post-compile">
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <fileset dir="${build.classes.dir}"/>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen For list of available properties check the imported
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Another way to customize the build is by overriding existing main targets.
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen The targets of interest are:
30d2f45dd260208f0fb882dde134a249318524b9Lubos Kosco -init-macrodef-javac: defines macro for javac compilation
30d2f45dd260208f0fb882dde134a249318524b9Lubos Kosco -init-macrodef-junit: defines macro for junit execution
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -init-macrodef-debug: defines macro for class debugging
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -init-macrodef-java: defines macro for class execution
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -do-jar-with-manifest: JAR building (if you are using a manifest)
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -do-jar-without-manifest: JAR building (if you are not using a manifest)
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner run: execution of project
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen -javadoc-build: Javadoc generation
30d2f45dd260208f0fb882dde134a249318524b9Lubos Kosco test-report: JUnit report generation
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner An example of overriding the target for project execution could look like this:
5f48c9d7604b81d6840032692d7b0fdd74976343Lubos Kosco <target name="run" depends="opengrok-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
nbproject/build-impl.xml file.
<fail unless="JFlex.present" message="Please download JFlex(http://jflex.de/) and put JFlex.jar it into /lib directory(or in ant classpath)."/>
<jflex file="src/org/opensolaris/opengrok/analysis/java/JavaSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/lisp/LispSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/tcl/TclSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainFullTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/plain/PlainSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/document/TroffFullTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/analysis/sh/ShSymbolTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/search/context/HistoryLineTokenizer.lex" destdir="${gensrcdir}"/>
<jflex file="src/org/opensolaris/opengrok/search/context/PlainLineTokenizer.lex" destdir="${gensrcdir}"/>
file="${build.classes.dir}/org/opensolaris/opengrok/info.properties">
Create an empty manifest file so that nbproject/build-impl.xml
opengrok.jar depends
unless="manifest.available+main.class+mkdist.available">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="lib/findbugs/lib/findbugs-ant.jar"/>
<findbugs projectname="OpenGrok" home="lib/findbugs" output="html" excludeFilter="tools/findbugs_filter.xml" outputFile="findbugs/findbugs.html" jvmargs="-Xmx512m">
<target name="emma-instrument" depends ="compile" description="Instruments the source code for Emma code coverage analysis">
metadatafile="${coverage.dir}/coverage.em"
filter="+org.opensolaris.*"/>