alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (build.detach.xml)

This example Scala source code file (build.detach.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

build, build, defines, end-user, loads, packed, packed, quick, quick, scala, scala, suite, test, utf-8

The Scala build.detach.xml source code

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

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

  <description>
SuperSabbus for Scala detach plugin.
  </description>

  <echo level="info" message="Running SABBUS for ${ant.project.name}..."/>

<!-- ===========================================================================
END-USER TARGETS
============================================================================ -->
  
  <target name="build" depends="pack.done"
    description="Builds the Scala detach plugin."/>

  <target name="clean" depends="quick.clean">
  </target>

  <target name="all.clean" depends="quick.clean, pack.clean">
  </target>

<!-- ===========================================================================
PROPERTIES
============================================================================ -->

  <property environment="env"/>
  <!-- Prevents system classpath from being used -->
  <property name="build.sysclasspath" value="ignore"/>

  <!-- Defines the repository layout -->
  <property name="lib.dir" value="${basedir}/lib"/>
  <property name="src.dir" value="${basedir}/src"/>
  <property name="partest.dir" value="${basedir}/test"/>

  <!-- Loads custom properties definitions -->
  <property file="${basedir}/build.properties"/>

  <!-- Sets location of build folders -->
  <property name="build.dir" value="${basedir}/build"/>
  <property name="build-quick.dir" value="${build.dir}/quick"/>
  <property name="build-pack.dir" value="${build.dir}/pack"/>

  <!-- if ANT_OPTS is already set by the environment, it will be unaltered,
       but if it is unset it will take this default value. -->
  <property name="env.ANT_OPTS" value="-Xms1024M -Xmx1024M -Xss1M -XX:MaxPermSize=128M -XX:+UseParallelGC" />

  <property
      name="scalacfork.jvmargs"
      value="${env.ANT_OPTS}"/>

  <property name="scalac.args.quick" value="-deprecation"/>
  <property name="scalac.args.optimise" value=""/>

  <!-- Setting-up Ant contrib tasks -->
    <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib.dir}/ant/ant-contrib.jar"/>

<!-- ===========================================================================
QUICK BUILD (QUICK)
============================================================================ -->

  <target name="quick.clean">
    <delete includeemptydirs="yes" quiet="yes" failonerror="no">
      <fileset dir="${build-quick.dir}/classes/detach-library"/>
      <fileset dir="${build-quick.dir}/classes/detach-plugin"/>
    </delete>
  </target>

  <target name="quick.done">
    <stopwatch name="quick.done.timer"/>
    <path id="quick.classpath">
      <pathelement location="${build-quick.dir}/classes/library"/>
      <pathelement location="${build-quick.dir}/classes/compiler"/>
      <pathelement location="${lib.dir}/fjbg.jar"/>
      <pathelement location="${lib.dir}/msil.jar"/>
      <pathelement location="${lib.dir}/forkjoin.jar"/>
      <pathelement location="${ant.home}/lib/ant.jar"/>
    </path>
    <taskdef
      resource="scala/tools/ant/sabbus/antlib.xml"
      classpathref="quick.classpath"
    />
    <mkdir dir="${build-quick.dir}/classes/detach-plugin"/>
    <scalacfork
      destdir="${build-quick.dir}/classes/detach-plugin"
      compilerpathref="quick.classpath"
      params="${scalac.args.quick}"
      srcdir="${src.dir}/detach/plugin"
      jvmargs="${scalacfork.jvmargs}">
      <include name="**/*.scala"/>
      <compilationpath>
        <pathelement location="${build-quick.dir}/classes/library"/>
        <pathelement location="${build-quick.dir}/classes/compiler"/>
        <pathelement location="${build-quick.dir}/classes/detach-plugin"/>
        <pathelement location="${lib.dir}/forkjoin.jar"/>
      </compilationpath>
    </scalacfork>
    <copy
       file="${src.dir}/detach/plugin/scalac-plugin.xml"
       todir="${build-quick.dir}/classes/detach-plugin"
    />
    <mkdir dir="${build-quick.dir}/classes/detach-library"/>
    <scalacfork
      destdir="${build-quick.dir}/classes/detach-library"
      compilerpathref="quick.classpath"
      params="${scalac.args.quick}"
      srcdir="${src.dir}/detach/library"
      jvmargs="${scalacfork.jvmargs}">
      <include name="**/*.scala"/>
      <compilationpath>
        <pathelement location="${build-quick.dir}/classes/library"/>
        <pathelement location="${lib.dir}/forkjoin.jar"/>
      </compilationpath>
    </scalacfork>
    <touch file="${build-quick.dir}/plugins.complete" verbose="no"/>
    <stopwatch name="quick.done.timer" action="total"/>
  </target>

<!-- ===========================================================================
PACKED QUICK BUILD (PACK)
============================================================================ -->
  
  <target name="pack.start" depends="quick.done"/>
  
  <target name="pack.pre-lib" depends="pack.start">
    <uptodate
      property="pack.lib.available"
      targetfile="${build-pack.dir}/lib/scala-detach.jar"
      srcfile="${build-quick.dir}/plugins.complete"/>
  </target>

  <target name="pack.lib" depends="pack.pre-lib" unless="pack.lib.available">
    <mkdir dir="${build-pack.dir}/misc/scala-devel/plugins"/>
    <jar destfile="${build-pack.dir}/misc/scala-devel/plugins/detach.jar">
      <fileset dir="${build-quick.dir}/classes/detach-plugin"/>
    </jar>
    <mkdir dir="${build-pack.dir}/lib"/>
    <jar destfile="${build-pack.dir}/lib/scala-detach.jar">
      <fileset dir="${build-quick.dir}/classes/detach-library">
        <include name="scala/**"/>
      </fileset>
    </jar>
  </target>

  <target name="pack.done" depends="pack.lib">
    <path id="pack.classpath">
      <pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
      <pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
      <pathelement location="${build-pack.dir}/lib/scala-detach.jar"/>
      <pathelement location="${build-pack.dir}/lib/scala-partest.jar"/>
      <pathelement location="${build-pack.dir}/lib/scalap.jar"/>
      <pathelement location="${ant.home}/lib/ant.jar"/>
      <pathelement location="${lib.dir}/jline.jar"/>
    </path>
    <taskdef resource="scala/tools/ant/antlib.xml" classpathref="pack.classpath"/>
    <taskdef resource="scala/tools/partest/antlib.xml" classpathref="pack.classpath"/>
  </target>

  <target name="pack.clean">
    <delete includeemptydirs="yes" quiet="yes" failonerror="no">
      <fileset dir="${build-pack.dir}/lib" includes="scala-detach.jar"/>
      <fileset dir="${build-pack.dir}/misc/scala-devel/plugins" includes="detach.jar"/>
    </delete>
  </target>

<!-- ===========================================================================
TEST SUITE
============================================================================ -->

  <target name="test.suite" depends="pack.done">
    <property name="partest.srcdir" value="files" />
    <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
             timeout="2400000"
             srcdir="${partest.srcdir}"
             scalacopts="${scalac.args.optimise} -Xpluginsdir ${build-pack.dir}/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable">
      <compilationpath>
        <path refid="pack.classpath"/>
        <fileset dir="${partest.dir}/files/lib" includes="*.jar" />
      </compilationpath>
      <negtests  dir="${partest.dir}/${partest.srcdir}/detach-neg" includes="*.scala"/>
      <runtests  dir="${partest.dir}/${partest.srcdir}/detach-run" includes="*.scala"/>
    </partest>
  </target>

</project>

Other Scala examples (source code examples)

Here is a short list of links related to this Scala build.detach.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.