1 <?xml version="1.0" encoding="UTF-8"?>
   2 <!-- You may freely edit this file. See commented blocks below for -->
   3 <!-- some examples of how to customize the build. -->
   4 <!-- (If you delete it and reopen the project it will be recreated.) -->
   5 <!-- By default, only the Clean and Build commands use this build script. -->
   6 <!-- Commands such as Run, Debug, and Test only use this build script if -->
   7 <!-- the Compile on Save feature is turned off for the project. -->
   8 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
   9 <!-- in the project's Project Properties dialog box.-->
  10 <project name="Ensemble8" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
  11     <description>Builds, tests, and runs the project Ensemble8.</description>
  12     <import file="nbproject/build-impl.xml"/>
  13     <!--
  14 
  15     There exist several targets which are by default empty and which can be 
  16     used for execution of your tasks. These targets are usually executed 
  17     before and after some main targets. They are: 
  18 
  19       -pre-init:                 called before initialization of project properties
  20       -post-init:                called after initialization of project properties
  21       -pre-compile:              called before javac compilation
  22       -post-compile:             called after javac compilation
  23       -pre-compile-single:       called before javac compilation of single file
  24       -post-compile-single:      called after javac compilation of single file
  25       -pre-compile-test:         called before javac compilation of JUnit tests
  26       -post-compile-test:        called after javac compilation of JUnit tests
  27       -pre-compile-test-single:  called before javac compilation of single JUnit test
  28       -post-compile-test-single: called after javac compilation of single JUunit test
  29       -pre-jar:                  called before JAR building
  30       -post-jar:                 called after JAR building
  31       -post-clean:               called after cleaning build products
  32 
  33     (Targets beginning with '-' are not intended to be called on their own.)
  34 
  35     Example of inserting an obfuscator after compilation could look like this:
  36 
  37         <target name="-post-compile">
  38             <obfuscate>
  39                 <fileset dir="${build.classes.dir}"/>
  40             </obfuscate>
  41         </target>
  42 
  43     For list of available properties check the imported 
  44     nbproject/build-impl.xml file. 
  45 
  46 
  47     Another way to customize the build is by overriding existing main targets.
  48     The targets of interest are: 
  49 
  50       -init-macrodef-javac:     defines macro for javac compilation
  51       -init-macrodef-junit:     defines macro for junit execution
  52       -init-macrodef-debug:     defines macro for class debugging
  53       -init-macrodef-java:      defines macro for class execution
  54       -do-jar-with-manifest:    JAR building (if you are using a manifest)
  55       -do-jar-without-manifest: JAR building (if you are not using a manifest)
  56       run:                      execution of project 
  57       -javadoc-build:           Javadoc generation
  58       test-report:              JUnit report generation
  59 
  60     An example of overriding the target for project execution could look like this:
  61 
  62         <target name="run" depends="Ensemble8-impl.jar">
  63             <exec dir="bin" executable="launcher.exe">
  64                 <arg file="${dist.jar}"/>
  65             </exec>
  66         </target>
  67 
  68     Notice that the overridden target depends on the jar target and not only on 
  69     the compile target as the regular run target does. Again, for a list of available 
  70     properties which you can use, check the target you are overriding in the
  71     nbproject/build-impl.xml file. 
  72 
  73     -->
  74     <target name="-pre-init">
  75         <!-- exclude samples that are not part of the base JavaFX -->
  76         <condition property="excludes" value="ensemble/samples/language/swing/**">
  77             <isset property="JFX_CORE_ONLY"/>
  78         </condition>
  79     </target>
  80 
  81     <!-- COPY SAMPLE SRC TO BUILD DIR -->
  82     <target name="-pre-compile" depends="-copy-cssref,-copy-legal">
  83         <echo>Copying all sample source files to build dir</echo>
  84          <copy todir="${build.classes.dir}">
  85             <fileset dir="${basedir}/src/samples/java">
  86                 <include name="**/samples/**/*.java"/>
  87                 <include name="**/*.js"/> <!-- include javascript files -->
  88             </fileset>
  89         </copy>
  90     </target>
  91 
  92     <property name="javafx.scene.doc-files.dir" location="${basedir}/../../../modules/javafx.graphics/src/main/docs/javafx/scene/doc-files"/>
  93     <condition property="javafx.scene.doc-files.exists">
  94         <available file="${javafx.scene.doc-files.dir}" type="dir"/>
  95     </condition>
  96 
  97     <target name="-copy-cssref" if="javafx.scene.doc-files.exists">
  98         <mkdir dir="${build.cssref.dir}"/>
  99         <copy todir="${build.cssref.dir}">
 100                 <fileset dir="${javafx.scene.doc-files.dir}">
 101                         <include name="cssref.html"/>
 102                         <include name="cssexample1.png"/>
 103                         <include name="cssexample2.png"/>
 104                         <include name="fx_code_header.jpg"/>
 105                 </fileset>
 106         </copy>
 107         <replaceregexp
 108                 file="${build.cssref.dir}/cssref.html"
 109                 match="http://download.java.net/java/jdk9/docs/legal/cpyr.html"
 110                 replace="http://www.oracle.com/technetwork/java/javase/terms/license/oraclebsd-1603217.txt"
 111                 byline="true"/>
 112     </target>
 113 
 114     <target name="-copy-legal">
 115         <mkdir dir="${build.legal.dir}"/>
 116         <copy todir="${build.legal.dir}">
 117                 <fileset dir="${legal.dir}"/>
 118         </copy>
 119     </target>
 120 
 121     <!-- DON'T INCLUDE COMPILE TIME CODE IN APP JAR -->
 122     <target name="-pre-jar">
 123         <delete dir="${build.classes.dir}/ensemble/compiletime"/>
 124     </target>
 125 
 126     <!-- COPY LIBS INTO JAR FILE: so that we have a simple single jar application -->
 127     <target name="-post-jar">
 128         <zip destfile="${dist.jar}" update="true">
 129             <!-- Rename license and notice file -->
 130             <mappedresources>
 131                 <zipfileset src="${file.reference.lucene-core-7.1.0.jar}">
 132                     <include name="META-INF/LICENSE.txt"/>
 133                 </zipfileset>
 134                 <globmapper from="*/LICENSE.txt" to="*/LUCENE_LICENSE.TXT" />
 135             </mappedresources>
 136             <mappedresources>
 137                 <zipfileset src="${file.reference.lucene-core-7.1.0.jar}">
 138                     <include name="META-INF/NOTICE.txt"/>
 139                 </zipfileset>
 140                 <globmapper from="*/NOTICE.txt" to="*/LUCENE_NOTICE.TXT" />
 141             </mappedresources>
 142 
 143             <!-- Include the core SPI services -->
 144             <zipfileset src="${file.reference.lucene-core-7.1.0.jar}">
 145                 <include name="META-INF/services/**"/>
 146             </zipfileset>
 147 
 148             <zipfileset src="${file.reference.lucene-core-7.1.0.jar}">
 149                 <exclude name="META-INF/**"/>
 150             </zipfileset>
 151             <zipfileset src="${file.reference.lucene-grouping-7.1.0.jar}">
 152                 <exclude name="META-INF/**"/>
 153             </zipfileset>
 154             <zipfileset src="${file.reference.lucene-queryparser-7.1.0.jar}">
 155                 <exclude name="META-INF/**"/>
 156             </zipfileset>
 157         </zip>
 158     </target>
 159 
 160     <target name="ensemble-generate-samples-class" depends="init,compile" description="Ensemble: Generate source for all samples data class.">
 161        <java classname="ensemble.compiletime.EnsembleCompiletimeMain" fork="true">
 162          <arg value="samples"/>
 163          <classpath>
 164            <pathelement location="${build.classes.dir}"/>
 165            <pathelement path="${javac.classpath}"/>
 166          </classpath>
 167        </java>
 168     </target>
 169     
 170     <target name="ensemble-generate-search-index" depends="init,compile" description="Ensemble: Generate search index.">
 171        <delete dir="${basedir}/src/generated/ensemble/search/index"/>
 172        <java classname="ensemble.compiletime.EnsembleCompiletimeMain" fork="true">
 173          <arg value="index"/>
 174          <classpath>
 175            <pathelement location="${build.classes.dir}"/>
 176            <pathelement path="${javac.classpath}"/>
 177          </classpath>
 178        </java>
 179     </target>
 180     
 181 </project>