summaryrefslogblamecommitdiff
path: root/build.xml
blob: fd876f7d8e4b47f790f157810e776276ef61b42c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                                      
 


                                    




                                                                              
                  

                                                                         
 
                                 
                                     
                                                             

                                                                                                                                             






                                                                                                                                           
 
                                                    
                                                        
 





                                                                                                         


                                                                           
                                                                                                             
                                                                         
                                                                                                        
                                                                    
    
                                                                       
                                     
                             




                                                
           
 

                                               
                                             
           
 

                                                    
                                                         
                                                          


                                              

           


                                                                    


                                                                 
                              


                      
                      
                                                                                
 







                                                                         
                                                           


                                                               

                                                                                                                                                  



                                                                                                   

                                    
                                                                                                                                 
                                 

                                                                                                 

                                    
                                                                                                                                 
                                 



                                                                                                       
                                                                     
                                               
             
 
                                                                          
                                                                     
                                               
             
 
















                                                                                                                    
                                             
                                                                    
    

                                                                                          

                                                                       

                               
                                                                 
                        






                                                                           
                                                                    


                                
               
                
                                                   
                                                                      
                                                                     

                          
                 
             


                                                         
                                               
                                                                       
                                                       
                             
                       




                                                                  
                        
                                                        
                                                           

                                                      

              
 

                                                                                
                                         

                                                                 
                                                                                        
                                      
                       
                                                                 



                                                            
                        

                                                              
              

                                                                 
                                                                                        

                                      
                                                                 



                                                            
                        



                                                              


              

                                                                                               
                                           

                                                                   
                                                                                        

                                      
                                                                 



                                                              
                        

                                                         

              
 




                                                                                             
                                                




                                                                                 
                                                                                 
                                            




                                                                                 
                                                                               
                                          



                                                                 


                                                                               

             




                                                                         
 
                                





                                                                                                                            
                                









                                          
             
 



                                                                    
                                         
                                                                            



                                                                                                         
                                              
                                                    

                                                                    
                       
                                                                  
                                                                       
                                                                                                                                                                               
                                                                                 

                        

                                                                                  
                                                             
                                          
                                                              
                                          
                                                              






                                                                
                                       




                                                    
               

                                                                           


                                                                         
                              


                                                       


                                          
                                         
                                                                               

                                                                                                        

                                                        
                                       
                                                     

                                                                 



                                                                       
                                                                                        

                        

                                                                  




                                                                        

                                                                                                                                                                                                                  

                        

                                                                  




                                                                           

                                                                                                                                                                                                                  

                        
                                                                    
                                
                                                         


                                             




                                                     
               

                                                                            


                                                                          










                                                                         






                                              
 
                                                                            
                                                                      

                                                                       
                                              

                                              


                                                                              
                                               

                                                                             
               
                                                            
                                                                        
                                              

                                                            
                                                                 
               
                                                  

                                                        
                                         
                                                                                     
               



                                                                                          
                                                      

                                                                                                            
             
 
                                                               
 
                                                                          
                                                                         
                                             

                                                     
                                             
                                               

                                                                             
               
                                                                  
                                                        
                                                  
                                                 

                                                                              
               

                                                                            
                                                              
                                                                        
                                           

                                                         
                                         
                                                                                                      
               
                                                                        
                                           
                                                              
                                                                       
                                   

                                                                                                        
             
 




                                                                         
 









                                                                                               
                                                   





                                                                 
             
 




                                                                         
    
                                                                   
                                                           
                                                           
                                                               
                                                           

                                              
                  

                                                                                  
                                                                         
                                                                

                                                                      
                       

                                                        
                        




                                                                      
               
             
    





                                                                         
                        



                                                              
                                                
                                                                                           
 
                               
                                                          
                                                  

             
                                
                                                                    



                                                                 

             





                                                                         
                                         





                                                                    






                                                                         
          
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->

<project name="nsc" default="build">

    <description>
      This is SABBUS, the system to build the Scala NSC compiler as well as
      various related tools. The 'build.TEMPLATE.properties' file must be
      customised for your own particular system, no other customisation should
      be required. The build file expects the file structure of a Scala CVS
      distribution.
    </description>
    
    <echo>This is SABBUS, your helpful build script for new Scala.</echo>

    <property environment="env"/>
    <condition property="memory.set">
    	<contains string="${env.ANT_OPTS}" substring="-Xmx"/>
    </condition>
    <fail unless="memory.set">SABBUS requires additional memory. Please set the 'ANT_OPTS' environment property to '-Xmx256M' or more.</fail>
    <condition property="classpath.set">
    	<and>
    	    <isset property="env.CLASSPATH"/>
    	    <not><equals arg1="${env.CLASSPATH}" arg2="" trim="true"/></not>
    	</and>
    </condition>
    <fail if="classpath.set">SABBUS is too unstable when used with a non-empty classpath. Unset your classpath environment variable.</fail>

    <!-- The system classpath should not be used -->
    <property name="build.sysclasspath" value="ignore"/>

    <!-- Properties in 'build.base.properties' are all defined relatively
         to ${basedir}.
    -->
    <echo level="verbose">Loading properties from '${basedir}/build.support/build.base.properties'</echo>
    <property file="${basedir}/build.support/build.base.properties"/>

    <!-- Properties in 'build.${user.name}.properties' take precedence over
         properties in 'build.default.properties'.
    -->
    <echo level="verbose">Loading properties from '${build.support.dir}/build.${user.name}.properties'</echo>
    <property file="${build.support.dir}/build.${user.name}.properties"/>
    <echo level="verbose">Loading properties from '${build.support.dir}/build.default.properties'</echo>
    <property file="${build.support.dir}/build.default.properties"/>
    
    <!-- A path containing pre-compiled Scala libraries found typically
         in a Scala distribution. -->
    <path id="osc.classpath">
        <pathelement location="${oslib.jar}"/>
        <pathelement location="${oslib.src}"/>
        <pathelement location="${ostools.jar}"/>
        <pathelement location="${fjbg.jar}"/>
        <pathelement location="${msil.jar}"/>
    </path>

    <!-- A path containing the Pico library -->
    <path id="pico.classpath">
        <pathelement location="${jaco.jar}"/>
    </path>

    <!-- A path containing the new Scala library -->
    <path id="nsc.classpath">
        <pathelement location="${build.pico-nslib.dir}"/>
        <pathelement location="${build.osc-nstools.dir}"/>
        <pathelement location="${oslib.jar}"/>
        <pathelement location="${fjbg.jar}"/>
        <pathelement location="${msil.jar}"/>
    </path>

    <!-- The current Scala version -->
    <loadfile srcfile="${basedir}/VERSION" property="scala.version">
        <filterchain>
            <linecontainsregexp>
                <regexp pattern="[0-9]+\.[0-9]+\.[0-9]+\.[0-9]"/>
            </linecontainsregexp>
            <striplinebreaks/>
        </filterchain>
    </loadfile>

    <target name="all"
            description="Builds and tests everything; creates a distribution."/>

    <!--
    #####################################################################
    INIT
    #####################################################################
    -->
    
    <target name="init.osc">
        <echo level="verbose">oslib.jar=${oslib.jar}</echo>
        <echo level="verbose">oslib.src=${oslib.src}</echo>
        <echo level="verbose">ostools.jar=${ostools.jar}</echo>
        <echo level="verbose">fjbg.jar=${fjbg.jar}</echo>
        <echo level="verbose">msil.jar=${msil.jar}</echo>
        <fail message="Required classes for OSC are missing; check the 'oslib.jar', 'ostools.jar' properties in 'build.${user.name}.properties'.">
            <condition><not><and>
                <available classname="scala.List" classpathref="osc.classpath"/>
                <available classname="scala.runtime.RunTime" classpathref="osc.classpath"/>
                <available classname="scala.tools.scalac.Main" classpathref="osc.classpath"/>
                <available classname="scala.tools.scalac.ant.Scalac" classpathref="osc.classpath"/>
            </and></not></condition>
        </fail>
        <fail message="Required classes for FJBG are missing; check the 'fjbg.jar' property in 'build.${user.name}.properties'.">
            <condition><not><and>
                <available classname="ch.epfl.lamp.fjbg.JField" classpathref="osc.classpath"/>
                <available classname="ch.epfl.lamp.util.ByteArray" classpathref="osc.classpath"/>
            </and></not></condition>
        </fail>
        <fail message="Required classes for MSIL are missing; check the 'msil.jar' property in 'build.${user.name}.properties'.">
            <condition><not><and>
                <available classname="ch.epfl.lamp.compiler.msil.Module" classpathref="osc.classpath"/>
                <available classname="ch.epfl.lamp.compiler.msil.Type" classpathref="osc.classpath"/>
            </and></not></condition>
        </fail>
        <taskdef name="osc" classname="scala.tools.scalac.ant.Scalac"
                 classpathref="osc.classpath"/>
    </target>

    <target name="init.nsc" depends="build.osc.nstools, build.pico.nslib">
        <taskdef name="nsc" classname="scala.tools.nsc.ant.NSC$class"
                 classpathref="nsc.classpath"/>
    </target>

    <target name="init.pico">
        <echo level="verbose">jaco.jar=${jaco.jar}</echo>
        <fail message="Required classes for PiCo are missing; check the 'jaco.jar' property in 'build.properties'.">
            <condition><not><and>
                <available classname="jaco.pizza.Main" classpathref="pico.classpath"/>
                <available classname="jaco.pizza.ant.Pico" classpathref="pico.classpath"/>
            </and></not></condition>
        </fail>
        <taskdef name="pico" classname="jaco.pizza.ant.Pico" classpathref="pico.classpath"/>
    </target>
    
    <!--
    #####################################################################
    BUILD
    #####################################################################
    -->
    
    <target name="build" depends="build.jars"
            description="Builds new Scala (compiler and library)."/>
    
    <target name="build.pico.nslib" depends="init.pico"
            description="Builds the runtime and pico libraries of the new Scala library.">
        <mkdir dir="${build.pico-nslib.dir}"/>
        <pico srcdir="${sources.dir}" destdir="${build.pico-nslib.dir}"
              scalahack="true">
            <classpath>
                <pathelement location="${build.pico-nslib.dir}"/>
            </classpath>
            <or>
            <filename name="scala/runtime/*.java"/>
            <filename name="scala/runtime/**/*.java"/>
            <filename name="scala/tools/util/*.java"/>
            <and>
                <filename name="scala/*.java"/>
                <not><present targetdir="${newsources.dir}" present="both">
                    <mapper type="glob" from="*.scala" to="*.java"/>
                </present></not>
            </and>
            </or>
        </pico>
        <delete>
            <fileset dir="${build.pico-nslib.dir}">
                <present targetdir="${newsources.dir}" present="both">
                    <mapper type="glob" from="*.class" to="*.scala"/>
                </present>
            </fileset>
        </delete>
    </target>

    <target name="build.osc.nstools" depends="init.osc"
            description="Builds the new Scala compiler.">
        <mkdir dir="${build.osc-nstools.dir}"/>
        <osc srcdir="${sources.dir}" destdir="${build.osc-nstools.dir}"
             excludesfile="${nsc.osc-nstools.excludes}"
             force="changed">
            <classpath>
                <pathelement location="${build.osc-nstools.dir}"/>
                <pathelement location="${oslib.jar}"/>
                <pathelement location="${oslib.src}"/>
                <pathelement location="${fjbg.jar}"/>
                <pathelement location="${ant.jar}"/>
            </classpath>
            <include name="scala/tools/nsc/**/*.scala"/>
            <include name="scala/tools/scalap/**/*.scala"/>
            <include name="scala/runtime/*.scala"/>
            <include name="scala/runtime/**/*.scala"/>
        </osc>
    </target>

    <target name="build.nsc.nslib" depends="init.nsc, build.pico.nslib"
            description="Builds the Scala library with the new Scala compiler.">
        <mkdir dir="${build.nslib.dir}"/>
        <nsc srcdir="${sources.dir}" destdir="${build.nslib.dir}"
             usepredefs="false"
             stop="${nsc.stop}" skip="${nsc.skip}" check="${nsc.check}" log="${nsc.log}"
             logging="${nsc.logging}">
            <classpath>
                <pathelement location="${build.pico-nslib.dir}"/>
                <pathelement location="${build.nslib.dir}"/>
                <pathelement location="${sources.dir}"/>
                <pathelement location="${newsources.dir}"/>
                <pathelement location="${fjbg.jar}"/>
            </classpath>
            <include name="scala/Predef.scala"/>
            <include name="scala/runtime/ScalaRunTime.scala"/>
        </nsc>
        <nsc srcdir="${sources.dir}" destdir="${build.nslib.dir}"
             excludesfile="${nsc.nslib.excludes}"
             stop="${nsc.stop}" skip="${nsc.skip}" check="${nsc.check}" log="${nsc.log}"
             logging="${nsc.logging}">
            <classpath>
                <pathelement location="${build.pico-nslib.dir}"/>
                <pathelement location="${build.nslib.dir}"/>
                <pathelement location="${sources.dir}"/>
                <pathelement location="${newsources.dir}"/>
                <pathelement location="${fjbg.jar}"/>
            </classpath>
            <include name="scala/**/*.scala"/>
            <exclude name="scala/Predef.scala"/>
            <exclude name="scala/runtime/ScalaRunTime.scala"/>
            <exclude name="scala/tools/**"/>
        </nsc>
    </target>
    
    <target name="build.nsc.nstools" depends="init.nsc, build.nsc.nslib"
            description="Builds the Scala tools (NSC and Scalap) with the new Scala compiler.">
        <mkdir dir="${build.nstools.dir}"/>
        <nsc srcdir="${sources.dir}" destdir="${build.nstools.dir}"
             excludesfile="${nsc.nstools.excludes}"
             stop="${nsc.stop}" skip="${nsc.skip}" check="${nsc.check}" log="${nsc.log}"
             logging="${nsc.logging}">
            <classpath>
                <pathelement location="${build.pico-nslib.dir}"/>
                <pathelement location="${build.nslib.dir}"/>
                <pathelement location="${build.nstools.dir}"/>
                <pathelement location="${fjbg.jar}"/>
                <pathelement location="${ant.jar}"/>
            </classpath>
            <include name="scala/tools/nsc/**/*.scala"/>
            <exclude name="scala/tools/nsc/ant/*.scala"/>
        </nsc>
    </target>

    <target name="build.jars"
            depends="build.nsc.nslib, build.nsc.nstools, build.osc.nstools, build.pico.nslib"
            description="Builds JAR archives for all elements of Scala">
        <mkdir dir="${build.dir}"/>
        <jar destfile="${build.dir}/${osc-nstools.jar.name}" index="yes" update="yes"
             basedir="${build.osc-nstools.dir}">
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Main-Class" value="scala.tools.nsc.Main$class"/>
            </manifest>
        </jar>
        <jar destfile="${build.dir}/${nstools.jar.name}" index="yes" update="yes"
             basedir="${build.nstools.dir}">
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
                <attribute name="Main-Class" value="scala.tools.nsc.Main$class"/>
            </manifest>
        </jar>
        <jar destfile="${build.dir}/${nslib.jar.name}" index="yes" update="yes"
             basedir="${build.nslib.dir}">
            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
            </manifest>
        </jar>
        <jar destfile="${build.dir}/${nslib.jar.name}" index="yes" update="yes"
             basedir="${build.pico-nslib.dir}">
        </jar>
    </target>

    <!--
    #####################################################################
    DISTRIB
    #####################################################################
    -->

    <target name="distrib.init">
        <echo level="verbose">scala.dll=${scala.dll}</echo>
        <fail message="Required DLL library is missing; check the 'scala.dll' property in 'build.${user.name}.properties'.">
            <condition><not><and>
                <available file="${scala.dll}"/>
            </and></not></condition>
        </fail>
    	<tstamp prefix="start"/>
    	<condition property="os.unix"><or>
                <os family="unix"/>
                <os family="mac"/>
        </or></condition>
        <condition property="os.mac">
            <os family="mac"/>
        </condition>
        <condition property="os.win">
            <os family="windows"/>
        </condition>
    </target>

    <target name="distrib" depends="distrib.unix, distrib.win"
            description="Creates a simplified Scala distribution."/>

    <target name="distrib.unix" if="os.unix"
            depends="build, distrib.init"
            description="Creates a simplified Scala distribution for Unix.">
        <property name="distrib.unix.current.dir"
                  value="${distrib.unix.dir}/${distrib.current.prefix}-${start.DSTAMP}-${start.TSTAMP}"/>
        <property name="distrib.unix.scala.dir"
                  value="${distrib.unix.current.dir}/share/scala"/>
        <!-- Set up 'bin' directory (unix) -->
        <mkdir dir="${distrib.unix.scala.dir}/bin"/>
        <copy file="${support.dir}/bin/nscala.unix.tmpl"
              tofile="${distrib.unix.scala.dir}/bin/.scala_wrapper">
            <filterset>
                <filter token="VERSION" value="${scala.version}"/>
                <filter token="COPYRIGHT" value="${copyright.notice}"/>
                <filter token="TOOLS_CPATH" value="$PREFIX/lib/fjbg.jar:$PREFIX/lib/msil.jar:$PREFIX/lib/scala.jar:$PREFIX/lib/tools.jar:$PREFIX/lib/${osc-nstools.jar.name}"/>
                <filter token="LIB_CPATH" value="$PREFIX/lib/${nslib.jar.name}"/>
            </filterset>
        </copy>
        <chmod file="${distrib.unix.scala.dir}/bin/.scala_wrapper" perm="ugo+rx"/>
        <symlink resource=".scala_wrapper"
                 link="${distrib.unix.scala.dir}/bin/scala"/>
        <symlink resource=".scala_wrapper"
                 link="${distrib.unix.scala.dir}/bin/scalac"/>
        <symlink resource=".scala_wrapper"
                 link="${distrib.unix.scala.dir}/bin/scalap"/>
        <mkdir dir="${distrib.unix.current.dir}/bin"/>
        <symlink resource="${distrib.unix.scala.dir}/bin/scala"
                 link="${distrib.unix.current.dir}/bin/scala"/>
        <symlink resource="${distrib.unix.scala.dir}/bin/scalac"
                 link="${distrib.unix.current.dir}/bin/scalac"/>
        <symlink resource="${distrib.unix.scala.dir}/bin/scalap"
                 link="${distrib.unix.current.dir}/bin/scalap"/>
        <!-- Set up 'lib' directory -->
        <mkdir dir="${distrib.unix.scala.dir}/lib"/>
        <copy todir="${distrib.unix.scala.dir}/lib">
            <fileset dir="${build.dir}">
                <include name="*.jar"/>
            </fileset>
        </copy>
        <copy todir="${distrib.unix.scala.dir}/lib" file="${oslib.jar}"/>
        <copy todir="${distrib.unix.scala.dir}/lib" file="${ostools.jar}"/>
        <copy todir="${distrib.unix.scala.dir}/lib" file="${fjbg.jar}"/>
        <copy todir="${distrib.unix.scala.dir}/lib" file="${msil.jar}"/>
        <copy todir="${distrib.unix.scala.dir}/lib" file="${scala.dll}"/>
        <!-- Set up latest -->
        <symlink resource="${distrib.unix.current.dir}"
                 link="${distrib.unix.dir}/latest"
                 overwrite="yes"/>
    </target>

    <target name="distrib.win" if="os.win"
            depends="build, distrib.init"
            description="Creates a simplified Scala distribution for Windows.">
        <property name="distrib.win.current.dir"
                  value="${distrib.win.dir}/${distrib.current.prefix}-${start.DSTAMP}-${start.TSTAMP}"/>
        <property name="quotted.lib.dir"
                  value="&quot;%SCALA_HOME%&quot;\lib"/>
        <!-- Set up 'bin' directory -->
        <mkdir dir="${distrib.win.current.dir}/bin"/>
        <copy file="${support.dir}/bin/nscala.win.tmpl"
              tofile="${distrib.win.current.dir}/bin/nscala.bat">
            <filterset>
                <filter token="PRODUCT"   value="scala"/>
                <filter token="VERSION"   value="${scala.version}"/>
                <filter token="COPYRIGHT" value="${copyright.notice}"/>
                <filter token="BOOTCPATH" value="${quotted.lib.dir}\${nslib.jar.name}"/>
            </filterset>
        </copy>
        <copy file="${support.dir}/bin/nscala-tool.win.tmpl"
              tofile="${distrib.win.current.dir}/bin/nscalac.bat">
            <filterset>
                <filter token="PRODUCT"   value="scalac"/>
                <filter token="VERSION"   value="${scala.version}"/>
                <filter token="COPYRIGHT" value="${copyright.notice}"/>
                <filter token="MAIN"      value="scala.tools.nsc.Main"/>
                <filter token="TOOLS_CPATH" value="${quotted.lib.dir}\fjbg.jar;${quotted.lib.dir}\msil.jar;${quotted.lib.dir}\scala.jar;${quotted.lib.dir}\tools.jar;${quotted.lib.dir}\${osc-nstools.jar.name}"/>
                <filter token="LIB_CPATH"     value="${quotted.lib.dir}\${nslib.jar.name}"/>
            </filterset>
        </copy>
        <copy file="${support.dir}/bin/nscala-tool.win.tmpl"
              tofile="${distrib.win.current.dir}/bin/nscalap.bat">
            <filterset>
                <filter token="PRODUCT"   value="scalap"/>
                <filter token="VERSION"   value="${scala.version}"/>
                <filter token="COPYRIGHT" value="${copyright.notice}"/>
                <filter token="MAIN"      value="scala.tools.scalap.Main"/>
                <filter token="TOOLS_CPATH" value="${quotted.lib.dir}\fjbg.jar;${quotted.lib.dir}\msil.jar;${quotted.lib.dir}\scala.jar;${quotted.lib.dir}\tools.jar;${quotted.lib.dir}\${osc-nstools.jar.name}"/>
                <filter token="LIB_CPATH"     value="${quotted.lib.dir}\${nslib.jar.name}"/>
            </filterset>
        </copy>
        <fixcrlf srcdir="${distrib.win.current.dir}/bin" eol="dos"/>
        <attrib readonly="true">
            <fileset dir="${distrib.win.current.dir}/bin"
                     includes="**/*.bat"/>
        </attrib>
        <!-- Set up 'lib' directory (win) -->
        <mkdir dir="${distrib.win.current.dir}/lib"/>
        <copy todir="${distrib.win.current.dir}/lib">
            <fileset dir="${build.dir}">
                <include name="*.jar"/>
            </fileset>
        </copy>
        <copy todir="${distrib.win.current.dir}/lib" file="${oslib.jar}"/>
        <copy todir="${distrib.win.current.dir}/lib" file="${ostools.jar}"/>
        <copy todir="${distrib.win.current.dir}/lib" file="${fjbg.jar}"/>
        <copy todir="${distrib.win.current.dir}/lib" file="${msil.jar}"/>
        <copy todir="${distrib.win.current.dir}/lib" file="${scala.dll}"/>
    </target>

    <!--
    #####################################################################
    FULL DISTRIB
    #####################################################################
    -->

    <target name="distrib.all"
            depends="distrib.unix.all, distrib.win.all"
            description="Creates a full Scala distribution."/>
    
    <target name="distrib.all.init"
            depends="docs">
        <property name="os.unix" value="yes"/>
        <property name="os.win" value="yes"/>
        <property name="os.mac" value="yes"/>
    </target>

    <target name="distrib.unix.all" depends="distrib.all.init, distrib.unix"
            description="Creates a full Scala distribution for Unix.">
        <property name="distrib.unix.doc.dir"
                  value="${distrib.unix.current.dir}/share/doc/scala"/>
        <!-- Set up 'doc' directory (unix) -->
        <mkdir dir="${distrib.unix.doc.dir}"/>
        <copy todir="${distrib.unix.doc.dir}">
            <fileset dir="${basedir}" includes="LICENSE,README,VERSION"/>
            <fileset dir="${basedir}/sources" includes="examples/**/*.scala"/>
            <fileset dir="${build.dir}/doc"/>
            <fileset dir="${doc.dir}/reference"
                     includes="ScalaByExample.pdf,ScalaReference.pdf"/>
            <fileset dir="${doc.dir}/tutorial" includes="ScalaTutorial.pdf"/>
        </copy>
        <fixcrlf srcdir="${distrib.unix.doc.dir}" eol="unix"
                 includes="LICENSE,README,VERSION,examples/**/*.scala"/>
        <!-- Set up 'man' directory (unix) -->
        <mkdir dir="${distrib.unix.current.dir}/share/man"/>
        <copy todir="${distrib.unix.current.dir}/share/man">
            <fileset dir="${support.dir}/man" includes="**/*.1"/>
        </copy>
        <!-- Set up 'support' directory (unix) -->
        <mkdir dir="${distrib.unix.scala.dir}/support"/>
        <copy todir="${distrib.unix.scala.dir}/support">
            <fileset dir="${support.dir}"
                     includes="emacs/**,gedit/**,jedit/**,scite/**,vim/**,xcode/**"/>
        </copy>
        <fixcrlf srcdir="${distrib.unix.scala.dir}/support" eol="unix"/>
        <!-- Set up 'sources.tar.gz' (unix) -->
        <tar destfile="${distrib.unix.scala.dir}/sources.tar.gz"
             basedir="${basedir}" includes="sources/scala/**/*.scala" compression="gzip"/>
        <!-- Create gz and bz2 compressed tarballs -->
        <tar destfile="${distrib.unix.dir}/${distrib.current.prefix}-${start.DSTAMP}-${start.TSTAMP}.tar.gz"
             basedir="${distrib.unix.current.dir}" compression="gzip"/>
    </target>

    <target name="distrib.mac.all" depends="distrib.unix.all"/>

    <target name="distrib.win.all" depends="distrib.all.init, distrib.win"
            description="Creates a full Scala distribution for Windows.">
        <!-- Set up 'doc' directory (win) -->
        <mkdir dir="${distrib.win.current.dir}/doc"/>
        <copy todir="${distrib.win.current.dir}/doc">
            <fileset dir="${build.dir}/doc"/>
            <fileset dir="${doc.dir}/reference"
                     includes="ScalaByExample.pdf,ScalaReference.pdf"/>
            <fileset dir="${doc.dir}/tutorial" includes="ScalaTutorial.pdf"/>
        </copy>
        <fixcrlf srcdir="${distrib.win.current.dir}/doc" eol="dos"
                 includes="**/*.css,**/*.html,**/*.js"/>
        <!-- Set up 'examples' directory (win) -->
        <copy todir="${distrib.win.current.dir}">
            <fileset dir="${basedir}" includes="LICENSE,README,VERSION"/>
            <fileset dir="${basedir}/sources" includes="examples/**/*.scala"/>
        </copy>
        <copy file="${basedir}/VERSION"
              tofile="${distrib.win.current.dir}/VERSION-${scala.version}"/>
        <fixcrlf srcdir="${distrib.win.current.dir}" eol="dos"
                 includes="LICENSE,README,VERSION,examples/**/*.scala"/>
        <!-- Set up 'support' directory -->
        <mkdir dir="${distrib.win.current.dir}/support"/>
        <copy todir="${distrib.win.current.dir}/support">
            <fileset dir="${support.dir}"
                     includes="context/**,emacs/**,jedit/**,scite/**,textpad/**,ultraedit/**,vim/**"/>
        </copy>
        <fixcrlf srcdir="${distrib.win.current.dir}/support" eol="dos"/>
        <!-- Set up 'sources.zip' (win) -->
        <zip destfile="${distrib.win.current.dir}/sources.zip"
             basedir="${basedir}" includes="sources/scala/**/*.scala"/>
        <!-- Create zip archive -->
        <zip destfile="${distrib.win.dir}/${distrib.current.prefix}-${start.DSTAMP}-${start.TSTAMP}.zip"
             basedir="${distrib.win.current.dir}"/>
    </target>

    <!--
    #####################################################################
    TEST
    #####################################################################
    -->

    <target name="init.test">
        <fail message="Missing library ${junit.jar} in ${ant.home}.">
            <condition><not><and>
                <available classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
            </and></not></condition>
        </fail>
    </target>

    <target name="test" depends="init.test, init.nsc"
            description="Runs the Scala test suite.">
        <fail>'test' is not implemented yet.</fail>
    <!--
        <junit printsummary="yes" fork="yes" haltonfailure="yes">
            <formatter type="plain"/>
            <test name="my.test.TestCase"/>
        </junit>
    -->
    </target>

    <!--
    #####################################################################
    DOCS
    #####################################################################
    -->
    
    <target name="docs" description="Generates all documentation.">
        <echo level="verbose">oslib.jar=${oslib.jar}</echo>
        <echo level="verbose">oslib.src=${oslib.src}</echo>
        <echo level="verbose">ostools.jar=${ostools.jar}</echo>
        <fileset id="oslib.src.files" dir="${sources.dir}">
            <include name="scala/**/*.scala"/>
            <exclude name="scala/tools/**"/>
        </fileset>
        <pathconvert pathsep=" " property="docs.sources" refid="oslib.src.files"/>
        <mkdir dir="${build.dir}/doc/api"/>
        <echo>Generating API documentation to ${build.dir}/doc/api</echo>
        <java classname="scala.tools.scaladoc.Main" fork="true">
            <jvmarg value="-Dscala.library.source.path=${oslib.src}"/>
            <jvmarg value="-Dscala.library.class.path=${oslib.jar}"/>
            <classpath>
                <pathelement location="${oslib.jar}"/>
                <pathelement location="${ostools.jar}"/>
            </classpath>
            <arg line="-windowtitle 'Scala Library Documentation'"/>
            <arg line="-doctitle 'Scala&lt;br/&gt;${scala.version}'"/>
            <arg line="-d ${build.dir}/doc/api"/>
            <arg line="${docs.sources}"/>
            <arg line="-- scala"/>
        </java>
    </target>
    
    <!--
    #####################################################################
    CLEAN
    #####################################################################
    -->
    
    <target name="clean"
            depends="clean.build"
            description="Deletes all generated build files."/>
    
    <target name="clean.all"
            depends="clean.build, clean.distrib"
            description="Deletes all generated files, both build and distribution files."/>

    <target name="clean.build">
        <delete dir="${build.dir}" includeemptydirs="true"
                quiet="true" failonerror="false"/>
    </target>
    
    <target name="clean.distrib"
            description="Deletes all generated distribution files.">
        <delete dir="${distrib.unix.dir}" includeemptydirs="true"
                quiet="true" failonerror="false"/>
        <delete dir="${distrib.win.dir}" includeemptydirs="true"
                quiet="true" failonerror="false"/>
    </target>

    <!--
    #####################################################################
    HELP
    #####################################################################
    -->

    <target name="help" depends="usage"/>

    <target name="usage" description="Display usage information.">
        <echo>Execute 'ant -projecthelp' for build file help.</echo>
        <echo>Execute 'ant -help' for Ant help.</echo>
    </target>

    <!--
    #####################################################################
    IZPACK
    #####################################################################
    -->
    <import file="${build.support.dir}/build-izpack.xml"/>

</project>